Hi everyone,
I have noticed quite some time ago a strange way in which some basic FreeBSD utilities work, related to symlinks. Example session: bgd@cvs$ mkdir temp bgd@cvs$ ln -s temp b bgd@cvs$ ls -ald temp b lrwxr-xr-x 1 bgd wheel 4 Apr 9 11:27 b -> temp drwxr-xr-x 2 bgd wheel 512 Apr 9 11:27 temp bgd@cvs$ rm -rf b/ bgd@cvs$ ls -ald temp b ls: temp: No such file or directory lrwxr-xr-x 1 bgd wheel 4 Apr 9 11:27 b -> temp bgd@cvs$ As you can see, when I tried to remove the symlink 'b' with a trailing slash 'rm -rf b/', the target directory was removed instead of the actual symlink. Of course, this is weird (tryied it on some other 10 un*xes, and all worked in another way). I have attached a patch for the 'rm' untility, which strips the trailing slash(es) from the path (according to Posix.2). But I think there are many other utilities which need to be patched (e.g. cp, mv). Greetings, bogdan
0a1,2 > > 463,470d464 < /* strip trailing slashes, since POSIX.2 defines basename < as the final portion of a path after the trailing slashes < have been removed. < */ < p = strrchr (*t, '\0'); < while (--p > *t && *p == '/') < *p = '\0'; <