From unknown Sun Jun 15 08:13:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#62385 <62385@debbugs.gnu.org> To: bug#62385 <62385@debbugs.gnu.org> Subject: Status: POSIX behavior of readlink, realpath Reply-To: bug#62385 <62385@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:13:20 +0000 retitle 62385 POSIX behavior of readlink, realpath reassign 62385 coreutils submitter 62385 Eric Blake severity 62385 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 22 10:19:35 2023 Received: (at submit) by debbugs.gnu.org; 22 Mar 2023 14:19:35 +0000 Received: from localhost ([127.0.0.1]:36271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pezJP-0002Gw-5P for submit@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 ) id 1pezJM-0002Gm-Br for submit@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 ) id 1pezIz-0006X3-QE for bug-coreutils@gnu.org; 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 ) id 1pezIy-0005uw-2Y for bug-coreutils@gnu.org; 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 ; 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 ; Wed, 22 Mar 2023 14:19:03 +0000 (UTC) Date: Wed, 22 Mar 2023 09:19:02 -0500 From: Eric Blake To: bug-coreutils@gnu.org Subject: POSIX behavior of readlink, realpath Message-ID: <20230322141902.un6f7bysu2try3q2@redhat.com> 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@redhat.com; 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 , 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 realpath("A/B") would fail with errno set to [ENOENT]. Even though realpath("A") 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