User: Password:
|
|
Subscribe / Log in / New account

Empty symlinks and full POSIX compliance

Empty symlinks and full POSIX compliance

Posted Jul 20, 2013 1:49 UTC (Sat) by kirv (guest, #89016)
In reply to: Empty symlinks and full POSIX compliance by yeti-dn
Parent article: Empty symlinks and full POSIX compliance

Bingo. As the originator of this 'bug report', the reason I posted it was that the error message was confusing. Consider:

$ ln -s /no-such-file foo
$ ln -s "" bar
ln: creating symbolic link `bar' -> `': No such file or directory

Since the non-existence of the target file is not a problem, what 'file or directory' is being referred to?

I have no particular use in mind for empty symlink targets, and just ran into this case while working up some test scripts. I do have use for arbitrary strings in the system target, and would think it preferable to allow the empty string there just for consistency, but at least the error message should be meaningful.

The whole POSIX question is beyond me, but I don't think any special handling should be necessary for empty symlinks. Just let them resolve as they are, e.g., so maybe cat bar or ls bar would look like:

$ cat ""
cat: : No such file or directory
$ ls ""
ls: cannot access : No such file or directory


(Log in to post comments)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds