Bug 742319
Summary: | test -f returns true for symlinks pointing to regular files | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jerry Amundson <jamundso> |
Component: | coreutils | Assignee: | Ondrej Vasik <ovasik> |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 16 | CC: | kdudka, maxamillion, ovasik, twaugh |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2012-07-16 11:41:23 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jerry Amundson
2011-09-29 16:54:21 UTC
This is a regression from coreutils-5.x. Well, I think this is not a bug but expected behaviour - if the symlink points to regular file, it is dereferenced and recognized as regular file by test -f (or shell builtin -f ) ... However, if the symlink is broken, it is not recognized as regular file. Check: [Reset@dhcp-24-196 ~]$ ln -s broken brokenlink [Reset@dhcp-24-196 ~]$ test -f brokenlink && echo is file In Debian, similar bugzilla was wontfixed see e.g. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=231267 ... However, there is one argument for improving manpage/info documentation - find behaves differently in that case... [Reset@dhcp-24-196 ~]$ find /lib -name libz.so.1 -type f [Reset@dhcp-24-196 ~]$ find /lib -name libz.so.1 /lib/libz.so.1 [Reset@dhcp-24-196 ~]$ test -f /lib/libz.so.1 && echo is file is file [Reset@dhcp-24-196 ~]$ /usr/bin/test -f /lib/libz.so.1 && echo is file is file Leaving it opened for a while (upstream is on bugzilla watch) ... POSIX ( http://pubs.opengroup.org/onlinepubs/000095399/utilities/test.html ) states : -f pathname True if pathname resolves to a file that exists and is a regular file. False if pathname cannot be resolved, or if pathname resolves to a file that exists but is not a regular file. So it is all about definition of "pathname resolving" ... (In reply to comment #1) > This is a regression from coreutils-5.x. For the record, that is untrue. My mistake, sorry. Cleanup ... closing NOTABUG based on comment #3. |