Received: (at 80060) by debbugs.gnu.org; 23 Dec 2025 12:27:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 23 07:27:45 2025
Received: from localhost ([127.0.0.1]:55553 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vY1UP-0000Sx-8q
for submit <at> debbugs.gnu.org; Tue, 23 Dec 2025 07:27:45 -0500
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:60673)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>)
id 1vY1UN-0000Sg-0S
for 80060 <at> debbugs.gnu.org; Tue, 23 Dec 2025 07:27:43 -0500
Received: by mail-wm1-x32c.google.com with SMTP id
5b1f17b1804b1-4779aa4f928so48355675e9.1
for <80060 <at> debbugs.gnu.org>; Tue, 23 Dec 2025 04:27:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1766492857; x=1767097657; darn=debbugs.gnu.org;
h=content-transfer-encoding:in-reply-to:from:cc:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:sender:from:to:cc:subject:date:message-id:reply-to;
bh=8yziatJieorgwztXXYW1KE8dIUwimCOPI5nsuABE1/8=;
b=AVE2/MWLvE6wY4Wu42cgxsfiIt0L3QXED9O9In7nrKr8/P4uSt0uznt+RSG6O+7biF
0kYcQMy5KhUbPo6SAmV2NqA9aZxXaWj3kjj09SvS1FM9wAIXSGXpRbKvh3oq10KihvFK
+CNOi1NmpHpUCBoItrv77ZAqq6XjTUSOgdHr8NkCIk3dLBM7HaOvwszMjqtBLhP0+Gu9
Qrw4816g0UVRlJxxyQh8il7HDy8pc/v+mvTR4t7jlQwXeUiky62d/L4YGcv+TxKK1vVA
VaXhi/OMxpnpJAKNDaePiLJV+EPcOiVcffTxXNkehG9wR4vWiGW71M3l3UKlBvB1jEEy
TFZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1766492857; x=1767097657;
h=content-transfer-encoding:in-reply-to:from:cc:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:sender:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=8yziatJieorgwztXXYW1KE8dIUwimCOPI5nsuABE1/8=;
b=fhwEh3KSM6DrPvyg5iZFHi/v/EqDKLe4gPmUtyWmP19G0wKfZ7o+eCGLnMBUifKryD
dglavufYv8U5CmwcJbuWVI737lieQsr0U+lk2I0bdcUZTxkCvGocIS/eHZgJ2fIayAbu
ImK9q4YCHZ7j8qdZ/CUhwSvxkDCIXMbkAphExlL2a5bVqLIuAAkv+Eg9i6Woegb2w1xS
Wz7s1UF7qzRpv9E5mc+/hYGOcfKtxw0zt8LDUssvun1Hp2KfBLGbLMDO+bC9C5IZtYhN
gTtuydBuaiihoeBWa+fJe2cADksF6S/Sd6dBtXkTrWyKgDymg9EO1cPWmPWyFxO6MyKu
DWnQ==
X-Forwarded-Encrypted: i=1;
AJvYcCUXgs8Onjd3voAAjRXs7/dLioAF33TQjuh32vQhg1T9+deedK7vLq/kP7bQRYdcfQHt/heHXQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzhNVG6WER9vGEeYWg0WGjfXxlVEEDIXljYeyM22QdjuX/zAPCL
WimHmknSPcbbP6RriblHM73nwcLF9VymM1j8DRtLS85UvjsVcXAwPH9f
X-Gm-Gg: AY/fxX4CAsCIDKeydAojuwd6w00Uj+Us/i2RBuJ50N/ftkV9Hxt4hx6/zSlYErKuTja
dQOCp5aDxVTg4gOnXkVOlzgXbKLmcBM3CDiliIW586S2f4PbLdWLcUoVFrJwvY6ncKBtZ2nqHO7
K+GWOwFBC2FxbCU+REHYlcaG0gdhWWu4ecT4VDvuwplbyBtqEyR+R947GdqvZYwDJAA6vzNzCkN
APq6xyI4s+vfWxo5lT0MNnXgb+3Aa3rD73t8czLFSgXWxDCiD6doMSbqv+FNByHTKtjg8cFi+jh
o2SYVkMWf2tU9CxjoJkss3gtcy4iySIuhzRx/uR4LMQRILn4fPaHtMkiQ6XwnbJxt2d7c+uj0jv
GQ4H3k39QDDj7ov3vvQakq0qosmhpGtdtybc38Wd9iP6ErfQfzXrkKUdWPJaX5Y59335H7aGJx0
4x6b2+1lHVegL1kntXbd86pYwPTvxqg6IgNbnfgd17imC6pZh3+802ZHcSApuLPRuPKPI=
X-Google-Smtp-Source: AGHT+IEiML/UxKSuNc32fURXlQ1fvegLbRHMyxYSEan4w9n1JbKf53aK7cREPTTu2npc33jV0uM5Rw==
X-Received: by 2002:a05:600c:524f:b0:45d:d8d6:7fcc with SMTP id
5b1f17b1804b1-47d1958b73cmr140827095e9.27.1766492856454;
Tue, 23 Dec 2025 04:27:36 -0800 (PST)
Received: from [192.168.1.31]
(86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146])
by smtp.googlemail.com with ESMTPSA id
ffacd0b85a97d-4324ea227e0sm28328978f8f.17.2025.12.23.04.27.35
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Tue, 23 Dec 2025 04:27:35 -0800 (PST)
Message-ID: <bafa885e-7cce-42ee-8ae0-099dcf1ab99a@HIDDEN>
Date: Tue, 23 Dec 2025 12:27:34 +0000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
Subject: Re: bug#80060: mv: move files across bind mounts using the rename
syscall
To: Andrei Topala <topala.andrei@HIDDEN>, 80060 <at> debbugs.gnu.org
References: <CAF8SvsAiLk1tTvi639RHEZ4xiO2iG1ir90+00hKtQbYSv5-KbQ@HIDDEN>
Content-Language: en-US
From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
In-Reply-To: <CAF8SvsAiLk1tTvi639RHEZ4xiO2iG1ir90+00hKtQbYSv5-KbQ@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80060
Cc: Milan Hauth <milahu@HIDDEN>
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: -1.0 (-)
On 23/12/2025 00:08, Andrei Topala wrote:
>> Is there a downside to always trying rename() first and doing the copy
>
>> if it fails? That's approximately what toybox's mv does...
>
>
> mv already tries rename() first. The problem is that rename() returns
>
> EXDEV even when source and destination are on the same physical device
>
> but accessed through different bind mount points.
>
>
> For example, with these bind mounts on the same device:
>
>
> /mnt/full root=/
>
> /mnt/data root=/data
>
>
> Moving /mnt/data/file to /mnt/full/backup/ fails with EXDEV because the
>
> kernel sees different mount points, forcing an unnecessary copy+delete.
>
>
> [1] solves this by iterating through all mount/realpath combinations
>
> until rename() succeeds. I've implemented an approach using gnulib's
>
> mountlist.h [2].
>
>
> I'm thinking of:
>
> 1. Parse /proc/self/mountinfo via read_file_system_list()
>
> 2. Find mount entries for source and destination paths
>
> 3. If different me_dev, fall back to copy (truly different devices)
>
> 4. Compute device_path = me_mntroot + path_relative_to_mountpoint
>
> 5. Translate one path through the other's mount:
>
> - If dst's device_path is under src_mount's root, translate dst
>
> - Otherwise translate src through dst_mount
>
> 6. rename() with translated path succeeds - both paths now resolve
>
> through the same mount point
>
>
> Example translation:
>
> /mnt/data/file
>
> → mount: root="/data", mountdir="/mnt/data"
>
> → device_path: /data/file
>
> → through /mnt/full (root="/"): /mnt/full/data/file
>
>
>
> rename("/mnt/full/data/file", "/mnt/full/backup/file") succeeds
>
>
> This avoids the brute-force iteration in [1] by computing which mount
>
> can "see" both paths (the one with the wider root).
>
>
> I haven't signed FSF copyright assignment yet but am willing to do so
>
> if there's interest.
>
>
> [1] https://github.com/milahu/move-files-across-bind-mounts
>
> [2]
> https://github.com/coreutils/coreutils/commit/a961fc317951b92c2468771f8a0d2895e94ac2a3
Referencing the original discussion:
https://lists.gnu.org/archive/html/coreutils/2024-12/msg00002.html
The code is good, and thanks for talking time to propose a solution.
However my conclusion from the original thread is still the same.
I don't think it's appropriate for mv to do this expensive/error prone
path manipulation for each file being copied across devices.
IMHO this is more appropriate for the kernel,
which has a more holistic view of the mount space.
thanks,
Padraig.
bug-coreutils@HIDDEN:bug#80060; Package coreutils.
Full text available.
Received: (at submit) by debbugs.gnu.org; 23 Dec 2025 08:43:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 23 03:43:01 2025
Received: from localhost ([127.0.0.1]:53885 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vXxyv-0003sr-9q
for submit <at> debbugs.gnu.org; Tue, 23 Dec 2025 03:43:01 -0500
Received: from lists.gnu.org ([2001:470:142::17]:45274)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <topala.andrei@HIDDEN>)
id 1vXpyA-0006sX-KM
for submit <at> debbugs.gnu.org; Mon, 22 Dec 2025 19:09:43 -0500
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 <topala.andrei@HIDDEN>)
id 1vXpxt-0007o0-Nb
for bug-coreutils@HIDDEN; Mon, 22 Dec 2025 19:09:27 -0500
Received: from mail-yx1-xb12d.google.com ([2607:f8b0:4864:20::b12d])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <topala.andrei@HIDDEN>)
id 1vXpxr-0001S4-IW
for bug-coreutils@HIDDEN; Mon, 22 Dec 2025 19:09:25 -0500
Received: by mail-yx1-xb12d.google.com with SMTP id
956f58d0204a3-6466d8fd383so2860662d50.2
for <bug-coreutils@HIDDEN>; Mon, 22 Dec 2025 16:09:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1766448561; x=1767053361; darn=gnu.org;
h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
:date:message-id:reply-to;
bh=wUnqYptaH9IECVJDXbUu2EP8pAep5pwBdu0tRvnsPxo=;
b=d7OI9gd0wkX9B+ZfNQAb+Z5k8H5AJV55W8/Mtgj2wFPAtRe4tUbcz3FsXrbM5bnBAt
WwT3SfgR92Q5cKpteB7mYIJIZqHGVWRkDOI4nXmC+9DFvkg077UkjcwV/w68RSlSK4JK
KWtHSRyYISoIEqRBZ2hfk75qrvf1pTQcNg/6iQTxmzg8V9dHcrPc1n3uzAcaOffe6UF4
v0iTwV+xAGlIrQibhRcDVsP8tdzG33lgzY9rx6vMKhVsdhPaYAt9tHcXd/tGc74VnDMe
PJpx47UuRR4VMLJU63XzczF+dHSMNMHD2XHykEpSxGmFL8STAFfmskf/R3HZ7LZZQv1N
Sgaw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1766448561; x=1767053361;
h=to:subject:message-id:date:from:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=wUnqYptaH9IECVJDXbUu2EP8pAep5pwBdu0tRvnsPxo=;
b=wCdaa2eBjHe9CfXQQM9IrNcJ3ElROCSi4EFk3iXAc2fZQTJgXhqKgB1lPF8CJ9A5K3
2Lx83Y2VXI2PPpnVQZEWp19DERn3x+ETewuUCCtVx2HdgkLD5nGoS+jXbsUWBdziH2NJ
NA5jEByRBHUVplj745YJrdASxp5k/1LD2yV5aWepiBbD1xaFvxn7h53l26qtQh9KOXt7
46LAkBBTZcKjRtSgkswPN4a8NE4rphx3ii2Flkxi9PxsoF0cj6SDg5XDn8YM8LZl7dTT
z8GKEZqzKloiCo1kYaOdEh44Pwz6UtTLiNqeMq2z+bVgl/IaNPotdPq9XrrXVGQFihmd
0g3A==
X-Gm-Message-State: AOJu0Yxq3/mmFj+HT1aIjUBrvZJ0XK3Hf913JyuwTdRIQQ1r+n9uH/Mw
Qgh2X9Tb+F2I8tsX69K3lUQirCpdZBuMyhZOdfc7ySS10r+RppbH7SVkXo83WP8alu5awGz4OQp
OoGqCrvRFga4f9XjsoEuu3N9QB67TEFi+u9Mh0hWUIMBb
X-Gm-Gg: AY/fxX439WOgTk5V5BpH4x7MtILVKkcpqaxWEYVdta17APIc262eEVt1Lwa0/2Bn4yR
W76iz/LWj0mXgJK+TCwcOTQrZxi0v69uZPnmXvRLwxU3xUxmc7e7H2/wDxZ5l1aW/ssX7WM/uy4
EDU5kPdYgPne0FIuVtx8ORIgnv7odeumw2BNXK34C9Y/dSbi1E5a3OQlgV9kd8aK4LuUJQ53P1o
l7+b0LucSVSe6k2CF3R/fD1phYRRw1RP/KteHULryIo05tNkrPcvWQY1z/c5n9iH8mv1tQ=
X-Google-Smtp-Source: AGHT+IG8yDbpdr9Y1JmNeYoTuWBL9I2B+y80eDhdp9t/NIZ4rSuOO147gFZakfjaJWZrQ4GFmYOvUQ8Hp7NCVIvOyN4=
X-Received: by 2002:a53:c05b:0:20b0:63e:1943:ce49 with SMTP id
956f58d0204a3-6466a8a9305mr7387877d50.39.1766448561293; Mon, 22 Dec 2025
16:09:21 -0800 (PST)
MIME-Version: 1.0
From: Andrei Topala <topala.andrei@HIDDEN>
Date: Tue, 23 Dec 2025 02:08:45 +0200
X-Gm-Features: AQt7F2plk2JlsSYIsJ6Ondmze4SiJehlgNy48W9Miub51j0-hsiFkMiMGp1nVMs
Message-ID: <CAF8SvsAiLk1tTvi639RHEZ4xiO2iG1ir90+00hKtQbYSv5-KbQ@HIDDEN>
Subject: Re: mv: move files across bind mounts using the rename syscall
To: bug-coreutils@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000028cee0646935b7f"
Received-SPF: pass client-ip=2607:f8b0:4864:20::b12d;
envelope-from=topala.andrei@HIDDEN; helo=mail-yx1-xb12d.google.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, FREEMAIL_FROM=0.001,
HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 23 Dec 2025 03:42:59 -0500
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.0 (/)
--000000000000028cee0646935b7f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
> Is there a downside to always trying rename() first and doing the copy
> if it fails? That's approximately what toybox's mv does...
mv already tries rename() first. The problem is that rename() returns
EXDEV even when source and destination are on the same physical device
but accessed through different bind mount points.
For example, with these bind mounts on the same device:
/mnt/full root=3D/
/mnt/data root=3D/data
Moving /mnt/data/file to /mnt/full/backup/ fails with EXDEV because the
kernel sees different mount points, forcing an unnecessary copy+delete.
[1] solves this by iterating through all mount/realpath combinations
until rename() succeeds. I've implemented an approach using gnulib's
mountlist.h [2].
I'm thinking of:
1. Parse /proc/self/mountinfo via read_file_system_list()
2. Find mount entries for source and destination paths
3. If different me_dev, fall back to copy (truly different devices)
4. Compute device_path =3D me_mntroot + path_relative_to_mountpoint
5. Translate one path through the other's mount:
- If dst's device_path is under src_mount's root, translate dst
- Otherwise translate src through dst_mount
6. rename() with translated path succeeds - both paths now resolve
through the same mount point
Example translation:
/mnt/data/file
=E2=86=92 mount: root=3D"/data", mountdir=3D"/mnt/data"
=E2=86=92 device_path: /data/file
=E2=86=92 through /mnt/full (root=3D"/"): /mnt/full/data/file
rename("/mnt/full/data/file", "/mnt/full/backup/file") succeeds
This avoids the brute-force iteration in [1] by computing which mount
can "see" both paths (the one with the wider root).
I haven't signed FSF copyright assignment yet but am willing to do so
if there's interest.
[1] https://github.com/milahu/move-files-across-bind-mounts
[2]
https://github.com/coreutils/coreutils/commit/a961fc317951b92c2468771f8a0d2=
895e94ac2a3
Andrei
--000000000000028cee0646935b7f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;lin=
e-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;f=
ont-variant-alternates:normal;font-variant-numeric:normal;font-variant-east=
-asian:normal;font-feature-settings:normal"><span style=3D"font-variant-lig=
atures:no-common-ligatures">> Is there a downside to always trying renam=
e() first and doing the copy</span></p><p style=3D"color:rgb(0,0,0);margin:=
0px;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:no=
ne;font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:no=
rmal;font-variant-east-asian:normal;font-feature-settings:normal"><span sty=
le=3D"font-variant-ligatures:no-common-ligatures">> if it fails? That=
9;s approximately what toybox's mv does...</span></p><p style=3D"color:=
rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;f=
ont-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-=
variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings=
:normal;min-height:13px"><span style=3D"font-variant-ligatures:no-common-li=
gatures"></span><br></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:1=
1px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning=
:auto;font-variant-alternates:normal;font-variant-numeric:normal;font-varia=
nt-east-asian:normal;font-feature-settings:normal"><span style=3D"font-vari=
ant-ligatures:no-common-ligatures">mv already tries rename() first. The pro=
blem is that rename() returns</span></p><p style=3D"color:rgb(0,0,0);margin=
:0px;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:n=
one;font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:n=
ormal;font-variant-east-asian:normal;font-feature-settings:normal"><span st=
yle=3D"font-variant-ligatures:no-common-ligatures">EXDEV even when source a=
nd destination are on the same physical device</span></p><p style=3D"color:=
rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;f=
ont-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-=
variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings=
:normal"><span style=3D"font-variant-ligatures:no-common-ligatures">but acc=
essed through different bind mount points.</span></p><p style=3D"color:rgb(=
0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-=
size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-vari=
ant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:nor=
mal;min-height:13px"><span style=3D"font-variant-ligatures:no-common-ligatu=
res"></span><br></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;=
line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:aut=
o;font-variant-alternates:normal;font-variant-numeric:normal;font-variant-e=
ast-asian:normal;font-feature-settings:normal"><span style=3D"font-variant-=
ligatures:no-common-ligatures">For example, with these bind mounts on the s=
ame device:</span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11p=
x;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:a=
uto;font-variant-alternates:normal;font-variant-numeric:normal;font-variant=
-east-asian:normal;font-feature-settings:normal;min-height:13px"><span styl=
e=3D"font-variant-ligatures:no-common-ligatures"></span><br></p><p style=3D=
"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:=
Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:norma=
l;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-s=
ettings:normal"><span style=3D"font-variant-ligatures:no-common-ligatures">=
=C2=A0 /mnt/full=C2=A0 =C2=A0 =C2=A0 root=3D/</span></p><p style=3D"color:r=
gb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;fo=
nt-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-v=
ariant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:=
normal"><span style=3D"font-variant-ligatures:no-common-ligatures">=C2=A0 /=
mnt/data=C2=A0 =C2=A0 =C2=A0 root=3D/data</span></p><p style=3D"color:rgb(0=
,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-s=
ize-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-varia=
nt-numeric:normal;font-variant-east-asian:normal;font-feature-settings:norm=
al;min-height:13px"><span style=3D"font-variant-ligatures:no-common-ligatur=
es"></span><br></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;l=
ine-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto=
;font-variant-alternates:normal;font-variant-numeric:normal;font-variant-ea=
st-asian:normal;font-feature-settings:normal"><span style=3D"font-variant-l=
igatures:no-common-ligatures">Moving /mnt/data/file to /mnt/full/backup/ fa=
ils with EXDEV because the</span></p><p style=3D"color:rgb(0,0,0);margin:0p=
x;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:none=
;font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:norm=
al;font-variant-east-asian:normal;font-feature-settings:normal"><span style=
=3D"font-variant-ligatures:no-common-ligatures">kernel sees different mount=
points, forcing an unnecessary copy+delete.</span></p><p style=3D"color:rg=
b(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;fon=
t-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-va=
riant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:n=
ormal;min-height:13px"><span style=3D"font-variant-ligatures:no-common-liga=
tures"></span><br></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11p=
x;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:a=
uto;font-variant-alternates:normal;font-variant-numeric:normal;font-variant=
-east-asian:normal;font-feature-settings:normal"><span style=3D"font-varian=
t-ligatures:no-common-ligatures">[1] solves this by iterating through all m=
ount/realpath combinations</span></p><p style=3D"color:rgb(0,0,0);margin:0p=
x;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:none=
;font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:norm=
al;font-variant-east-asian:normal;font-feature-settings:normal"><span style=
=3D"font-variant-ligatures:no-common-ligatures">until rename() succeeds. I&=
#39;ve implemented an approach using gnulib's</span></p><p style=3D"col=
or:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menl=
o;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;fo=
nt-variant-numeric:normal;font-variant-east-asian:normal;font-feature-setti=
ngs:normal"><span style=3D"font-variant-ligatures:no-common-ligatures">moun=
tlist.h [2].</span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11=
px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:=
auto;font-variant-alternates:normal;font-variant-numeric:normal;font-varian=
t-east-asian:normal;font-feature-settings:normal;min-height:13px"><span sty=
le=3D"font-variant-ligatures:no-common-ligatures"></span><br></p><p style=
=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-fami=
ly:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:no=
rmal;font-variant-numeric:normal;font-variant-east-asian:normal;font-featur=
e-settings:normal"><span style=3D"font-variant-ligatures:no-common-ligature=
s">I'm thinking of:</span></p><p style=3D"color:rgb(0,0,0);margin:0px;f=
ont-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:none;fo=
nt-kerning:auto;font-variant-alternates:normal;font-variant-numeric:normal;=
font-variant-east-asian:normal;font-feature-settings:normal"><span style=3D=
"font-variant-ligatures:no-common-ligatures">1. Parse /proc/self/mountinfo =
via read_file_system_list()</span></p><p style=3D"color:rgb(0,0,0);margin:0=
px;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:non=
e;font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:nor=
mal;font-variant-east-asian:normal;font-feature-settings:normal"><span styl=
e=3D"font-variant-ligatures:no-common-ligatures">2. Find mount entries for =
source and destination paths</span></p><p style=3D"color:rgb(0,0,0);margin:=
0px;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:no=
ne;font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:no=
rmal;font-variant-east-asian:normal;font-feature-settings:normal"><span sty=
le=3D"font-variant-ligatures:no-common-ligatures">3. If different me_dev, f=
all back to copy (truly different devices)</span></p><p style=3D"color:rgb(=
0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-=
size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-vari=
ant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:nor=
mal"><span style=3D"font-variant-ligatures:no-common-ligatures">4. Compute =
device_path =3D me_mntroot + path_relative_to_mountpoint</span></p><p style=
=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-fami=
ly:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:no=
rmal;font-variant-numeric:normal;font-variant-east-asian:normal;font-featur=
e-settings:normal"><span style=3D"font-variant-ligatures:no-common-ligature=
s">5. Translate one path through the other's mount:</span></p><p style=
=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-fami=
ly:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:no=
rmal;font-variant-numeric:normal;font-variant-east-asian:normal;font-featur=
e-settings:normal"><span style=3D"font-variant-ligatures:no-common-ligature=
s">=C2=A0=C2=A0=C2=A0- If dst's device_path is under src_mount's ro=
ot, translate dst</span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-si=
ze:11px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-ker=
ning:auto;font-variant-alternates:normal;font-variant-numeric:normal;font-v=
ariant-east-asian:normal;font-feature-settings:normal"><span style=3D"font-=
variant-ligatures:no-common-ligatures">=C2=A0=C2=A0=C2=A0- Otherwise transl=
ate src through dst_mount</span></p><p style=3D"color:rgb(0,0,0);margin:0px=
;font-size:11px;line-height:normal;font-family:Menlo;font-size-adjust:none;=
font-kerning:auto;font-variant-alternates:normal;font-variant-numeric:norma=
l;font-variant-east-asian:normal;font-feature-settings:normal"><span style=
=3D"font-variant-ligatures:no-common-ligatures">6. rename() with translated=
path succeeds - both paths now resolve</span></p><p style=3D"color:rgb(0,0=
,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-siz=
e-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant=
-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal=
"><span style=3D"font-variant-ligatures:no-common-ligatures">=C2=A0=C2=A0 =
=C2=A0 through the same mount point</span></p><p style=3D"color:rgb(0,0,0);=
margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-size-ad=
just:none;font-kerning:auto;font-variant-alternates:normal;font-variant-num=
eric:normal;font-variant-east-asian:normal;font-feature-settings:normal;min=
-height:13px"><span style=3D"font-variant-ligatures:no-common-ligatures"></=
span><br></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-he=
ight:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-=
variant-alternates:normal;font-variant-numeric:normal;font-variant-east-asi=
an:normal;font-feature-settings:normal"><span style=3D"font-variant-ligatur=
es:no-common-ligatures">Example translation:</span></p><p style=3D"color:rg=
b(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;fon=
t-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-va=
riant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:n=
ormal"><span style=3D"font-variant-ligatures:no-common-ligatures">=C2=A0 /m=
nt/data/file</span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11=
px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:=
auto;font-variant-alternates:normal;font-variant-numeric:normal;font-varian=
t-east-asian:normal;font-feature-settings:normal"><span style=3D"font-varia=
nt-ligatures:no-common-ligatures">=C2=A0 =E2=86=92 mount: root=3D"/dat=
a", mountdir=3D"/mnt/data"</span></p><p style=3D"color:rgb(0=
,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-s=
ize-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-varia=
nt-numeric:normal;font-variant-east-asian:normal;font-feature-settings:norm=
al"><span style=3D"font-variant-ligatures:no-common-ligatures">=C2=A0 =E2=
=86=92 device_path: /data/file =C2=A0</span></p><p style=3D"color:rgb(0,0,0=
);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-size-=
adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-n=
umeric:normal;font-variant-east-asian:normal;font-feature-settings:normal">=
<span style=3D"font-variant-ligatures:no-common-ligatures">=C2=A0=C2=A0=E2=
=86=92 through /mnt/full (root=3D"/"): /mnt/full/data/file</span>=
</p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:norm=
al;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-a=
lternates:normal;font-variant-numeric:normal;font-variant-east-asian:normal=
;font-feature-settings:normal;min-height:13px"><span style=3D"font-variant-=
ligatures:no-common-ligatures">=C2=A0=C2=A0 =C2=A0</span></p><p style=3D"co=
lor:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Men=
lo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;f=
ont-variant-numeric:normal;font-variant-east-asian:normal;font-feature-sett=
ings:normal"><span style=3D"font-variant-ligatures:no-common-ligatures">=C2=
=A0 rename("/mnt/full/data/file", "/mnt/full/backup/file&quo=
t;) succeeds</span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11=
px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:=
auto;font-variant-alternates:normal;font-variant-numeric:normal;font-varian=
t-east-asian:normal;font-feature-settings:normal;min-height:13px"><span sty=
le=3D"font-variant-ligatures:no-common-ligatures"></span><br></p><p style=
=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-fami=
ly:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:no=
rmal;font-variant-numeric:normal;font-variant-east-asian:normal;font-featur=
e-settings:normal"><span style=3D"font-variant-ligatures:no-common-ligature=
s">This avoids the brute-force iteration in [1] by computing which mount</s=
pan></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:=
normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-varia=
nt-alternates:normal;font-variant-numeric:normal;font-variant-east-asian:no=
rmal;font-feature-settings:normal"><span style=3D"font-variant-ligatures:no=
-common-ligatures">can "see" both paths (the one with the wider r=
oot).</span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line=
-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;fo=
nt-variant-alternates:normal;font-variant-numeric:normal;font-variant-east-=
asian:normal;font-feature-settings:normal;min-height:13px"><span style=3D"f=
ont-variant-ligatures:no-common-ligatures"></span><br></p><p style=3D"color=
:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;=
font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font=
-variant-numeric:normal;font-variant-east-asian:normal;font-feature-setting=
s:normal"><span style=3D"font-variant-ligatures:no-common-ligatures">I have=
n't signed FSF copyright assignment yet but am willing to do so</span><=
/p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:norma=
l;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-al=
ternates:normal;font-variant-numeric:normal;font-variant-east-asian:normal;=
font-feature-settings:normal"><span style=3D"font-variant-ligatures:no-comm=
on-ligatures">if there's interest.</span></p><p style=3D"color:rgb(0,0,=
0);margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-size=
-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-=
numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;=
min-height:13px"><span style=3D"font-variant-ligatures:no-common-ligatures"=
></span><br></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line=
-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;fo=
nt-variant-alternates:normal;font-variant-numeric:normal;font-variant-east-=
asian:normal;font-feature-settings:normal"><span style=3D"font-variant-liga=
tures:no-common-ligatures">[1]<span class=3D"gmail-Apple-converted-space">=
=C2=A0</span><a href=3D"https://github.com/milahu/move-files-across-bind-mo=
unts">https://github.com/milahu/move-files-across-bind-mounts</a></span></p=
><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-height:normal;=
font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alte=
rnates:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fo=
nt-feature-settings:normal"><span style=3D"font-variant-ligatures:no-common=
-ligatures">[2]<span class=3D"gmail-Apple-converted-space">=C2=A0</span><a =
href=3D"https://github.com/coreutils/coreutils/commit/a961fc317951b92c24687=
71f8a0d2895e94ac2a3">https://github.com/coreutils/coreutils/commit/a961fc31=
7951b92c2468771f8a0d2895e94ac2a3</a></span></p><p style=3D"color:rgb(0,0,0)=
;margin:0px;font-size:11px;line-height:normal;font-family:Menlo;font-size-a=
djust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-nu=
meric:normal;font-variant-east-asian:normal;font-feature-settings:normal;mi=
n-height:13px"><br><span style=3D"font-variant-ligatures:no-common-ligature=
s"></span></p><p style=3D"color:rgb(0,0,0);margin:0px;font-size:11px;line-h=
eight:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font=
-variant-alternates:normal;font-variant-numeric:normal;font-variant-east-as=
ian:normal;font-feature-settings:normal"><span style=3D"font-variant-ligatu=
res:no-common-ligatures">Andrei</span></p></div>
--000000000000028cee0646935b7f--
Andrei Topala <topala.andrei@HIDDEN>:bug-coreutils@HIDDEN.
Full text available.bug-coreutils@HIDDEN:bug#80060; Package coreutils.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.