On Sun, Nov 27, 2005 at 11:57:29PM +0100, Marco d'Itri wrote:
> found 341040 0.060-1
> thanks
> 
> On Nov 27, Lionel Elie Mamane <[EMAIL PROTECTED]> wrote:
> 
> > Preparing to replace udev 0.056-2 (using 
> > .../archives/udev_0.076-2_i386.deb) ...
> > ln: creating symbolic link `/etc/udev/rules.d/z20_persistent.rules' to 
> > `../persistent.rules': File exist
> > dpkg: error processing /var/cache/apt/archives/udev_0.076-2_i386.deb 
> > (--unpack):
> >  subprocess pre-installation script returned error exit status 1
> I am not sure about what causes this bug, the script checks if the link
> exists before creating it:
> 
>   [ -e /etc/udev/rules.d/z20_persistent.rules ] || \
>     ln -s ../persistent.rules /etc/udev/rules.d/z20_persistent.rules
> 

When foo exists and is a symlink, "[ -e foo ]" evaluates to "true" (0)
if and only the file being linked _to_ exists. You want to use -L or
-h for symlinks that may be dangling. (The full test should probably
be

 [ -e /etc/udev/rules.d/z20_persistent.rules ] || [ -h 
/etc/udev/rules.d/z20_persistent.rules ]

to cover both cases where the file exists and is a symlink and when it
is not.


-L and -h seem not to be in SUSv2, but are in SUSv3 (and work in
dash). (Not sure about POSIX.)


-- 
Lionel


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

Reply via email to