Collin Funk <collin.funk1@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at submit) by debbugs.gnu.org; 25 Apr 2024 05:33:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 25 01:33:26 2024
Received: from localhost ([127.0.0.1]:60364 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rzrjW-00067F-RD
for submit <at> debbugs.gnu.org; Thu, 25 Apr 2024 01:33:25 -0400
Received: from lists.gnu.org ([2001:470:142::17]:39270)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <d+gnubugs@HIDDEN>)
id 1rznNT-0000NT-J1
for submit <at> debbugs.gnu.org; Wed, 24 Apr 2024 20:54:23 -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 <d+gnubugs@HIDDEN>)
id 1rznN2-0005CJ-RY
for bug-coreutils@HIDDEN; Wed, 24 Apr 2024 20:53:53 -0400
Received: from arx.adaptive-enterprises.com ([58.96.48.22]
helo=adaptive-enterprises.com)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
(Exim 4.90_1) (envelope-from <d+gnubugs@HIDDEN>)
id 1rznN0-0002nm-Eg
for bug-coreutils@HIDDEN; Wed, 24 Apr 2024 20:53:52 -0400
Received: by adaptive-enterprises.com (OpenSMTPD) with ESMTP id c525d631
for <bug-coreutils@HIDDEN>; Thu, 25 Apr 2024 10:53:43 +1000 (AEST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=adaptive-enterprises.com;
h=date:from:to:subject:message-id:mime-version:content-type; s=
arx; bh=QskrwGB8yXW4d//DD63he9lyS04=; b=xf5idEwTpSQkaWXuCOG46h44
WzEv6H1tWzAMKEHzlXxnojz7gN8AyrTskz8XQAx3O3iUz0vWlXnGgnDCi2mo54bl
jhQq0LhsRzV8L6EBGyulH/SdLhrHjQFevPzftpx+Jf5JSVHLJIfKB/gUICIaP0kn
xQaf86pF0A3zDDZH3lU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=adaptive-enterprises.com; h=
date:from:to:subject:message-id:mime-version:content-type; q=
dns; s=arx; b=NuKBWpCrThEuULWKtvYvwKJGtCjryREdJYGZZPYoDKyKL5xaQB
7QVobH4UZAGkj7lPGDkqDDesEvX1PdBWbAbB92q5Yfr6W68pauTnEbllHM4xCAPO
6JuSP5sIEoi7Bcotm38k44f+5SGBL8pb4BUfZEtGhgVUh7amuf4ZYwTlE=
Received: from cwm (<unknown> [10.1.1.12])
by arx.adaptive-enterprises.com (OpenSMTPD) with ESMTPSA id 6ea79e05
(TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) auth=yes user=d
for <bug-coreutils@HIDDEN>; Thu, 25 Apr 2024 10:53:43 +1000 (AEST)
Date: Thu, 25 Apr 2024 10:53:43 +1000 (AEST)
From: David Leonard <d+gnubugs@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: ln -sfr stats the wrong file
Message-ID: <5pnop7o4-3p58-n169-ro73-1897n847o58r@HIDDEN>
User-Agent: Alpine 2.26 (DEB 649 2022-06-02)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII; format=flowed
Received-SPF: pass client-ip=58.96.48.22;
envelope-from=d+gnubugs@HIDDEN;
helo=adaptive-enterprises.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, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 25 Apr 2024 01:33:05 -0400
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: -0.1 (/)
(resend)
When analyzing file accesses with strace, I noticed that ln stats an
unrelated file. This only happens with the opions -sfr and when the dest
symlink already exists.
Here's a reproduction script:
# setup
mkdir -p a b
> b/x
ln -fs anything a/x
# ln -sfr b/x a/x
strace -o trace.out --decode-fds=path -e %file \
src/ln -sfr b/x a/x
test $(readlink a/x) = ../b/x
grep stat trace.out
The invalid stat that happens is:
newfstatat(AT_FDCWD</tmp/lnbug>, "../b/x", 0x7ffdb94a0270, 0) = -1 ENOENT
(No such file or directory)
The cause seems to be in src/ln.c's do_link() where the `source` "b/x" is
converted to "../b/x" by
if (relative)
source = rel_source = convert_abs_rel (source, dest);
and then the test to see if deleting the destination file would delete
the source works by checking hard links on the source.
if (source_status != 0)
source_status = stat (source, &source_stats);
Except that -r made source relative to the dest directory.
David Leonard <d+gnubugs@HIDDEN>:bug-coreutils@HIDDEN.
Full text available.bug-coreutils@HIDDEN:bug#70561; Package coreutils.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.