Follow-up Comment #3, bug #56855 (project findutils): POSIX is clear in https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirname.html that 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: <https://savannah.gnu.org/bugs/?56855> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/