
In message 200801281557.55976.vapier@gentoo.org you wrote:
@rm -f $(obj)environment.c
ln -s $(src)../common/environment.c $(obj)environment.c
ln -s -f $(src)../common/environment.c $(obj)environment.c
Be careful here. Are you 100% sure that all systems in the field will behave exactly as your's is doing?
i really dont understand what you mean. any POSIX compliant system will behave exactly as it's supposed to: if the destination exists already, unlink it just before creating the link.
I finally fund such a situation again.
# cat /proc/version Linux version 2.6.22.14-72.fc6 (brewbuilder@ls20-bc1-14.build.redhat.com) (gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)) #1 SMP Wed Nov 21 14:10:25 EST 2007 # cat /etc/issue Fedora Core release 6 (Zod) Kernel \r on an \m
# id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) # cd /opt # ls -ld eldk eldk-4.2-2008-03-27 eldk-4.2-2008-04-01 lrwxrwxrwx 1 root root 19 Apr 4 04:01 eldk -> eldk-4.2-2008-03-27 drwxr-xr-x 14 root root 4096 Apr 8 23:37 eldk-4.2-2008-03-27 drwxr-xr-x 14 root root 4096 Apr 3 13:38 eldk-4.2-2008-04-01
Now we try:
# ln -sf eldk-4.2-2008-04-01 eldk # echo $? 0
And what do you think we got?
# ls -ld eldk eldk-4.2-2008-03-27 eldk-4.2-2008-04-01 lrwxrwxrwx 1 root root 19 Apr 4 04:01 eldk -> eldk-4.2-2008-03-27 drwxr-xr-x 14 root root 4096 Apr 14 21:27 eldk-4.2-2008-03-27 drwxr-xr-x 14 root root 4096 Apr 3 13:38 eldk-4.2-2008-04-01
This is what I mean when I say that "rm -f foo ; ln -s bar foo" is *NOT* exactly equivalent to "ln -sf bar foo". The former will always work, the latter won't.
Best regards,
Wolfgang Denk