GNU bug report logs - #81377
mv -Tn suceeds if target directory exists, no error printed

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: Florian Weimer <fweimer@HIDDEN>; dated Wed, 8 Jul 2026 12:34:01 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.

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


Received: (at 81377) by debbugs.gnu.org; 8 Jul 2026 12:51:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 08 08:51:28 2026
Received: from localhost ([127.0.0.1]:39086 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1whRkO-000517-9h
	for submit <at> debbugs.gnu.org; Wed, 08 Jul 2026 08:51:28 -0400
Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44479)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fweimer@HIDDEN>) id 1whRkM-00050z-F6
 for 81377 <at> debbugs.gnu.org; Wed, 08 Jul 2026 08:51:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1783515086;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=deE/fC3pZC5gObNExRvYcGOgG4ZiW9dzKuX/DGG8Ir8=;
 b=RXI8ujok33dnccmuCcZe/waca6uZzLtg+XEu0vmciVwt+hifmSBzZLT6arV4GHE8w61KZu
 41EZkWxJy+P7gxbO0MpaXVsaQsJ1Eap+3+6ug/qieU1brZUmJzbtJx1fmxgmg+ARUJt5Ez
 ROol/1x63T91AgNxlRzMPmeyH9DKbCU=
Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com
 (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
 cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-HB7OFWwqNiuO-pqrR6AWlQ-1; Wed,
 08 Jul 2026 08:51:24 -0400
X-MC-Unique: HB7OFWwqNiuO-pqrR6AWlQ-1
X-Mimecast-MFC-AGG-ID: HB7OFWwqNiuO-pqrR6AWlQ_1783515083
Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com
 (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 521E11955F1C; Wed,  8 Jul 2026 12:51:23 +0000 (UTC)
Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.44.48.66])
 by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 4A147180066F; Wed,  8 Jul 2026 12:51:21 +0000 (UTC)
From: Florian Weimer <fweimer@HIDDEN>
To: Florian Weimer via GNU coreutils Bug Reports <bug-coreutils@HIDDEN>
Subject: Re: bug#81377: mv -Tn suceeds if target directory exists, no error
 printed
In-Reply-To: <lhu7bn564q8.fsf@HIDDEN> (Florian Weimer via's
 message of "Wed, 08 Jul 2026 14:33:19 +0200")
