[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #56855] find -printf %h gives an empty string for the root director
[bug #56855] find -printf %h gives an empty string for the root directory '/'
Thu, 27 Apr 2023 16:19:03 -0400 (EDT)
Follow-up Comment #3, bug #56855 (project findutils):
POSIX is clear in
the dirname(3) function returns a non-empty string for input of "/". However,
POSIX is also clear that the string composed by
'dirname(str)+"/"+basename(str)' need NOT refer to the same file as 'str';
case in point: when str is "//", POSIX says you could end up with any of
"///", "////", or "/////" depending on choices made in basename and dirname,
but all of those results are equivalent to to "/" while POSIX is explicit that
"//" may be distinct from "/".
Similar arguments can be made about the behavior of the basename(1) utility.
However, since -printf is not defined by POSIX, there is no requirement that
%h be defined by the POSIX functionality of basename(3) (the function), nor of
basename(1) (the utility). However, if we intend to return the empty string,
it IS a bug if our documentation is not explicit that we intentionally differ
in behavior from the POSIX functions, and give examples why we think that is
the right thing to do.
Reply to this item at:
Message sent via Savannah