fanf: (Default)
[personal profile] fanf

What happens if you try to create a symlink to a zero-length target, as in ln -s "" foo?

Linux: ENOENT.

Mac OS X 10.4: EINVAL.

FreeBSD: works, and any attempt to resolve the symlink returns ENOENT.

Solaris: works, and the resulting symlink behaves the same as ln -s . foo

Date: 2008-09-15 15:46 (UTC)
From: [identity profile] hoiho.livejournal.com
Cygwin (on XP): ln: creating symbolic link `foo' to `': No such file or directory

NetBSD: As FreeBSD

Date: 2008-09-15 15:55 (UTC)
From: [identity profile] filecoreinuse.livejournal.com
Does POSIX have a view on this?

Date: 2008-09-15 15:56 (UTC)
From: [identity profile] crazyscot.livejournal.com
OSX 10.3.9 - same as 10.4

Date: 2008-09-15 16:31 (UTC)
From: [identity profile] filecoreinuse.livejournal.com
Briefly looking at the symlink syscall in Linux at http://lxr.linux.no/linux+v2.6.26.5/fs/namei.c#L2447 it appears that the 'Right Thing' is done in that the first path is just passed 'as is' to the VFS layer meaning buggy behaviour can be blamed on the FS driver. This all assumes that GNU's libc doesn't 'sanitise' the input.

Date: 2008-09-15 20:10 (UTC)
From: [identity profile] zkzkz.livejournal.com
Huh, fascinating. My intuition led me to expect Solaris's behaviour.

July 2025

S M T W T F S
  1 2345
6789101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2025-07-10 18:03
Powered by Dreamwidth Studios