tags 469855 + patch
thanks

On Fri, Mar 07, 2008 at 08:07:14PM +0100, Sebastian Harl wrote:
> Hi,
> 
> On Fri, Mar 07, 2008 at 06:47:53PM +0100, Julien Cristau wrote:
> > On Fri, Mar  7, 2008 at 18:36:07 +0100, Sebastian Harl wrote:
> > > Sorry, this patch does not change anything. "a && b" is basically the
> > > same as "if a; then b; fi" which is what you're doing here. This issue
> > > has already been addressed in the fix for #447961.
> > > 
> > Well no. "a && b" is only successful if both "a" and "b" exit
> > successfully.  If you don't want to fail when udev is not running, that
> > patch is correct.
> 
> Well, the problem is that "udev restart" fails (which is "b" in this
> case). It doesn't really matter if "a && b" fails (that's the reason I
> said "basically the same" ;-) as the "-e" option has not been set and
> thus the return value will simply be ignored - which (imho) is perfectly
> fine in this case.

Um, unless my eyes deceive me, -e is set right on the first line -- just
as it should per policy.  However, you bring up a good point in that the
udevd process that is running outside the chroot will be visible to
pidof within the chroot.  So, here's an improved patch based on how the
udev postinst detects if it's run inside a chroot:


--- postinst    2008-02-08 10:13:24.000000000 -0500
+++ postinst.fixed      2008-03-09 00:34:04.000000000 -0500
@@ -19,8 +19,14 @@ case "$1" in
     chmod 770 /var/run/nut /var/lib/nut
 
     # restart udev to apply the USB rules to the already plugged devices
-    [ -x /etc/init.d/udev ] && pidof udevd > /dev/null \
-               && /usr/sbin/invoke-rc.d udev restart
+    # only if it's already running in this environment
+    udevd_pid=$(pidof udevd)
+    if [ -x /etc/init.d/udev ] && [ -n "$udev_pid" ]; then
+        if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/$udev_pid/root 
2>/dev/null)" ];
+        then
+            /usr/sbin/invoke-rc.d udev restart
+        fi
+    fi
     ;;
 
   abort-upgrade)


--Joe



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to