Link in udev rules.d

Bug #197968 reported by Helge Stenström
6
Affects Status Importance Assigned to Milestone
libmtp (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

There is a link in /etc/udev/rules.d: libmtp.rules -> ../libmtp.rules
Yet the README file in the same directory says:

The udev daemon watches this directory with inotify so that changes to these files are automatically picked up, for this reason they must be files and not symlinks to another location as in the case in Debian.

Therefore, I expect a regular file in place of the symlink.

Ubuntu 7.10
libmtp6 version 0.2.1-0ubuntu3

Related branches

Revision history for this message
Flávio Martins (flavioxmartins) wrote :

Would you care to explain a bit further what are the implications of having it as it is?
I'm not sure if i understand, are you saying udev will not pick changes if it's a link?
Thanks

Changed in libmtp:
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
Helge Stenström (h-stenstrom) wrote : Re: [Bug 197968] Re: Link in udev rules.d

I have no idea about the implications. I have only read the README
briefly. There must be a reason why they what they say.

Helge

2008/3/7, Flávio Martins <email address hidden>:
> Would you care to explain a bit further what are the implications of having it as it is?
> I'm not sure if i understand, are you saying udev will not pick changes if it's a link?
> Thanks
>
> ** Changed in: libmtp (Ubuntu)
> Importance: Undecided => Wishlist
> Status: New => Incomplete
>
>
> --
> Link in udev rules.d
> https://bugs.launchpad.net/bugs/197968
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Helge Stenström (h-stenstrom) wrote :

I assume that the implication is that inotify will not see that the file has changed, since the symbolic link doesn't change when the file it points to changes.
The README file, and its recommendation to not use symbolic links, is a part of the udev package.
inotify is a part of the Linux kernel.

Revision history for this message
Martin Pitt (pitti) wrote :

Confirmed, I have that on my Hardy system as well.

Changed in libmtp:
status: Incomplete → Confirmed
Revision history for this message
Flávio Martins (flavioxmartins) wrote :

I've tried to fix it (debdiff attached), but I'm not so sure if I'm doing the right thing in libmtp.preinst.in
Martin, could you take a look at it?

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, Flavio. This needs some improvements, though:

 - "rm -f $PACKAGE /etc/udev/rules.d/libmtp7.rules" should disappear; looks like some kind of copy&paste error
 - rm_conffile is not the right semantics here, since the conffile moved to /etc/udev/rules.d/ instead of disappearing entirely. Please look at how /var/lib/dpkg/info/udev.{preinst,postinst,postrm} handles mv_conffile, that is a good reference recipe.
 - The dpkg --compare-versions comparison needs to be fixed: you want to do the transition for every previous version before the one that fixes the bug, but not at all if the package was installed from scratch ($2 is empty): thus, "le 0.2.6.1-1" -> "lt-nl 0.2.6.1-2ubuntu1".

Please test the upgrade with an unmodified and a modified conffile, and also verify that an installation from scratch works as expected. Thank you!

P.S. I'm subscribed to the bug now, so I'll reply to your followups without much delay.

Revision history for this message
Flávio Martins (flavioxmartins) wrote :

The debdiff is improved.
From what I've tested it just would not work as expected on upgrade with a modified libmtp7.rules
I'm so green in this move conffiles drill that I don't understand what's going on.

Help is appreciated.

Revision history for this message
Flávio Martins (flavioxmartins) wrote :

On upgrade with a modified libmtp7.rules:
- /etc/udev/libmtp7.rules the old modified file remains where it is.
- /etc/udev/rules.d/libmtp7.rules is the new file
So it seems the file doesn't get moved in this case.

Revision history for this message
Martin Pitt (pitti) wrote :

Flavio, I guess the reason is that you forcefully remove the file before calling prep_mv:

+ if dpkg --compare-versions "$2" lt-nl 0.2.6.1-2ubuntu1 ; then
+ rm -f /etc/udev/rules.d/libmtp@SOVERSION@.rules
+ prep_mv_conffile $PACKAGE /etc/udev/libmtp@SOVERSION@.rules

(see the first point of my previous mail). Once you remove it, it should work, the patch actually looks pretty good (except for this rm). Thank you!

Revision history for this message
Martin Pitt (pitti) wrote :

Oh, sorry for my previous comment, I misread the patch. You actually remove the *new* location there, not the *old* one. I just had another look, and I found something in postinst.in:

+mv_conffile() {
+ OLDCONFFILE="$1"
+ NEWCONFFILE="$2"

I. e. mv_conffile() takes two arguments, but you actually pass three:

+ mv_conffile $PACKAGE /etc/udev/libmtp@SOVERSION@.rules \
+ /etc/udev/rules.d/libmtp@SOVERSION@.rules

So as far as I can see it should be enough to drop the $PACKAGE argument, then it should work. Good luck!

Revision history for this message
Flávio Martins (flavioxmartins) wrote :

Great! All in working order.
Should be good to go.

Copy&paste tricked me two times.
Thanks for your help Martin.

Revision history for this message
Martin Pitt (pitti) wrote :

Ah, I just noticed that the new file in rules.d/ does not have a prefix. I'll fix that.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libmtp - 0.2.6.1-2ubuntu1

---------------
libmtp (0.2.6.1-2ubuntu1) hardy; urgency=low

  [ Flávio Martins ]
  * Sync with Debian.
  * Install rules directly instead of a link. Closes LP: #197968
  * Install hal fdi information. Closes LP: #205749

  [ Martin Pitt ]
  * While we juggle the conffile anyway, add a proper prefix (45-) to the udev
    rule file.

libmtp (0.2.6.1-2) unstable; urgency=low

  * debian/control.in:
    + Change the relationship to udev from Depends to Recommends
      (closes: #472048)
    + Append trunk/ to the path in Vcs-Svn:, such that debcheckout works

 -- Martin Pitt <email address hidden> Thu, 10 Apr 2008 11:11:39 -0500

Changed in libmtp:
status: Confirmed → Fix Released
Revision history for this message
Flávio Martins (flavioxmartins) wrote :
  • unnamed Edit (363 bytes, text/html; charset=ISO-8859-1)

Hey Martin, in debian/rules you could have just:

-UDEVFILES = libmtp$(SOVERSION).rules 20-libmtp$(SOVERSION).fdi
+UDEVFILES = 45-libmtp$(SOVERSION).rules 20-libmtp$(SOVERSION).fdi

Don't know if it'd be better to do it this way, or install the fdi like you
did for .rules.

I will send a patch to Debian after hearing from you.

Revision history for this message
Martin Pitt (pitti) wrote :

Hi,

Flávio Martins [2008-04-10 17:19 -0000]:
> Hey Martin, in debian/rules you could have just:
>
> -UDEVFILES = libmtp$(SOVERSION).rules 20-libmtp$(SOVERSION).fdi
> +UDEVFILES = 45-libmtp$(SOVERSION).rules 20-libmtp$(SOVERSION).fdi
>
> Don't know if it'd be better to do it this way, or install the fdi like you
> did for .rules.

Oh, it's certainly more elegant. I did not dig into the quite
nonstandard packaging too deep, I did that with half a brain while I
was in a discussion round on a conference. :)

Thanks, Martin

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.