Add a New Comment (Rich Markup)
> find -L . -type l prints a list of symbolic links reachable from the current directory that do not resolve to accessible files.
Hmm. I never considered this before, but does the use of "accessible" here imply that EACCES should also count?
Reading the specification again: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
-L [...]. If the referenced file does not exist, the file information and type shall be for the link itself.
This means that an error should not be thrown for broken links (well, probably only for primitives that require the symlink to be resolved like '-printf %Y'). And later on:
Since the -L option resolves all symbolic links and the -type l primary is true for symbolic links that still exist after symbolic links have been resolved, the command: find -L . -type l prints a list of symbolic links reachable from the current directory that do not resolve to accessible files.
The spec does not differentiate between ENOENT and ENOTDIR here. So the current behavior seems to be debatable, at least. I have to think about this ...
$ touch file $ ln -s nowhere broken $ ln -s file/nowhere notdir $ find -L . ./file ./broken find: ‘./notdir’: Not a directory ./notdir So we get an error message if a link is broken in one way but not another. Worse, $ find -L broken broken $ find -L notdir find: ‘notdir’: Not a directory So at the top level, notdir is not even printed. Same with -H.
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.12