POSIX will be standardizing realpath in Issue 8: https://www.austingroupbugs.net/view.php?id=1457 As such, the standard requirements that all utilities not explicitly excluded (basically, echo is one of the few explicit exceptions) MUST accept -- as end-of-options, even when the standard does not require any standardized options. Once Issue 8 is out, realpath /tmp realpath -- /tmp must have identical behavior. Busybox 1.35 (I tested the pre-built version available on Fedora 37) fails this: $ busybox realpath -- /tmp realpath: --: No such file or directory /tmp
Similarly, POSIX still requires 'readlink -- /foo' and 'readlink /foo' to behave identically. This is implemented correctly when FEATURE_READLINK_FOLLOW is enabled (as a side effect of accepting the POSIX-mandated -n), but fails when the feature is disabled (that branch of the code should probably use single_argv(), similarly to how coreutils/dirname.c was patched).
Created attachment 9561 [details] readlink: Support --, -n always Ugh - unlike many open-source projects, your mailing list does not allow moderated posting from non-subscribers. So while I wait for my subscription request to be processed, I'm attaching a partial proposed patch for readlink. Originally, I thought to do a one-liner to use single_argv(); then realized that it was easier to blindly support -n in all configurations since POSIX will require -n support. I'm still trying to learn whether POSIX or GNU Coreutils will prevail on whether readlink should be silent or verbose by default.