GNU bug report logs - #62385
POSIX behavior of readlink, realpath

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: Eric Blake <eblake@HIDDEN>; dated Wed, 22 Mar 2023 14:20:01 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Mar 2023 14:19:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 10:19:35 2023
Received: from localhost ([127.0.0.1]:36271 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pezJP-0002Gw-5P
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2023 10:19:35 -0400
Received: from lists.gnu.org ([209.51.188.17]:35960)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1pezJM-0002Gm-Br
 for submit <at> debbugs.gnu.org; Wed, 22 Mar 2023 10:19:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eblake@HIDDEN>) id 1pezIz-0006X3-QE
 for bug-coreutils@HIDDEN; Wed, 22 Mar 2023 10:19:11 -0400
Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eblake@HIDDEN>) id 1pezIy-0005uw-2Y
 for bug-coreutils@HIDDEN; Wed, 22 Mar 2023 10:19:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1679494747;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=RfRZnUc1OeMpFbnww5Ffc/FAVwbDnG3h5bmXwIM/cZg=;
 b=bmPtEveTZhPCSyXY/kFjVVPve7dLmu0ap+di6K3TWa6ntq4/YnN54xkFQP3/GKS90ZfPQt
 ldK7/kjfbUFj54kAwTQgdgnfpi8iAtzFppWbJk5j1KOKo0O1CEV47nQkNhA/6M1ro/xnwK
 tTmmj0Ut3vUI0cEqoiU85mgGM9DCcKY=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-613-xT8X2WdEPVW5b6nEfNj_-g-1; Wed, 22 Mar 2023 10:19:04 -0400
X-MC-Unique: xT8X2WdEPVW5b6nEfNj_-g-1
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com
 [10.11.54.3])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3539485531E
 for <bug-coreutils@HIDDEN>; Wed, 22 Mar 2023 14:19:04 +0000 (UTC)
Received: from redhat.com (unknown [10.2.16.148])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id F1A131121315
 for <bug-coreutils@HIDDEN>; Wed, 22 Mar 2023 14:19:03 +0000 (UTC)
Date: Wed, 22 Mar 2023 09:19:02 -0500
From: Eric Blake <eblake@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: POSIX behavior of readlink, realpath
Message-ID: <20230322141902.un6f7bysu2try3q2@HIDDEN>
MIME-Version: 1.0
User-Agent: NeoMutt/20220429
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Received-SPF: pass client-ip=170.10.129.124; envelope-from=eblake@HIDDEN;
 helo=us-smtp-delivery-124.mimecast.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,
 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

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





Acknowledgement sent to Eric Blake <eblake@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#62385; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 22 Mar 2023 14:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.