GNU logs - #70558, boring messages


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#70558: ln -sfr stats the wrong file
Resent-From: David Leonard <d+gnubugs@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Thu, 25 Apr 2024 05:34:08 +0000
Resent-Message-ID: <handler.70558.B.171402319023357 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 70558
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: 70558 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-coreutils@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.171402319023357
          (code B ref -1); Thu, 25 Apr 2024 05:34:08 +0000
Received: (at submit) by debbugs.gnu.org; 25 Apr 2024 05:33:10 +0000
Received: from localhost ([127.0.0.1]:60358 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rzrjH-00064J-K0
	for submit <at> debbugs.gnu.org; Thu, 25 Apr 2024 01:33:09 -0400
Received: from lists.gnu.org ([2001:470:142::17]:46474)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <d+gnubugs@HIDDEN>)
 id 1rzgJ0-0004vo-Uw
 for submit <at> debbugs.gnu.org; Wed, 24 Apr 2024 13:21:18 -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 1rzgIe-000379-4j
 for bug-coreutils@HIDDEN; Wed, 24 Apr 2024 13:20:52 -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 1rzgIb-0007cI-B3
 for bug-coreutils@HIDDEN; Wed, 24 Apr 2024 13:20:51 -0400
Received: by adaptive-enterprises.com (OpenSMTPD) with ESMTP id f283ee76
 for <bug-coreutils@HIDDEN>; Thu, 25 Apr 2024 03:20:30 +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=4ox0I10gpzFHiPLZhyjOXfUtI04=; b=HUTmwiZmm2/HFxZqw0HMx/mE
 YvD4MkooXCfdD2fH+7aUkuADW3sUiIiCd7MIDpEYBi+43bqaAlWdXPFE88k//tuR
 zdE+lj4sOwAhlR5yRyhEl6qA5vzHD8SkCiFv7Kphw41Ma1pt9XI7Z02pQI+PPjjU
 2Gi2jcf8J0ymIL3+49U=
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=jVLQDS8Fu+6oq/7CoUaCZOBrNO6GOoT8Et1quY4sywnQaU+2U+
 1c7rzUJfizxT4UU7Rn2cEtgEZeD54ajKW9GCDLUTn1t7LvHjlkzvtIfs1o4mvwt9
 6c3Xl3M/SHsgWKKecaGnmiGaXhwzyI6zQxW1HfcJdSPBcfpJJvJ2cYV5U=
Received: from cwm (<unknown> [10.1.1.12])
 by arx.adaptive-enterprises.com (OpenSMTPD) with ESMTPSA id e613281d
 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) auth=yes user=d
 for <bug-coreutils@HIDDEN>; Thu, 25 Apr 2024 03:20:29 +1000 (AEST)
Date: Thu, 25 Apr 2024 03:20:27 +1000 (AEST)
From: David Leonard <d+gnubugs@HIDDEN>
Message-ID: <8071o212-8682-97o5-nnp8-65op218p0s89@HIDDEN>
User-Agent: Alpine 2.26 (DEB 649 2022-06-02)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
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-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 (/)


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.




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: David Leonard <d+gnubugs@HIDDEN>
Subject: bug#70558: Acknowledgement (ln -sfr stats the wrong file)
Message-ID: <handler.70558.B.171402319023357.ack <at> debbugs.gnu.org>
References: <8071o212-8682-97o5-nnp8-65op218p0s89@HIDDEN>
X-Gnu-PR-Message: ack 70558
X-Gnu-PR-Package: coreutils
Reply-To: 70558 <at> debbugs.gnu.org
Date: Thu, 25 Apr 2024 05:34:11 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-coreutils@HIDDEN

If you wish to submit further information on this problem, please
send it to 70558 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
70558: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D70558
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


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


Received: (at control) by debbugs.gnu.org; 17 Oct 2025 19:11:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 17 15:11:10 2025
Received: from localhost ([127.0.0.1]:55930 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v9pr4-0005Fv-E6
	for submit <at> debbugs.gnu.org; Fri, 17 Oct 2025 15:11:10 -0400
Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:58746)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
 id 1v9pqx-0005DZ-08
 for control <at> debbugs.gnu.org; Fri, 17 Oct 2025 15:11:07 -0400
Received: by mail-pg1-x533.google.com with SMTP id
 41be03b00d2f7-b62e7221351so1864591a12.1
 for <control <at> debbugs.gnu.org>; Fri, 17 Oct 2025 12:11:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1760728255; x=1761333055; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
 :subject:date:message-id:reply-to;
 bh=jpVbGy+q7mlco7VWhDRF5QgDKkAdFkh/2Rj2MsjpV6k=;
 b=BF0z0tATEphQDAEGE9/GJ4NEwcHCG7Ii2vz8tbbaQIgzfRqZDQ4lm1pvsPgwGoXqpx
 qwK5srhK7OrbVVXJ/+JF8Za947w7b66l8VP6WVhuFbQXBLieM0Mwo1Bwc3BiubytlGJD
 55XAxlVwGwJnxcbogPqW5VClFXzo1nSTyBZ42NjRU4voyJAhL2c8mpJdotNqvKtMiCzl
 idWLaKt51RLczvCIkdBAUF+ou66lrUDtyDbSQIrEDMZ0PHhKj4q+z8EEYNbgGM1zqYtt
 cEWy1wiA9GBDhSHLLdUEmNB9GMywkK1CPzRIHI4G38fMDxiUFuaQa8vzj4BJe20P/eo/
 sahg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1760728255; x=1761333055;
 h=mime-version:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=jpVbGy+q7mlco7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by 2002:a17:903:32cf:b0:25c:d4b6:f117 with SMTP id
 d9443c01a7336-290ca121ea6mr56556445ad.35.1760728254842; 
 Fri, 17 Oct 2025 12:10:54 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::43bc])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-292471d5938sm2553415ad.58.2025.10.17.12.10.54
 for <control <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 17 Oct 2025 12:10:54 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: control <at> debbugs.gnu.org
Subject: 70561 is a duplicate of 70558
Date: Fri, 17 Oct 2025 12:10:53 -0700
Message-ID: <87sefhfio2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: control
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.7 (/)

merge 70561 70558
thanks

Collin





Last modified: Fri, 17 Oct 2025 19:15:01 UTC

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