Package: xutils
Version: 4.2.1-6
Severity: normal
Tags: upstream patch

According to its manpage "cleanlinks" does only remove dangling 
symlinks and empty directories, so I'd expect it not to remove a 
symlink to an existing unempty directory. But:

[EMAIL PROTECTED]:~/test$ ls -Al
total 0
lrwxrwxrwx    1 fernst   fernst          5 2003-08-06 18:22 home ->
/home/
lrwxrwxrwx    1 fernst   fernst         21 2003-08-06 18:22 .xinitrc 
-> /home/fernst/.xinitrc*
[EMAIL PROTECTED]:~/test$ cleanlinks
./home is a dangling symlink, removing
Removing empty directories ...
[EMAIL PROTECTED]:~/test$ ls -Al
total 0
lrwxrwxrwx    1 fernst   fernst         21 2003-08-06 18:22 .xinitrc 
-> /home/fernst/.xinitrc*


It appears the "cleanlinks"-script only checks for the symlinks-target
"file" but not for "directory", so the following patch could fix it:

--- /usr/bin/X11/cleanlinks.old  2003-02-26 01:52:11.000000000 +0100
+++ /usr/bin/X11/cleanlinks  2003-08-06 18:40:30.000000000 +0200
@@ -13,7 +13,7 @@
 (
        read i
        while [ X"$i" != X ]; do
-               if [ ! -f "$i" ]; then
+               if [ ! \( -f "$i" -o -d "$i" \) ]; then
                        echo $i is a dangling symlink, removing
                        rm -f "$i"
                fi


After applying this patch:

[EMAIL PROTECTED]:~/test$ ls -Al
total 0
lrwxrwxrwx    1 fernst   fernst          5 2003-08-06 18:40 home -> 
/home/
lrwxrwxrwx    1 fernst   fernst         21 2003-08-06 18:22 .xinitrc 
-> /home/fernst/.xinitrc*
[EMAIL PROTECTED]:~/test$ cleanlinks
Removing empty directories ...
[EMAIL PROTECTED]:~/test$ ls -Al
total 0
lrwxrwxrwx    1 fernst   fernst          5 2003-08-06 18:40 home -> 
/home/
lrwxrwxrwx    1 fernst   fernst         21 2003-08-06 18:22 .xinitrc 
-> /home/fernst/.xinitrc*


Cheers,
Flo


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux live 2.4.21-live-preempt-oly #2 Mon Jun 30 18:03:16 CEST 
2003 i686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED]

Versions of packages xutils depends on:
ii  libc6                     2.3.1-16       GNU C Library: Shared 
libraries an
ii  libncurses5               5.3.20030719-1 Shared libraries for 
terminal hand
ii  xfree86-common            4.2.1-6        X Window System (XFree86) 
infrastr
ii  zlib1g                    1:1.1.4-14     compression library - 
runtime

-- no debconf information



Reply via email to