Subj : Re: has this bug been fixed? To : comp.sys.hp.hpux,comp.os.linux From : baby_p_nut2 Date : Thu Aug 19 2004 07:30 am Frank Slootweg wrote in message news:<41236e24$0$7129$abc4f4c3@news.wanadoo.nl>... > Baby Peanut wrote: > > jignaasu@yahoo.com (jignaasu) wrote in message news:<1238ce7b.0408172312.7d5d5133@posting.google.com>... > > > baby_p_nut2@yahoo.com (Baby Peanut) wrote in message news:<96d83290.0408170642.60b8e802@posting.google.com>... > > > > man page for ln says: > > > > > > > > ln [-f] [-i] [-s] file1 [file2 ...] dest_directory > > > > > > > > but I see: > > > > > > > > # ln -s /usr/local/bin/bash /bin > > > > ln: /bin exists > > > > > > > > OS version: > > > > > > > > # uname -a > > > > HP-UX fuckedup B.11.00 A 9000/859 1482525301 two-user license > > > > > > bash-2.01$ mkdir /tmp/bin > > > bash-2.01$ ln -s /usr/bin/bash /tmp/bin > > > bash-2.01$ ls -l /tmp/bin/bash > > > lrwxrwxr-x 1 rangarc lang 13 Aug 18 12:36 > > > /tmp/bin/bash -> /usr/bin/bash > > > bash-2.01$ what `which ln` > > > /usr/bin/ln: > > > $Revision: 78.1.1.1 $ > > > PATCH_11_00: ln.o 99/09/02 > > > bash-2.01$ /usr/sbin/swlist -l file | grep /usr/bin/ln > > > OS-Core.UX-CORE: /usr/bin/ln > > > PHCO_20030.UX-CORE: /usr/bin/ln > > > bash-2.01$ uname -a > > > HP-UX cherry B.11.00 A 9000/800 1158444626 two-user license > > > > Try this: > > > > mkdir /tmp/foo > > ln -s /tmp/foo /tmp/bar > > ln -s /bin/ls /tmp/bar > > Why would we? That of course fails, because you can not overwrite an > existing symlink (which is what you are asking with the second ln(1) > command (i.e. /tmp/bar is *not* a directory, it is a symlink *to* a > directory)). So there are lines and lines of kernel code to support a feature that allows you to creat a filesystem node (symlink) that refers to another directory path by name and then they write a binary that checks to see if there is a symlink lstat64("/tmp/bar", 0x40001920) .......................... = 0 lstat64("/tmp/bar", 0x40001920) .......................... = 0 just so it can avoid using the kernel feature. > OTOH, what jignaasu did was *correct*, i.e. he created a symlink in a > *directory*. > > Your original example was wrong because you apparently *thought* that > /bin is a directory, but in reality it is a symlink (to /usr/bin). > > Please comment on my response to your original posting, instead of > proposing yet other 'examples' without saying what (you *think*) they > are *supposed* to do. .