bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in ln re -f option


From: Darren Besler
Subject: Bug in ln re -f option
Date: Sat, 4 Oct 2003 06:49:40 -0500 (CDT)

Using Redhat Linux 8.0, fileutils rpm: fileutils-4.1.9-11.

I have observed that the ln -f option does not work as prescribed when target
is a directory.

In the following example, a sym link bbb is being changed to point from
directory aaa to directory aaaa.  When using -f, bbb is not removed/recreated,
and no error is reported. Actually, the link is created within the original
target "aaa" as a result of the "ln [OPTION]... TARGET... DIRECTORY"
incorrectly taking precidence as a result bbb is being interpreted as a
directory from following the original sym link of bbb -> aaa.


# mkdir aaa
# ls -l
total 3
drwxr-xr-x    3 root     root         1024 Oct  4 06:42 .
drwxrwxrwt    9 root     root         1024 Oct  4 06:42 ..
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 aaa

# ln -s aaa bbb
# ls -l
total 3
drwxr-xr-x    3 root     root         1024 Oct  4 06:42 .
drwxrwxrwt    9 root     root         1024 Oct  4 06:42 ..
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 aaa
lrwxrwxrwx    1 root     root            3 Oct  4 06:42 bbb -> aaa

# mkdir aaaa
# ls -l
total 4
drwxr-xr-x    4 root     root         1024 Oct  4 06:42 .
drwxrwxrwt    9 root     root         1024 Oct  4 06:42 ..
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 aaa
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 aaaa
lrwxrwxrwx    1 root     root            3 Oct  4 06:42 bbb -> aaa

# ln -sf aaaa bbb
# echo $?
0

# ls -l
total 4
drwxr-xr-x    4 root     root         1024 Oct  4 06:42 .
drwxrwxrwt    9 root     root         1024 Oct  4 06:42 ..
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 aaa
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 aaaa
lrwxrwxrwx    1 root     root            3 Oct  4 06:42 bbb -> aaa

# ls -l aaa
total 2
drwxr-xr-x    2 root     root         1024 Oct  4 06:42 .
drwxr-xr-x    3 root     root         1024 Oct  4 06:49 ..
lrwxrwxrwx    1 root     root            4 Oct  4 06:42 aaaa -> aaaa

# ln -s aaaa bbb
ln: `bbb/aaaa': File exists


-- 
Darren Besler
Beehive Enterprises




reply via email to

[Prev in Thread] Current Thread [Next in Thread]