bug-coreutils@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: 62385@debbugs.gnu.org
Subject: bug#62385: POSIX behavior of readlink, realpath
Date: Wed, 22 Mar 2023 09:19:02 -0500	[thread overview]
Message-ID: <20230322141902.un6f7bysu2try3q2@redhat.com> (raw)

POSIX will be standardizing readlink(1) and realpath(1):

https://www.austingroupbugs.net/view.php?id=1457

Among other things, I can see the following changes that coreutils
will need to make to become compliant, or else we need to push back on
the POSIX folks if we have strong reasons to complain that their
specification will break things:

POSIX wants 'readlink non-symlink' to output a diagnostic; that is, it
looks like POSIX wants us to behave like '-v' is enabled by default
(our current behavior of -q by default will be non-compliant).

POSIX wants us to support 'realpath -E file'.  I'm not quite sure if
it is matches our existing behavior when -e is omitted (in which case,
all the more we have to do is have -E coming later than -e disable the
earlier -e).  In particular, it gives a convincing example:

"The behavior with the -E option when file does not resolve (with
symbolic links followed) to an existing file is not the same as simply
calling realpath() with the path prefix of the file operand and
writing the resulting pathname, a <slash>, and the last component of
file to standard output. For example, if /tmp/nofile does not exist,
and file is A/B where A is an existing directory and B is a symbolic
link to /tmp/nofile, realpath with -E will output /tmp/nofile, but if
B is a symbolic link to /tmp/nofile/foo, realpath with -E will treat
this as an error. In both cases <tt>realpath("A/B")</tt> would fail
with errno set to [ENOENT]. Even though <tt>realpath("A")</tt> would
succeed, in neither case is anything ending /B the result."

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org





                 reply	other threads:[~2023-03-22 14:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322141902.un6f7bysu2try3q2@redhat.com \
    --to=eblake@redhat.com \
    --cc=62385@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).