References: <lhu7bn564q8.fsf@HIDDEN>
Date: Wed, 08 Jul 2026 14:51:04 +0200
Message-ID: <lhuzf014pc7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111
X-Mimecast-Spam-Score: 0
X-Mimecast-MFC-PROC-ID: JAoZn736NuU_aUmncgL-STHwUOrKf7hkGaJjgZB7N-0_1783515083
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  * Florian Weimer via: > Based on the documentation, I would
 have expected an error in this case. > > mkdir a a/1 b b/2 > mv -Tn a b >
 > Exit status is zero. The only relevant system call in the strace output
 > is this one: [...] 
 Content analysis details:   (3.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [170.10.129.124 listed in list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [54.186.198.63 listed in zen.spamhaus.org]
 0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [170.10.129.124 listed in wl.mailspike.net]
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 81377
Cc: 81377 <at> debbugs.gnu.org
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.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * Florian Weimer via: > Based on the documentation, I would
    have expected an error in this case. > > mkdir a a/1 b b/2 > mv -Tn a b >
    > Exit status is zero. The only relevant system call in the strace output
    > is this one: [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [170.10.129.124 listed in wl.mailspike.net]
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [54.186.198.63 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [170.10.129.124 listed in list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

* Florian Weimer via:

> Based on the documentation, I would have expected an error in this case.
>
> mkdir a a/1 b b/2
> mv -Tn a b
>
> Exit status is zero.  The only relevant system call in the strace output
> is this one:
>
> renameat2(AT_FDCWD, "a", AT_FDCWD, "b", RENAME_NOREPLACE) =3D -1 EEXIST (=
File exists)
>
> Seen with: coreutils-9.7-9.fc43.x86_64

I see that there is a hint in the -n description that the exit status
may not be what users expects.  But it means that this claim in the
manual is slightly misleading:

| However, if =E2=80=98mv -T /tmp/source /tmp/dest=E2=80=99 succeeds, there=
 is no
| question that =E2=80=98/tmp/source=E2=80=99 was renamed to =E2=80=98/tmp/=
dest=E2=80=99.

Florian





Information forwarded to bug-coreutils@HIDDEN:
bug#81377; Package coreutils. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 8 Jul 2026 12:51:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 08 08:51:39 2026
Received: from localhost ([127.0.0.1]:39090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1whRkY-00051u-Jl
	for submit <at> debbugs.gnu.org; Wed, 08 Jul 2026 08:51:38 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:47288)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <fweimer@HIDDEN>)
 id 1whRkV-00051K-J1
 for submit <at> debbugs.gnu.org; Wed, 08 Jul 2026 08:51:36 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <fweimer@HIDDEN>)
 id 1whRkP-0003bn-Ky
 for bug-coreutils@HIDDEN; Wed, 08 Jul 2026 08:51:29 -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 <fweimer@HIDDEN>)
 id 1whRkO-00076I-Ck
 for bug-coreutils@HIDDEN; Wed, 08 Jul 2026 08:51:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1783515087;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=deE/fC3pZC5gObNExRvYcGOgG4ZiW9dzKuX/DGG8Ir8=;
 b=E4wTHYAFNtp478HzwGohYYncSDHwAt3JLR1UMTTUTZu+9WIXf54E2fGwN09xvSe0vY2w9o
 gx/dUWpiAL9fIZM+1FQpIQYz3Y+CpCY9yEuyY0+xwIQdQI0NXTncSAgjC9FqJYY2bOXzZo
 BA/k+FTBBqZ0PhycfXKbJOP3Q8RnW1I=
Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com
 (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
 cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-HB7OFWwqNiuO-pqrR6AWlQ-1; Wed,
 08 Jul 2026 08:51:24 -0400
X-MC-Unique: HB7OFWwqNiuO-pqrR6AWlQ-1
X-Mimecast-MFC-AGG-ID: HB7OFWwqNiuO-pqrR6AWlQ_1783515083
Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com
 (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 521E11955F1C; Wed,  8 Jul 2026 12:51:23 +0000 (UTC)
Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.44.48.66])
 by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 4A147180066F; Wed,  8 Jul 2026 12:51:21 +0000 (UTC)
From: Florian Weimer <fweimer@HIDDEN>
To: Florian Weimer via GNU coreutils Bug Reports <bug-coreutils@HIDDEN>
Subject: Re: bug#81377: mv -Tn suceeds if target directory exists, no error
 printed
In-Reply-To: <lhu7bn564q8.fsf@HIDDEN> (Florian Weimer via's
 message of "Wed, 08 Jul 2026 14:33:19 +0200")
References: <lhu7bn564q8.fsf@HIDDEN>
Date: Wed, 08 Jul 2026 14:51:04 +0200
Message-ID: <lhuzf014pc7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111
X-Mimecast-Spam-Score: 0
X-Mimecast-MFC-PROC-ID: ulbe5f3ZYAcEFyjOTzSpEdeGfdafurYwIPeijryEYzA_1783515083
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=170.10.129.124; envelope-from=fweimer@HIDDEN;
 helo=us-smtp-delivery-124.mimecast.com
X-Spam_score_int: 8
X-Spam_score: 0.8
X-Spam_bar: /
X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445,
 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 4.5 (++++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  * Florian Weimer via: > Based on the documentation, I would
 have expected an error in this case. > > mkdir a a/1 b b/2 > mv -Tn a b >
 > Exit status is zero. The only relevant system call in the strace output
 > is this one: [...] 
 Content analysis details:   (4.5 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [54.186.198.63 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.9 SPF_FAIL               SPF: sender does not match SPF record (fail)
 [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;
 id=fweimer%40redhat.com; ip=2001%3A470%3A142%3A%3A17; r=debbugs.gnu.org]
X-Debbugs-Envelope-To: submit
Cc: 81377 <at> debbugs.gnu.org
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: 3.5 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * Florian Weimer via: > Based on the documentation, I would
    have expected an error in this case. > > mkdir a a/1 b b/2 > mv -Tn a b >
    > Exit status is zero. The only relevant system call in the strace output
    > is this one: [...] 
 
 Content analysis details:   (3.5 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [54.186.198.63 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:470:142:0:0:0:0:17 listed in]
                             [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  0.9 SPF_FAIL               SPF: sender does not match SPF record (fail)
 [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;id=fweimer%40redhat.com;ip=2001%3A470%3A142%3A%3A17;r=debbugs.gnu.org]
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

* Florian Weimer via:

> Based on the documentation, I would have expected an error in this case.
>
> mkdir a a/1 b b/2
> mv -Tn a b
>
> Exit status is zero.  The only relevant system call in the strace output
> is this one:
>
> renameat2(AT_FDCWD, "a", AT_FDCWD, "b", RENAME_NOREPLACE) =3D -1 EEXIST (=
File exists)
>
> Seen with: coreutils-9.7-9.fc43.x86_64

I see that there is a hint in the -n description that the exit status
may not be what users expects.  But it means that this claim in the
manual is slightly misleading:

| However, if =E2=80=98mv -T /tmp/source /tmp/dest=E2=80=99 succeeds, there=
 is no
| question that =E2=80=98/tmp/source=E2=80=99 was renamed to =E2=80=98/tmp/=
dest=E2=80=99.

Florian





Information forwarded to bug-coreutils@HIDDEN:
bug#81377; Package coreutils. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 8 Jul 2026 12:33:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 08 08:33:54 2026
Received: from localhost ([127.0.0.1]:38898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1whRTN-0003Si-SD
	for submit <at> debbugs.gnu.org; Wed, 08 Jul 2026 08:33:54 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:47958)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <fweimer@HIDDEN>)
 id 1whRTL-0003S4-0a
 for submit <at> debbugs.gnu.org; Wed, 08 Jul 2026 08:33:52 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <fweimer@HIDDEN>)
 id 1whRTE-0000WI-BT
 for bug-coreutils@HIDDEN; Wed, 08 Jul 2026 08:33:45 -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 <fweimer@HIDDEN>)
 id 1whRTC-0001D8-HC
 for bug-coreutils@HIDDEN; Wed, 08 Jul 2026 08:33:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1783514020;
 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=stt1p9MM2NF/55u1ozhE5fiPj3xRZgJ4kG/Z8VgFVc0=;
 b=Ntm6iGfrYsY0O4h0FwMQ5DVvj13QMp+JAYpTQCYscWJPKsy3XAwtR2U4n34Enc0hvXzvTV
 C6cfAyjFooEX0TzJJz6s0oajY0JEgklhLngJ6su8D8u+C8sdAnLPND048iJh0cqEtn1iUM
 2lZuEAtKi9DMSpiMyCBKOpaE/wHcucc=
Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com
 (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
 cipher=TLS_AES_256_GCM_SHA384) id us-mta-349-3R0Hq-WGO16yRxP0PQKi2A-1; Wed,
 08 Jul 2026 08:33:39 -0400
X-MC-Unique: 3R0Hq-WGO16yRxP0PQKi2A-1
X-Mimecast-MFC-AGG-ID: 3R0Hq-WGO16yRxP0PQKi2A_1783514018
Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com
 (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 02A1519540C6
 for <bug-coreutils@HIDDEN>; Wed,  8 Jul 2026 12:33:38 +0000 (UTC)
Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.44.48.66])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 3B4B31955D86
 for <bug-coreutils@HIDDEN>; Wed,  8 Jul 2026 12:33:36 +0000 (UTC)
From: Florian Weimer <fweimer@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: mv -Tn suceeds if target directory exists, no error printed
Date: Wed, 08 Jul 2026 14:33:19 +0200
Message-ID: <lhu7bn564q8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17
X-Mimecast-Spam-Score: 0
X-Mimecast-MFC-PROC-ID: rFDn8Zp8dKnrg0Sz-WVytAvXWLGpYGov-ia8CqycwOw_1783514018
X-Mimecast-Originator: redhat.com
Content-Type: text/plain
Received-SPF: pass client-ip=170.10.129.124; envelope-from=fweimer@HIDDEN;
 helo=us-smtp-delivery-124.mimecast.com
X-Spam_score_int: 8
X-Spam_score: 0.8
X-Spam_bar: /
X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445,
 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 4.5 (++++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Based on the documentation, I would have expected an error
 in this case. mkdir a a/1 b b/2 mv -Tn a b Exit status is zero. The only
 relevant system call in the strace output is this one: 
 Content analysis details:   (4.5 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [54.186.198.63 listed in zen.spamhaus.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.9 SPF_FAIL               SPF: sender does not match SPF record (fail)
 [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;
 id=fweimer%40redhat.com; ip=2001%3A470%3A142%3A%3A17; r=debbugs.gnu.org]
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: 3.5 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Based on the documentation, I would have expected an error
    in this case. mkdir a a/1 b b/2 mv -Tn a b Exit status is zero. The only
   relevant system call in the strace output is this one: 
 
 Content analysis details:   (3.5 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [54.186.198.63 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:470:142:0:0:0:0:17 listed in]
                             [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  0.9 SPF_FAIL               SPF: sender does not match SPF record (fail)
 [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;id=fweimer%40redhat.com;ip=2001%3A470%3A142%3A%3A17;r=debbugs.gnu.org]
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

Based on the documentation, I would have expected an error in this case.

mkdir a a/1 b b/2
mv -Tn a b

Exit status is zero.  The only relevant system call in the strace output
is this one:

renameat2(AT_FDCWD, "a", AT_FDCWD, "b", RENAME_NOREPLACE) = -1 EEXIST (File exists)

Seen with: coreutils-9.7-9.fc43.x86_64

Thanks,
Florian





Acknowledgement sent to Florian Weimer <fweimer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#81377; 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, 8 Jul 2026 13:00:02 UTC

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