From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 04 Mar 2024 00:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 69532@debbugs.gnu.org Cc: Petr Malat X-Debbugs-Original-To: Coreutils bugs Received: via spool by submit@debbugs.gnu.org id=B.170951313119722 (code B ref -1); Mon, 04 Mar 2024 00:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Mar 2024 00:45:31 +0000 Received: from localhost ([127.0.0.1]:41413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgwSQ-000581-H8 for submit@debbugs.gnu.org; Sun, 03 Mar 2024 19:45:30 -0500 Received: from lists.gnu.org ([209.51.188.17]:35416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgwSO-00057o-98 for submit@debbugs.gnu.org; Sun, 03 Mar 2024 19:45:29 -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 ) id 1rgwRu-000399-5y for bug-coreutils@gnu.org; Sun, 03 Mar 2024 19:44:58 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgwRs-0003Yc-8V for bug-coreutils@gnu.org; Sun, 03 Mar 2024 19:44:57 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 97A6C3C00E40A; Sun, 3 Mar 2024 16:44:53 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id X81JhLRZ22Jd; Sun, 3 Mar 2024 16:44:53 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 19DC23C00E40D; Sun, 3 Mar 2024 16:44:53 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 19DC23C00E40D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1709513093; bh=dyU2YSTxlnIQFQYURpn6DyWWrT760ElL3mMu8FCw8Ms=; h=Message-ID:Date:MIME-Version:To:From; b=ZMRK7n6GIMaCnU4EIT3jZ+HptYgnhX/JwiJ2iJvnCxTBQnSSsom+9OvqNaQQsoWY+ yIUPtQuZXHV4WL/WPyx2CXUsFxwOkGozhteMk15l7N2QEq8NgpUQ7cb4lVROVXiXbo r7hSVL+2GutpJQxiXSPiUPqM8e+JS39p7QR1MJJ45G2R1GxoVw2oB4g+8B9VlBQL0I 2bMh/OOPWpMk25lDz4pbyKmpfRYxO3Na+wQXZgC8WUGSp8QTSD483wn50QsgasclIW NxhMOgIXDGCQxLRf8Ekn66DlDVFT6KU8AhTqUaMOVf3YM9vI0cLqMq7UV//xzSDVkC v6lYqnJCBxXmg== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id oYs4Q0nVt8vY; Sun, 3 Mar 2024 16:44:53 -0800 (PST) Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id F3B883C00E40A; Sun, 3 Mar 2024 16:44:52 -0800 (PST) Message-ID: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> Date: Sun, 3 Mar 2024 16:44:52 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@cs.ucla.edu; helo=mail.cs.ucla.edu X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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.3 (--) Although I like the idea of exposing file swaps to the user, the first cut of 'mv -x' has significant problems. I expect 'mv -x A B' to act like 'mv A B' except the destination must exist and is renamed back to A. However, this is not true for 'mv -x A B' when B is a directory; it renames B to A rather than renaming B/A to A as I expect. That is, 'mv -x' acts as if -T (--no-target-directory) is also specified. There is no way to get mv's traditional behavior, or to get mv -t behavior. To fix this, 'mv -x' should respect the usual mv behavior with respect to directories. For example, when D is a directory 'mv -x A B C D' should act like 'mv A B C D' except that D's old entries should be renamed back to A B and C. And the -t and -T options should work with -x the same way they work when -x is not specified. This needs to happen before the next coreutils release, to avoid confusion about 'mv -x'. From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 04 Mar 2024 15:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , 69532@debbugs.gnu.org Cc: Petr Malat Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.17095673485950 (code B ref 69532); Mon, 04 Mar 2024 15:50:02 +0000 Received: (at 69532) by debbugs.gnu.org; 4 Mar 2024 15:49:08 +0000 Received: from localhost ([127.0.0.1]:44525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhAYt-0001Xr-NY for submit@debbugs.gnu.org; Mon, 04 Mar 2024 10:49:08 -0500 Received: from mail-wr1-f47.google.com ([209.85.221.47]:50536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhAYp-0001WV-UT for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 10:49:06 -0500 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-33e1207bba1so3722423f8f.1 for <69532@debbugs.gnu.org>; Mon, 04 Mar 2024 07:48:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709567248; x=1710172048; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=9J0LMqYiqN79a1m8oW48VegN0cq2DNToK8xYGD3R8Ec=; b=D2/avtp8WGLZdEBHnYXH1G4V5Qq2ozWDGGGLCMso9NwFA6CYREIRzTS6SNVgmawnP0 hPqY/OQk2tvvVFlrdbN+sIu00fU5TsORE+K5n54auZUHUmZyqDonL9s++h+ayS7P3daB R/u933+bzwPNr2OnMS0vD0SlTcvlf23Rhfc0LeWHbZcWKAlthfPSS/dIgRUO+J4nBC+C IE1lnm8QWaZuOlrj0ayZ9T3DzmW9hwK1t6VpD5eMPodp9xm2484VLde5WWHbyfiiBiC+ LOudkcyGG2WWfPTMWcf8cMj+uA/Ezo8n6XwratGvj7L70bvyLIhoNnl5ih9CmQnK9zCx EdUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709567248; x=1710172048; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9J0LMqYiqN79a1m8oW48VegN0cq2DNToK8xYGD3R8Ec=; b=srm80ddyq/s1W0g0FmdedGh9OuhKj67xpRAuHVxQBCaXQVW6IeHWgsBVJUJBfSvq59 d1eWPA+7efV3q3t/gvHDTmj9UUoSGbsuWG5vPIOSBF6m4iJ+aDlMaMrDzc5k7Qx3XSWs +p6TQ3ZbhfyiG8AIx+wYsG1X52ZuAJTrM0elQIKZzUQGj93K6VqYYwJvwDQwwYXaAKhw zQz5dvzD3D3EGpiY5CdXTSQ6FaRRCsWEUHtQ1tlWbi5xkEdEJlfhI7L6+VOJsnmUxn+4 6sB618O5iKAYI9vp4VT1e+y3qATkjP7K/diVjnIb0Z+czzpV+Zud3YCaMrsPiL7Lk+Pb EowQ== X-Forwarded-Encrypted: i=1; AJvYcCUyVGuEPJx2nRvLQ1BmIyJ3YMJ3Q5zKijffKwJz9NRTHqAyNyQqtGCvX6ZdRtetggr5/1epMGZtP9HpfxedMCY/JGfhmcw= X-Gm-Message-State: AOJu0Yyiw1pG/v+JR7XA+plLiZC0P97gphoN9S8TiyPInd/mw/3fuS/E idtfxyIpqLDfSwwCHBpN+zYZdfseSFmQIxtYNdO7xn3jxKK4AC1+ X-Google-Smtp-Source: AGHT+IF0bZIUvlN3gRsG0Is7GIl28NAvG6Bh684k5W62+4LF9kil0Mz60Mc8EdItyaRPk5zEiDw5BQ== X-Received: by 2002:a5d:4568:0:b0:33d:bfb1:4c51 with SMTP id a8-20020a5d4568000000b0033dbfb14c51mr6416420wrc.10.1709567247629; Mon, 04 Mar 2024 07:47:27 -0800 (PST) Received: from [192.168.1.56] ([86.40.129.3]) by smtp.googlemail.com with ESMTPSA id dp14-20020a0560000c8e00b0033d8ce120f2sm12528995wrb.95.2024.03.04.07.47.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 07:47:27 -0800 (PST) Message-ID: <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> Date: Mon, 4 Mar 2024 15:47:23 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> From: =?UTF-8?Q?P=C3=A1draig?= Brady In-Reply-To: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) 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: -0.8 (/) On 04/03/2024 00:44, Paul Eggert wrote: > Although I like the idea of exposing file swaps to the user, the first > cut of 'mv -x' has significant problems. > > I expect 'mv -x A B' to act like 'mv A B' except the destination must > exist and is renamed back to A. However, this is not true for 'mv -x A > B' when B is a directory; it renames B to A rather than renaming B/A to > A as I expect. That is, 'mv -x' acts as if -T (--no-target-directory) is > also specified. There is no way to get mv's traditional behavior, or to > get mv -t behavior. > > To fix this, 'mv -x' should respect the usual mv behavior with respect > to directories. For example, when D is a directory 'mv -x A B C D' > should act like 'mv A B C D' except that D's old entries should be > renamed back to A B and C. And the -t and -T options should work with -x > the same way they work when -x is not specified. > > This needs to happen before the next coreutils release, to avoid > confusion about 'mv -x'. So you're saying the current mv -x behavior should only be with -T explicitly specified. With the current implementation, we should at least document that -x implies -T. By changing as you suggest, we'd not be adding any significant functionality, but potentially reducing confusion by following mv traditional arg handling. I agree with you I think, but not strongly. It's worth stating though that if users want to swap 2 directories they'd have to `mv -Tx d1 d2`, which may also be a little confusing. The use case we don't currently support directly is: cd source_dir && mv -x * "$dest_dir" Instead that currently requires: for f in *; do mv -x "$f" "$dest_dir"; done For completeness, stating disadvantages of pulling this use case within mv, is that by requiring the for loop for this would allow users to programatically determine which swap failed, and I see --swap as primarily a programatic interface used by scripts. Also if we made this change, We'd have to document that `mv -x 1 2 ... d` was not atomic over the whole set. I will look at making the change before the upcoming release. cheers, Pádraig From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 04 Mar 2024 20:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , 69532@debbugs.gnu.org Cc: Petr Malat Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.17095846045395 (code B ref 69532); Mon, 04 Mar 2024 20:37:01 +0000 Received: (at 69532) by debbugs.gnu.org; 4 Mar 2024 20:36:44 +0000 Received: from localhost ([127.0.0.1]:45044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhF3D-0001Ox-V3 for submit@debbugs.gnu.org; Mon, 04 Mar 2024 15:36:44 -0500 Received: from mail-wm1-f53.google.com ([209.85.128.53]:44322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhF3A-0001Oh-8j for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 15:36:43 -0500 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-412e7fe4497so6489915e9.1 for <69532@debbugs.gnu.org>; Mon, 04 Mar 2024 12:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709584504; x=1710189304; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=s9BrJxg9su8ud84XIPz6v5+pCF2xeDt+vJqJmzlYubM=; b=RjmR0eCf83ZDujGULjul0ORqZ1fKfcyvzo2PWBD0/GzyBjMmMKRo5Sky9PeHtDH+/K enKOuWaKahob3ZCM3TgqBxaWkhAFf9I01H6yUHZddD4prxADsge9oWV8799ABzIGCdkG HHXbITltva6ihryUjwKNuDbpgrG1N0USbgFF25I9FPsfCIrwVxkjxlPFB8KLuE2yCdqY GSJPY+PpuNo/JcEfVyY1AXTuG5AsOL65yrixdfyAKA+Q3adwjv46oQTk7if+CQp4d61I WNOXH7bockMK5bHWTsfqF9gi/6/v33uLLZKkBdKJ6zj6hIAPjyfbHQliSKLMCOtNvCk4 s5Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709584504; x=1710189304; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s9BrJxg9su8ud84XIPz6v5+pCF2xeDt+vJqJmzlYubM=; b=VFAUbmfOsKh0uViwQJUp8k4yqTLzFcoGxuwnEtRfgMVhj7U7CXFiIaBdYGeLRHwbX2 srAmrzc0pN6EjL5zNw3WQhUkRtKgaBBHCEDMzqKFAph8gnFU5CYZS4lQepIh7HzeL96+ 0BUiFzIp0f6atuoT4LdBoVM6kKqAQxB80GYlfO0xSEWqUpPnDHzZwlo1sqrtUotBmhkB EIS5CzYsDwfhGBfB+0L9CdQblx4OcigxRoQlDHtgeps7J8/sd8Cp50hdU8G7noAjf0pk ZzUbZahdRU3ZDB0lah+5or3wb1+2S+pgL1QZDzKM7cbhPRtVNOm8ejST2/kUaOpL9qTN qZbg== X-Forwarded-Encrypted: i=1; AJvYcCX/DE3xI1hdycMvSSayfBsD5/LiaxwUKUHAhsuZw9TBkcu6X7kyd4TqdqFTBCw4wBBGUhjP1R2U1K+6B2QgBVOJXGI+yRg= X-Gm-Message-State: AOJu0YysO9fm7plsW9PkbTV+L0b9U4LZ334/S5G4TvBkQT8MvkzgB3xI irhPsNjU/4QBwnf4/yRw59R1hgZeIA1BAuylf3TXnGvwE8qPwgLO X-Google-Smtp-Source: AGHT+IFk5cs+l0TWIiZeminU5U/ERV7nKlyEzOL4s+p4P3S5nEgjGIZEkzJ6fM+xCu40BRcSFwzeMg== X-Received: by 2002:a05:600c:3550:b0:412:b01a:1c98 with SMTP id i16-20020a05600c355000b00412b01a1c98mr8823812wmq.35.1709584504304; Mon, 04 Mar 2024 12:35:04 -0800 (PST) Received: from [192.168.1.56] (86-40-129-3-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.40.129.3]) by smtp.googlemail.com with ESMTPSA id l1-20020a05600c1d0100b00412ea52b102sm669126wms.34.2024.03.04.12.35.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 12:35:03 -0800 (PST) Message-ID: <093225e0-e04c-29e8-7245-ca2b12a710e0@draigBrady.com> Date: Mon, 4 Mar 2024 20:35:03 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig?= Brady References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> In-Reply-To: <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) 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: -0.8 (/) On 04/03/2024 15:47, Pádraig Brady wrote: > On 04/03/2024 00:44, Paul Eggert wrote: >> Although I like the idea of exposing file swaps to the user, the first >> cut of 'mv -x' has significant problems. >> >> I expect 'mv -x A B' to act like 'mv A B' except the destination must >> exist and is renamed back to A. However, this is not true for 'mv -x A >> B' when B is a directory; it renames B to A rather than renaming B/A to >> A as I expect. That is, 'mv -x' acts as if -T (--no-target-directory) is >> also specified. There is no way to get mv's traditional behavior, or to >> get mv -t behavior. >> >> To fix this, 'mv -x' should respect the usual mv behavior with respect >> to directories. For example, when D is a directory 'mv -x A B C D' >> should act like 'mv A B C D' except that D's old entries should be >> renamed back to A B and C. And the -t and -T options should work with -x >> the same way they work when -x is not specified. >> >> This needs to happen before the next coreutils release, to avoid >> confusion about 'mv -x'. > > So you're saying the current mv -x behavior should only be with -T explicitly specified. > With the current implementation, we should at least document that -x implies -T. > > By changing as you suggest, we'd not be adding any significant functionality, > but potentially reducing confusion by following mv traditional arg handling. > I agree with you I think, but not strongly. > > It's worth stating though that if users want to swap 2 directories > they'd have to `mv -Tx d1 d2`, which may also be a little confusing. > > The use case we don't currently support directly is: > cd source_dir && mv -x * "$dest_dir" > Instead that currently requires: > for f in *; do mv -x "$f" "$dest_dir"; done > > For completeness, stating disadvantages of pulling this use case within mv, > is that by requiring the for loop for this would allow users > to programatically determine which swap failed, and I see --swap > as primarily a programatic interface used by scripts. > Also if we made this change, We'd have to document that `mv -x 1 2 ... d` > was not atomic over the whole set. > > I will look at making the change before the upcoming release. Another point worth mentioning before changing this, is that changing would make the --swap operation non symmetric. I.e. `mv -x a d` would be different to `mv -x d a` where d in a directory. cheers, Pádraig p.s. Re dir swapping I noticed that specifying '/' or '.' dirs always gives EBUSY: $ mv -x . . mv: swap of '.' and '.' failed: Device or resource busy From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 00:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Petr Malat , P??draig Brady Cc: 69532@debbugs.gnu.org Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170959736826622 (code B ref 69532); Tue, 05 Mar 2024 00:10:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 00:09:28 +0000 Received: from localhost ([127.0.0.1]:45371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhIMr-0006v2-0o for submit@debbugs.gnu.org; Mon, 04 Mar 2024 19:09:28 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:51436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhIMm-0006uj-9Z for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 19:09:11 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5D6453C00E413; Mon, 4 Mar 2024 16:08:32 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id pcHyn_myyAnV; Mon, 4 Mar 2024 16:08:32 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 16F983C00E414; Mon, 4 Mar 2024 16:08:32 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 16F983C00E414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1709597312; bh=jYYLShyIYEHGcdBPZ1txsgKOSyV2wOyZ2JeryDg0a6w=; h=Message-ID:Date:MIME-Version:To:From; b=LZqDccPvrqQWSOB+Sznrrv07MN5/W3jSoRXGtir3zYuxQwilSAe8hJKk+zieskyXz VZhTGmMCa/DKE2jCDBN+dnQL7AZgJLhzFqNIt/2RksIeKD1xP0fLRzOQPCgowgsSZ0 r5Gmbox4EuEPpcsSX5btewrAvI0yDpEROS00AUyX/uTiCgJSCbU9VgfBWbPEsyfIwU kdbeWFPsChKl5tzdAW7CZQ8LSWyD/++YcMwFF6sO0FDnjGi8wxBomN90mmhDo2Iwt/ DierfukK2vl4Pg4Rp4F1n8BcWVQtN9Tgb7hG9qDrMKpb1/yy7OukusNUyl6r0/QNRW 1He3E5w/CtxgA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id QtkvwtTF42wM; Mon, 4 Mar 2024 16:08:32 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id E2C4C3C00E413; Mon, 4 Mar 2024 16:08:31 -0800 (PST) Message-ID: <00d33599-e700-435d-b563-c75b10101bc4@cs.ucla.edu> Date: Mon, 4 Mar 2024 16:08:30 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <093225e0-e04c-29e8-7245-ca2b12a710e0@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/4/24 15:16, Petr Malat wrote: > I prefer KISS principle and allowing > swapping just 2 paths. In that case, the option should be added to the 'rename' command, not to 'mv'. It is not KISS to add an option to 'mv' that makes it act completely differently, such that most of mv's other options don't work or don't make sense. That would be complexity, not simplicity. If you want simplicity, use the 'rename' command. From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 00:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Petr Malat Cc: 69532@debbugs.gnu.org Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170959830728025 (code B ref 69532); Tue, 05 Mar 2024 00:26:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 00:25:07 +0000 Received: from localhost ([127.0.0.1]:45377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhIcF-0007Hx-FL for submit@debbugs.gnu.org; Mon, 04 Mar 2024 19:25:07 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:58616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhIcC-0007HO-1q for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 19:25:05 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 1407D3C00E413; Mon, 4 Mar 2024 16:24:28 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id dXvRT4kIzPcG; Mon, 4 Mar 2024 16:24:27 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9DBA63C00E414; Mon, 4 Mar 2024 16:24:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 9DBA63C00E414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1709598267; bh=spuo2+QaxITNS0xFwWdPNsHhr944FQI09iQwNuBJUlQ=; h=Message-ID:Date:MIME-Version:To:From; b=DuP0Th1EF33LnrU/no6UsPtWuXWKXA+NC6U14Lw2DkFSYe1rE/O1zFf8qRa/PHKYo T4H3FQF0wH41ghTMPZUe+YtitgYuJv4r20gXvwA1DGFWXtpIwuiT6QVxe92jBIVKnv pH7EXkYJPIXCoZFwANC9tG18kZgaDDH5yP2e+F9mMVHGWIrcLRR1bQB2he+vetKlA7 YkbN1j0oW242lYFAzKSkkm2/h9XzAPvf4XdewJPOlReWPrB+LjkciUgCnBwVpmRYH4 JVx9QnbZeH49m0qfnGL+CsI53++TgfMkwV0DYGXz9zwaB/NuZvF4jrXV+dk2Qnxw/4 LCT03jNPBilCQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id XuDzZoABjftb; Mon, 4 Mar 2024 16:24:27 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 8727B3C00E413; Mon, 4 Mar 2024 16:24:27 -0800 (PST) Message-ID: <2c23f300-d4f9-472d-9054-c83d89c9d73a@cs.ucla.edu> Date: Mon, 4 Mar 2024 16:24:27 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/4/24 15:37, Petr Malat wrote: > Why do you expect this? I expect it because mv has always treated destination directories that way. This has been true since the 1970s. We should not change this basic mode of operation. >> To fix this, 'mv -x' should respect the usual mv behavior with respect to >> directories. For example, when D is a directory 'mv -x A B C D' should act >> like 'mv A B C D' except that D's old entries should be renamed back to A B >> and C. And the -t and -T options should work with -x the same way they work >> when -x is not specified. > > I do not think this is a good idea, because that operation is not > atomic. There's nothing wrong with 'mv -x a b c d/' being nonatomic. "mv a b c d/" is not atomic either, and that's fine too. > Probably, the user wants to prepare a temporary directory > instead and then atomically swap it with the directory in use. This usage was not at all obvious to me. If it's the intended use, I suggest inventing a new command, or adding -x to the 'rename' command instead. Pushing this flag onto 'mv', without making the flag reasonably orthogonal to mv's other options, would be a mistake because it would cause too much confusion. > Supporting swap for more than 2 files also brings a problem, when > the operation fails as then one doesn't know what has been swapped > and what not. I don't see why not. The user can look at mv's diagnostics. It's the same as regular "mv a b c d/". From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 04:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Dominique Martinet , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 69532@debbugs.gnu.org, Petr Malat , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170961187917526 (code B ref 69532); Tue, 05 Mar 2024 04:12:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 04:11:19 +0000 Received: from localhost ([127.0.0.1]:45621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhM99-0004Yb-5Z for submit@debbugs.gnu.org; Mon, 04 Mar 2024 23:11:19 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:44458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhM93-0004YL-Sb for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 23:11:18 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id CCFDD3C011BD4; Mon, 4 Mar 2024 20:10:37 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id arv_C1FjYlAn; Mon, 4 Mar 2024 20:10:37 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 7C5393C00E415; Mon, 4 Mar 2024 20:10:37 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 7C5393C00E415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1709611837; bh=uJxqh0aQDcE1WH50t2J7PxnGUlz9WTZyFhEDqts6iWI=; h=Message-ID:Date:MIME-Version:To:From; b=WmtDYy7DvJ4x5Mkim1FuFR8aG5lDYK/ntzDqby7wH/ScECpEoY0eKweKlkN856dA1 8E8gUButoSmDdQQUMQPbse1TQwf0DnrF+iydFNDLjS6aXXhrQ3eqtgRDtbMlwZNPvu /10StykAzziicZgi2PhUVdi0YrgAErXRulkdDgKHLxKTrHN31BIHrENzIKePcqgXdV GBUukafUnPOHPu5x0Nis3kl3B6m/uxTtncjbTJYQv3msCrOx+M3qlhOqrBPUYDj25u aAdzX3mXj74tyDbwVIO58GZA+tq8hXjKXrrYdxfXRqNwU4oTt6YO2PTySspx8VErl6 o9w/UG+PJ04QQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id f1JI78br6MI6; Mon, 4 Mar 2024 20:10:37 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 4BCB23C011BD4; Mon, 4 Mar 2024 20:10:37 -0800 (PST) Message-ID: <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> Date: Mon, 4 Mar 2024 20:10:35 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/4/24 16:43, Dominique Martinet wrote: > Adding Rob to the loop because this impacts compatibility with > toybox/maybe busybox implementations Busybox does not use RENAME_EXCHANGE, so this isn't a Busybox issue. Toybox mv added -x to its development version yesterday: https://github.com/landley/toybox/commit/a2419ad52d489bf1a84a9f3aa73afb351642c765 so there's little prior art there, and there's still plenty of time to fix its problems before exposing it to the world. > I also see --swap mostly used by scripts and this actually feels a bit > dangerous to me -- I'd *always* use this with -T. Yes, it's a problem. By "see --swap mostly used by scripts" I assume you mean scripts that haven't been written yet, assuming that nobody had -x until yesterday.... > (by the way, what's this "rename" command you speak of? https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ Now that I've looked into it further, util-linux already has an "exch" command that does exactly what you want. This is the command that toybox should implement rather than try to simulate it with "mv -x" (which causes all sorts of problems). That is, toybox should revert yesterday's change to "mv", and should implement "exch" instead. From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 04:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady , 69532@debbugs.gnu.org Cc: Petr Malat Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170961334220430 (code B ref 69532); Tue, 05 Mar 2024 04:36:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 04:35:42 +0000 Received: from localhost ([127.0.0.1]:45632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhMWk-0005JS-5M for submit@debbugs.gnu.org; Mon, 04 Mar 2024 23:35:42 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:54456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhMWf-0005Iw-Ev for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 23:35:40 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9A0253C011BD4; Mon, 4 Mar 2024 20:35:01 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id Q36tQYCQDrn1; Mon, 4 Mar 2024 20:35:01 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5430B3C011BD9; Mon, 4 Mar 2024 20:35:01 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 5430B3C011BD9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1709613301; bh=DLZEYuWTnI5bwkWahg1IpWGBx5ohyneJ52JA6C/swo4=; h=Message-ID:Date:MIME-Version:To:From; b=QvmXzLdusquPbNY9ejQfEahkyso1YnA4EaV4xlgzllmDJwyMzWtH3zZHC/I3wosPw y2cGYFEVospjE/eZoeo/6slzatZMkeamGu7oqRVtzNe5/60wwm9yc8BQUyVn1q5lSP vOQ3nvrWC9dQMhei7S7XJAqBp9k5GlgP17Yn5xzW+slTpdAn0SN7j65iqHAtuChivL h1mdJP+HsynifVWaVg+ZMV/eFmh+kowvTp1ffeU6tddXnpGHhKeFvZqexHCmiwas8R FqorCL5tZG0ViRSvAqBfSCONe+X/aK+esk3Eg9V0QBt0vWM6zUA3paAZQAH2meenta 60Ti812ajd+bA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id MMyBqzlum-dm; Mon, 4 Mar 2024 20:35:01 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 362103C011BD4; Mon, 4 Mar 2024 20:35:01 -0800 (PST) Message-ID: Date: Mon, 4 Mar 2024 20:35:00 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <093225e0-e04c-29e8-7245-ca2b12a710e0@draigBrady.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <093225e0-e04c-29e8-7245-ca2b12a710e0@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/4/24 12:35, P=C3=A1draig Brady wrote: > Another point worth mentioning before changing this, > is that changing would make the --swap operation non symmetric. > I.e. `mv -x a d` would be different to `mv -x d a` where d in a directo= ry. Yes, of course. It's just like mv without the -x. After you've done an=20 'mv a b', 'mv b a' will undo the rename, unless b is a directory. I realize this business of the destination being a directory is a=20 hassle. That's why I put in mv's -t and -T options years ago. But at=20 this point it's such a well-known hassle that we really gotta stay=20 consistent with it if we add options. The "exch" shell command (in util-linux) is a different matter, as it=20 has never had the target-directory hassle (i.e., it has always assumed -T= ). In looking into this a bit more, I see a bunch of other gotchas. For=20 example, 'mv -b' does not work with 'mv -x'. A bunch of other mv options=20 also don't work with 'mv -x'. It's a real mess as-is and we can't ship=20 it this way. From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Petr Malat Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 05:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 69532@debbugs.gnu.org X-Debbugs-Original-Cc: Coreutils bugs Received: via spool by submit@debbugs.gnu.org id=B.170961682029111 (code B ref -1); Tue, 05 Mar 2024 05:34:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Mar 2024 05:33:40 +0000 Received: from localhost ([127.0.0.1]:45683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhNQp-0007ZL-JP for submit@debbugs.gnu.org; Tue, 05 Mar 2024 00:33:40 -0500 Received: from lists.gnu.org ([209.51.188.17]:57646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhHt1-00063b-QK for submit@debbugs.gnu.org; Mon, 04 Mar 2024 18:38:27 -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 ) id 1rhHsX-0000Or-Jb for bug-coreutils@gnu.org; Mon, 04 Mar 2024 18:37:53 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhHsT-0000WZ-Sh for bug-coreutils@gnu.org; Mon, 04 Mar 2024 18:37:52 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-565b434f90aso7291982a12.3 for ; Mon, 04 Mar 2024 15:37:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=malat-biz.20230601.gappssmtp.com; s=20230601; t=1709595466; x=1710200266; darn=gnu.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=M3MI4Rk1v7AfCGlCHk76yiwZ5iZxT0HNXt05KDvaY0o=; b=tgbWRUnxk8HHhSWbV8EUd+Wuq4oquUwX6NMc9itn/hpiH2IYD2GIRP09a6B79dJqRB uGF8QwPKpiGCpLgGJNebbdsX2bN0T0B1c11GV0BWrLeBFgtCWUK27Lz54O0D3DJA2yKg DSHJ9vS6CvhpvOWJe/J/wvhR7tNr99WEr180SYFzGiQltWRa38iog9ptochSHLRUQ/XD 2fKGAx+zvfzp7UwRLoSpvaiNOeBYk/bj2pZIlvUgjhHC4DRKtVKWyaWRIHaQMtWCTAgh SHKagAskl2oWnR7mguq9GaRq9/BGINx26/rOiAqVuo5P63bOUXN3usz7bMHEpoGI7mab FuPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709595466; x=1710200266; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=M3MI4Rk1v7AfCGlCHk76yiwZ5iZxT0HNXt05KDvaY0o=; b=QmjJUjIy9x+TnlgC22leklh/eaJc7S/3FURMBnFkBwXVviX7DySWznLJL6iVTQS80o a7rqLDR4fFJZBa+nat5P45WUWR7vvqsQwCS2v61ILd5ZplPhbUeD9hdPxwbXv8FqehSI XkThRY9daXDZpcRvIlwHvv8tDtN9S6psxXAwJABAGQQNKLdX8Sj6XJoqJnyoOFEU5rAq bghz/ZueUfB+u7yJEQSNuNp7Nw7CFKQz1C+TajLwWiAfKGAgMUNqVbEB4iFGuQ9zqhjE loFG23CTceaco0CAasZ5q1Bxxua3dmVHIR6TJTOYmsrgsSaMnqS8by9Wpplf7E6JUpNE D2bQ== X-Gm-Message-State: AOJu0YxOLWPRh5FNhfQ4UlJhCczCbazXkZ+SoBf58o+/Otm+2knvPBE8 WDnkjNEOqvhmmJpcZ8X9Ibh4psSdwT2nUPOW36C8GW+IcIN4aqFtSuug3dFTaQ== X-Google-Smtp-Source: AGHT+IGTa/mLlw3PVH5dHK58/nulTPZEy/p51lmA+eyB8Zx6XPwqB6/RUQuNwc1LoPcW3mv0krZK1g== X-Received: by 2002:a17:906:3c4f:b0:a3f:c4f9:eb16 with SMTP id i15-20020a1709063c4f00b00a3fc4f9eb16mr7378339ejg.20.1709595466330; Mon, 04 Mar 2024 15:37:46 -0800 (PST) Received: from ntb.petris.klfree.czf (snat2.klfree.cz. [81.201.48.25]) by smtp.gmail.com with ESMTPSA id ef17-20020a17090697d100b00a446b6d3f80sm4673052ejb.204.2024.03.04.15.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 15:37:45 -0800 (PST) Date: Tue, 5 Mar 2024 00:37:44 +0100 From: Petr Malat Message-ID: References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> Received-SPF: none client-ip=2a00:1450:4864:20::535; envelope-from=oss@malat.biz; helo=mail-ed1-x535.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Mailman-Approved-At: Tue, 05 Mar 2024 00:33:35 -0500 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: -3.3 (---) Hi Paul, On Sun, Mar 03, 2024 at 04:44:52PM -0800, Paul Eggert wrote: > Although I like the idea of exposing file swaps to the user, the first cut > of 'mv -x' has significant problems. > > I expect 'mv -x A B' to act like 'mv A B' except the destination must exist > and is renamed back to A. However, this is not true for 'mv -x A B' when B > is a directory; it renames B to A rather than renaming B/A to A as I expect. > That is, 'mv -x' acts as if -T (--no-target-directory) is also specified. > There is no way to get mv's traditional behavior, or to get mv -t behavior. Why do you expect this? If the description in the help output was not clear enough we can improve it by mentioning it implies -T. > To fix this, 'mv -x' should respect the usual mv behavior with respect to > directories. For example, when D is a directory 'mv -x A B C D' should act > like 'mv A B C D' except that D's old entries should be renamed back to A B > and C. And the -t and -T options should work with -x the same way they work > when -x is not specified. I do not think this is a good idea, because that operation is not atomic. Probably, the user wants to prepare a temporary directory instead and then atomically swap it with the directory in use. The main motivation for this option is not to preserve old files, but to be able to atomically replace one file with another. If one needs to preserve replaced files, he can use the backup option. Supporting swap for more than 2 files also brings a problem, when the operation fails as then one doesn't know what has been swapped and what not. With plain mv one knows the file was moved if the original location is unlinked. BR, Petr From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Petr Malat Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 05:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: P??draig Brady Cc: 69532@debbugs.gnu.org, Paul Eggert Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170961681929102 (code B ref 69532); Tue, 05 Mar 2024 05:34:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 05:33:39 +0000 Received: from localhost ([127.0.0.1]:45681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhNQn-0007ZE-W7 for submit@debbugs.gnu.org; Tue, 05 Mar 2024 00:33:39 -0500 Received: from mail-ej1-f42.google.com ([209.85.218.42]:60780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhHZd-0005UY-5Z for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 18:18:22 -0500 Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a3566c0309fso9261366b.1 for <69532@debbugs.gnu.org>; Mon, 04 Mar 2024 15:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=malat-biz.20230601.gappssmtp.com; s=20230601; t=1709594205; x=1710199005; darn=debbugs.gnu.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eps40x5ltpcadrpArczw+Tpg+7IAKx3m+Y9awFR+6dc=; b=Akr0JT5XpQcGaUTNU3WL/Vygg3vTL0DE9IJa9QMMt1ZGTu9B9/nKkqDBVjGesi3ymy qeI/N9qEJwxHYylIUWGLqjPferacSCuf+dwX4uz96Q5sY5femn7ZWNMiTZsQSokFku0n sbRNEGMxQtOfIfNcQjA9mZPg3gv5GbPI8RfJV9UnvnV8N8VJhaGZKg+v/7PDNGFB+L4Y NrrRCs8isCulYDdKHGgCOjRJ6VCp3uyLi71OC2CMEyEYW+tcQl47vMyWL4WcwQuM6BfZ wheC6Xw+uu/v+bKqEUGv8/6h5r1g8gasaOjUcUk08nx4NbZVjiwVyuBZI20hdMDL4FIH MbmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709594205; x=1710199005; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eps40x5ltpcadrpArczw+Tpg+7IAKx3m+Y9awFR+6dc=; b=LRPt0L3wc1+Xvr7r4Nhq54F7GaCZy5W+5FUIHKpb9IcS6qKuA6SC5XInEeWfxl9e07 s5mMkAAkXskQCNAZz+PQ5/pnzF3cjiq0r6DrikhWpMEjl3JSHA8nq4jPv+lcAnZc+7xm FstQtKPwd++82aUwKtRfx6He1R5G3qXQ2DQoBFdLrXmmCMGRdIjrfmd/jV6n1OYMDGpP xSUDQNMaCcuxdpVEpslLGKuILWDsgHamAeAYeMnevXc3CjELvP5wp9wWs8q6KpFSwSrx o4Rrco7VOWiG7eoaCp+RSo5jj4k8AXc9jPpvQSxSHex/UaRbsVNG84fZ/0XQsvgRTx+y RgTg== X-Forwarded-Encrypted: i=1; AJvYcCXixc/nJLWQgi5Ohj/IaftlTUJYvB6VzSjQbmroLI4+zAYvy/m+4db/3FAiluyUA322uD5y03GyZDD6zFS8b80tJxQWD5Y= X-Gm-Message-State: AOJu0YxM97ImbQLw/Hm1RkSGTXIGv2VpONk5E91u1KorFewSb4VbBWdC n2KZoLL+QXmajcC18fqu5ljCTH8Oy2NQAVS5SdM14ipVlfhbNoLE9IwTYsQ0OQ== X-Google-Smtp-Source: AGHT+IGI4rRB5FGnEeICrpb49h3O4jVNrUGaZQc3BN7GEq/LBnBQy9GLyml2AxoxxcG0NN1DoSYXcw== X-Received: by 2002:a17:906:b806:b0:a45:1fe5:10b7 with SMTP id dv6-20020a170906b80600b00a451fe510b7mr3476375ejb.43.1709594204423; Mon, 04 Mar 2024 15:16:44 -0800 (PST) Received: from ntb.petris.klfree.czf (snat2.klfree.cz. [81.201.48.25]) by smtp.gmail.com with ESMTPSA id r2-20020a170906c28200b00a412d3d509fsm5400337ejz.181.2024.03.04.15.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 15:16:43 -0800 (PST) Date: Tue, 5 Mar 2024 00:16:36 +0100 From: Petr Malat Message-ID: References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <093225e0-e04c-29e8-7245-ca2b12a710e0@draigBrady.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <093225e0-e04c-29e8-7245-ca2b12a710e0@draigBrady.com> X-Spam-Score: -0.0 (/) X-Mailman-Approved-At: Tue, 05 Mar 2024 00:33:35 -0500 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: -1.0 (-) On Mon, Mar 04, 2024 at 08:35:03PM +0000, P??draig Brady wrote: > On 04/03/2024 15:47, P??draig Brady wrote: > > On 04/03/2024 00:44, Paul Eggert wrote: > > > Although I like the idea of exposing file swaps to the user, the first > > > cut of 'mv -x' has significant problems. > > > > > > I expect 'mv -x A B' to act like 'mv A B' except the destination must > > > exist and is renamed back to A. However, this is not true for 'mv -x A > > > B' when B is a directory; it renames B to A rather than renaming B/A to > > > A as I expect. That is, 'mv -x' acts as if -T (--no-target-directory) is > > > also specified. There is no way to get mv's traditional behavior, or to > > > get mv -t behavior. > > > > > > To fix this, 'mv -x' should respect the usual mv behavior with respect > > > to directories. For example, when D is a directory 'mv -x A B C D' > > > should act like 'mv A B C D' except that D's old entries should be > > > renamed back to A B and C. And the -t and -T options should work with -x > > > the same way they work when -x is not specified. > > > > > > This needs to happen before the next coreutils release, to avoid > > > confusion about 'mv -x'. > > > > So you're saying the current mv -x behavior should only be with -T explicitly specified. > > With the current implementation, we should at least document that -x implies -T. > > > > By changing as you suggest, we'd not be adding any significant functionality, > > but potentially reducing confusion by following mv traditional arg handling. > > I agree with you I think, but not strongly. > > > > It's worth stating though that if users want to swap 2 directories > > they'd have to `mv -Tx d1 d2`, which may also be a little confusing. > > > > The use case we don't currently support directly is: > > cd source_dir && mv -x * "$dest_dir" > > Instead that currently requires: > > for f in *; do mv -x "$f" "$dest_dir"; done > > > > For completeness, stating disadvantages of pulling this use case within mv, > > is that by requiring the for loop for this would allow users > > to programatically determine which swap failed, and I see --swap > > as primarily a programatic interface used by scripts. > > Also if we made this change, We'd have to document that `mv -x 1 2 ... d` > > was not atomic over the whole set. I do not think this would be ever needed in a real life. It's more likely one actually wants something like this: mkdir d.tmp ln -s -t d.tmp d/* # Modify d.tmp as needed (without propagating changes to d) mv --swap d d.tmp > > I will look at making the change before the upcoming release. > > Another point worth mentioning before changing this, > is that changing would make the --swap operation non symmetric. > I.e. `mv -x a d` would be different to `mv -x d a` where d in a directory. I think this would lead to bugs. I prefer KISS principle and allowing swapping just 2 paths. Explicitly mentioning -x automatically implies -t may be added to the documentation. In general, I do not think there is any need to make mv -x behave similar to plain mv. It's normal an option changes behavior, at the end -t does the same. > p.s. Re dir swapping I noticed that specifying '/' or '.' dirs always gives EBUSY: > $ mv -x . . > mv: swap of '.' and '.' failed: Device or resource busy That's because it's CWD of mv and your shell. Petr From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Dominique Martinet Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 05:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 69532@debbugs.gnu.org, Petr Malat , Paul Eggert , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170961682529147 (code B ref 69532); Tue, 05 Mar 2024 05:34:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 05:33:45 +0000 Received: from localhost ([127.0.0.1]:45691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhNQu-0007a1-Pk for submit@debbugs.gnu.org; Tue, 05 Mar 2024 00:33:45 -0500 Received: from nautica.notk.org ([91.121.71.147]:54816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhIvn-0007li-E1 for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 19:45:22 -0500 Received: by nautica.notk.org (Postfix, from userid 108) id 46AEDC01B; Tue, 5 Mar 2024 01:44:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1709599458; bh=K14utciFSt7vAVPGlU9mB4CZhBJaaeI3Bv5GkTK9XtU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c3jZxUWHepvBiP5lCqLCUJTVayqGhn4eNU3S41bN1isTqTd5CdOegQSgvJfiG/uDN usAjMhSnQpTevVHVPI3aGcdLovPQl74J4+mwrQ93kMUuQEVB/kMCN+wGJYJelhsCtA ByiRc8BpTnN6QqMeG34+PFqg2wdIDbZ4eW3nC78ymcbT1EY/vnMDphDebDNypTS+aR gKnjf4gr5jm8aoQfFi5hRVSHrLMlQVzu41PAW0e+NYhCtamcObVC4YgonXUdA0zAnC vCwyCc6i0fBrqS5bEBc8SW984cOJR2xesE50wIFZGJYQvwgLI/454xs5SfCgcaFPci 5X8XurkQgnUGA== X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on nautica.notk.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 Received: from gaia.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id E9EA8C009; Tue, 5 Mar 2024 01:44:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1709599457; bh=K14utciFSt7vAVPGlU9mB4CZhBJaaeI3Bv5GkTK9XtU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QaW6PKLDnbngfGMVkyMVQ5FD1kkabsJxzY0r+422Xv+v4Pz+/KZ40qtk37pAZwExo iBqXd2SlKpXotqYnF4Uf/JQ5Opz83WvYTh1aRGd4y5ZE3xuFZ/Hs4sOj+JYcvFgyp1 DSPHU+muaoheuwQScbT+ic82kBIJ9bM+OHtaefmOCgaaHET12/afvBgIesbir4We34 BcmOVjrASSneFIIyTl41A46YZdawBSRQQMOML8YfuPtljA25gyvzAOrCuRGPfhOAJf Ek5rMRK7P7aZGNYB6RYVRl8j2vpB7pj6Q8IVQG7OIBhMZ9Dv84YsGgl+qBt6sncSQt E/nVQ/6qC5dsw== Received: from localhost (gaia.codewreck.org [local]) by gaia.codewreck.org (OpenSMTPD) with ESMTPA id f4f33e21; Tue, 5 Mar 2024 00:44:11 +0000 (UTC) Date: Tue, 5 Mar 2024 09:43:56 +0900 From: Dominique Martinet Message-ID: References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> X-Spam-Score: -0.0 (/) X-Mailman-Approved-At: Tue, 05 Mar 2024 00:33:35 -0500 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: -1.0 (-) Adding Rob to the loop because this impacts compatibility with toybox/maybe busybox implementations (Quoting in full for convenience, there's a few more mails in https://lists.nongnu.org/archive/html/bug-coreutils/2024-03/msg00002.html but we seem to be missing Petr's reply) Pádraig Brady wrote on Mon, Mar 04, 2024 at 03:47:23PM +0000: > On 04/03/2024 00:44, Paul Eggert wrote: > > Although I like the idea of exposing file swaps to the user, the first > > cut of 'mv -x' has significant problems. > > > > I expect 'mv -x A B' to act like 'mv A B' except the destination must > > exist and is renamed back to A. However, this is not true for 'mv -x A > > B' when B is a directory; it renames B to A rather than renaming B/A to > > A as I expect. That is, 'mv -x' acts as if -T (--no-target-directory) is > > also specified. There is no way to get mv's traditional behavior, or to > > get mv -t behavior. > > > > To fix this, 'mv -x' should respect the usual mv behavior with respect > > to directories. For example, when D is a directory 'mv -x A B C D' > > should act like 'mv A B C D' except that D's old entries should be > > renamed back to A B and C. And the -t and -T options should work with -x > > the same way they work when -x is not specified. > > > > This needs to happen before the next coreutils release, to avoid > > confusion about 'mv -x'. > > So you're saying the current mv -x behavior should only be with -T explicitly specified. > With the current implementation, we should at least document that -x implies -T. > > By changing as you suggest, we'd not be adding any significant functionality, > but potentially reducing confusion by following mv traditional arg handling. > I agree with you I think, but not strongly. > > It's worth stating though that if users want to swap 2 directories > they'd have to `mv -Tx d1 d2`, which may also be a little confusing. > > The use case we don't currently support directly is: > cd source_dir && mv -x * "$dest_dir" > Instead that currently requires: > for f in *; do mv -x "$f" "$dest_dir"; done > > For completeness, stating disadvantages of pulling this use case within mv, > is that by requiring the for loop for this would allow users > to programatically determine which swap failed, and I see --swap > as primarily a programatic interface used by scripts. I also see --swap mostly used by scripts and this actually feels a bit dangerous to me -- I'd *always* use this with -T. The point of --swap is that it's safe to use concurrently or when something else might happen in parallel, but if you behave differently when something else places a directory that'll likely lead to weird script failures at some point. I also find it a bit weird that `mv --swap a b` is different from `mv --swap b a` -- this is normal for mv without --swap, but swap kinds of changes my expectation of mv... I agree with Petr's reply that operating on arguments directly is simpler to reason about, especially in the context of scripts. (by the way, what's this "rename" command you speak of? I know of a few different implementations that often get placed as "rename" in $PATH but I'm not aware of any such command that'd be installed on most systems) > Also if we made this change, We'd have to document that `mv -x 1 2 ... d` > was not atomic over the whole set. > > I will look at making the change before the upcoming release. Thanks, -- Dominique Martinet | Asmadeus From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Rob Landley Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 05:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Dominique Martinet , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 69532@debbugs.gnu.org, Petr Malat , Paul Eggert Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170961682629156 (code B ref 69532); Tue, 05 Mar 2024 05:34:03 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 05:33:46 +0000 Received: from localhost ([127.0.0.1]:45693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhNQv-0007aA-PG for submit@debbugs.gnu.org; Tue, 05 Mar 2024 00:33:46 -0500 Received: from mail-oo1-f66.google.com ([209.85.161.66]:44266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhKMs-0001iD-1t for 69532@debbugs.gnu.org; Mon, 04 Mar 2024 21:17:26 -0500 Received: by mail-oo1-f66.google.com with SMTP id 006d021491bc7-5a122beaa1dso1278520eaf.0 for <69532@debbugs.gnu.org>; Mon, 04 Mar 2024 18:16:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=landley-net.20230601.gappssmtp.com; s=20230601; t=1709604946; x=1710209746; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Xn57vLHdzxlAEse7vvB8Xl0HjT1fII3kR3FplukSgRc=; b=2uCRMiqU6GP4t8wdkUjQcv0H10UrhKZugX0e2a6nAYSKhMt1tmo6HWtftHcuuz8NR0 zQgFGrtMPCpgB6Q+YbUCqKQpyxf92DdHjY+d6+pBLMhgpLoFr//MHTPqLLYCau1BDWGR EWLzn+GKb1mkueKe5pc8ZC+x51ES3CG9iu/Jwx5eo+nAuCvhIAtWIBJ7lf1ZwMP0VbFQ 6BeH9eEorD2fd5eCYHB7zw8OZsQD5RoXGIfPZLE4tM+cIdIfuvU0NMMjfV7FiCzeWlfZ 1XhrAd2piQMkJnyCMrqT8RRTLKKMG5QJGv8S6QV6As3dZaAgEgcJ8V9nmxf0SS9EV2yG PT8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709604946; x=1710209746; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Xn57vLHdzxlAEse7vvB8Xl0HjT1fII3kR3FplukSgRc=; b=QR7bURc25T+zQVWuTvlTUwSegThds5y3CPuHOFakW7BGPLY4vpuBN12p/Euuijgisg c4NuZgtVvWepj3WPVPPZTx7ilUFLGkmiBLM99KbiWqZOeNu94vDVk4pgx23xgozvO28M uwYZqvMsGf/zUksxlfqgEUniZh/tV3ha5/2aR71Z2eUmGs17kpIaokW5zRo9PFzF/mbw LExESFiUT2fRSuOuHbSvJvkVuARhM9Y/CADd3dUo1428d1S0CNxvJBfS1R/DFse79dcA P1XVBawvX8lChPYFt6eeOuWbyLRsAlUdUl/Nv/DafE29pPyP+p/E4cG0a+iJV2dtVbdP D1Kw== X-Forwarded-Encrypted: i=1; AJvYcCUkwxuu6wE9lToehl3BM4nsJEjP8WB1G6Pw3iiTP66xbftIEYRUr003ahwbNMtGJQ3hMLSxFVd7A3egvTbqkZlQSaZNLlY= X-Gm-Message-State: AOJu0YxIDkB+MCUkME7BTJvPDqo5eSTrEzo5ORZbRNFzRahCTREdw2o0 ICVvAZIbY7PNZJxI60+/DO5/VkkTzToerQ8yr5dImkE1XL15Kqrl0VewrwldJx4= X-Google-Smtp-Source: AGHT+IGCywhKz6MG1Z6zIqddsbN/FYdqO086+2TZ1f3cjW0EN2RgdxNmYMfvapwSPK9SgAY8rITD3g== X-Received: by 2002:a05:6820:16ac:b0:5a1:3af1:28c8 with SMTP id bc44-20020a05682016ac00b005a13af128c8mr695799oob.6.1709604946468; Mon, 04 Mar 2024 18:15:46 -0800 (PST) Received: from [192.168.1.4] ([136.62.51.249]) by smtp.gmail.com with ESMTPSA id ay38-20020a056820152600b005a0edf86a2esm729629oob.19.2024.03.04.18.15.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 18:15:46 -0800 (PST) Message-ID: Date: Mon, 4 Mar 2024 20:24:01 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> From: Rob Landley In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -3.3 (---) X-Mailman-Approved-At: Tue, 05 Mar 2024 00:33:35 -0500 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: -4.3 (----) On 3/4/24 18:43, Dominique Martinet wrote: > Adding Rob to the loop because this impacts compatibility with > toybox/maybe busybox implementations > (Quoting in full for convenience, there's a few more mails in > https://lists.nongnu.org/archive/html/bug-coreutils/2024-03/msg00002.html > but we seem to be missing Petr's reply) > > Pádraig Brady wrote on Mon, Mar 04, 2024 at 03:47:23PM +0000: >> On 04/03/2024 00:44, Paul Eggert wrote: >> > Although I like the idea of exposing file swaps to the user, the first >> > cut of 'mv -x' has significant problems. >> > >> > I expect 'mv -x A B' to act like 'mv A B' except the destination must >> > exist and is renamed back to A. However, this is not true for 'mv -x A >> > B' when B is a directory; it renames B to A rather than renaming B/A to >> > A as I expect. I don't expect that. I expect it to swap the two. I don't care if one is a directory and the other is a symlink or file or device node or what. I asked it to swap A and B. It did that. If I wanted to ask it to swap with B/A I could have said so. >> > That is, 'mv -x' acts as if -T (--no-target-directory) is >> > also specified. Then document that? >> Also if we made this change, We'd have to document that `mv -x 1 2 ... d` >> was not atomic over the whole set. Making the atomic exchange not be atomic kind of defeats the purpose... Rob From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Dominique Martinet Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 05:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 69532@debbugs.gnu.org, Petr Malat , =?UTF-8?Q?P=C3=A1draig?= Brady , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170961682729162 (code B ref 69532); Tue, 05 Mar 2024 05:34:03 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 05:33:47 +0000 Received: from localhost ([127.0.0.1]:45695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhNQw-0007aE-G9 for submit@debbugs.gnu.org; Tue, 05 Mar 2024 00:33:46 -0500 Received: from nautica.notk.org ([91.121.71.147]:37467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhN0Y-0006Yg-BS for 69532@debbugs.gnu.org; Tue, 05 Mar 2024 00:06:31 -0500 Received: by nautica.notk.org (Postfix, from userid 108) id BC2CDC01B; Tue, 5 Mar 2024 06:05:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1709615158; bh=UQT2xdHzDR1daELtb9w+f71uvejW10/Zli1rIxBIs4M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UfUGEs64xOetl+/7o47xkO7Di0pCWiBR9YKnDcYTcfEvP5L/GH3r9J5jfr804GnmP GubU2v7lZcQLo2h42BU8LOuCgqvnwOws8f4xj79edi+LUUuWvVZOh/nwLhAZ2YiBs3 VCAgtedNfsQ5krJQFTu7SjwMLAg8VKjyH9FweeOMYRwhvc0fhqdlxB9rRCCIv9bUqu l2D00QuTrSNYoI9mlzIVdl+ZpNmkJgVgyPKDVGZZvuV/LrvJLBJoimwsDX+XAwewe3 WSkUPW8R3C735BBxzhqWwOm6jtEy5N5SKQNbkcFH6ale0AEoZlp/ReFh8qqXc79nDM lrgturWQ4qqJQ== X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on nautica.notk.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 Received: from gaia.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id B8CFBC009; Tue, 5 Mar 2024 06:05:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1709615158; bh=UQT2xdHzDR1daELtb9w+f71uvejW10/Zli1rIxBIs4M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UfUGEs64xOetl+/7o47xkO7Di0pCWiBR9YKnDcYTcfEvP5L/GH3r9J5jfr804GnmP GubU2v7lZcQLo2h42BU8LOuCgqvnwOws8f4xj79edi+LUUuWvVZOh/nwLhAZ2YiBs3 VCAgtedNfsQ5krJQFTu7SjwMLAg8VKjyH9FweeOMYRwhvc0fhqdlxB9rRCCIv9bUqu l2D00QuTrSNYoI9mlzIVdl+ZpNmkJgVgyPKDVGZZvuV/LrvJLBJoimwsDX+XAwewe3 WSkUPW8R3C735BBxzhqWwOm6jtEy5N5SKQNbkcFH6ale0AEoZlp/ReFh8qqXc79nDM lrgturWQ4qqJQ== Received: from localhost (gaia.codewreck.org [local]) by gaia.codewreck.org (OpenSMTPD) with ESMTPA id 164c92bb; Tue, 5 Mar 2024 05:05:51 +0000 (UTC) Date: Tue, 5 Mar 2024 14:05:36 +0900 From: Dominique Martinet Message-ID: References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> X-Spam-Score: -0.0 (/) X-Mailman-Approved-At: Tue, 05 Mar 2024 00:33:35 -0500 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: -1.0 (-) Paul Eggert wrote on Mon, Mar 04, 2024 at 08:10:35PM -0800: > so there's little prior art there, and there's still plenty of time to fix > its problems before exposing it to the world. Yes, I just meant that everyone should agree, or there's little point in implementing these for toybox/busybox, which is why I added Rob to Ccs as I do not know if he's subscribed to the debbugs list. (for busybox, Rob sent a mail to the busybox list about the feature, someone should reply to that mail once this discussion has settled) > > I also see --swap mostly used by scripts and this actually feels a bit > > dangerous to me -- I'd *always* use this with -T. > > Yes, it's a problem. > > By "see --swap mostly used by scripts" I assume you mean scripts that > haven't been written yet, assuming that nobody had -x until yesterday.... I have scripts that use an alternate implementation (since I've sent my tentative patch two years ago); I will likely be updating them to use mv -x once that is available on the platform they're intended to run on. > > (by the way, what's this "rename" command you speak of? > > https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ Right, that's installed as rename.ul on debian because they've historically always had another rename command. It's not a command that can be relied on easily.... And I guess util-linux folks decided rename_exchange didn't belong there anyway given your next point: > Now that I've looked into it further, util-linux already has an "exch" > command that does exactly what you want. This is the command that toybox > should implement rather than try to simulate it with "mv -x" (which causes > all sorts of problems). eh, exch has been implemented last December and isn't part of any release yet either (although it is in v2.40-rc1 so it will be part of v2.40 shortly) I guess it's definitely simpler than whatever will happen to mv and would go as far as suggesting coreutils could also drop this implementation as well now there's an alternative, but I'll leave that up to you. ( And I really wish people would stop adding new commands all the time... This is bad both from a discoverability point of view (I look at the help/man pages of commands I know more often than I go through the list of new commands installed on my computer) and size (util-linux doesn't have a single binary mode and there's a lot of overhead - especially since binutils have been taking up 68KB per trivial binaries for a few releases now) But anyway these two points have nothing to do with coreutils, so I'll stop my rant here - thanks for noticing exch; I'll switch to lurking from now and decide on what to do with my scripts in another while. ) -- Dominique Martinet | Asmadeus From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Petr Malat Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 07:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 69532@debbugs.gnu.org Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.17096231739380 (code B ref 69532); Tue, 05 Mar 2024 07:20:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 07:19:33 +0000 Received: from localhost ([127.0.0.1]:45907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhP5J-0002RE-C8 for submit@debbugs.gnu.org; Tue, 05 Mar 2024 02:19:33 -0500 Received: from mail-ej1-f43.google.com ([209.85.218.43]:50477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhP5F-0002Qx-AO for 69532@debbugs.gnu.org; Tue, 05 Mar 2024 02:19:32 -0500 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a28a6cef709so855856866b.1 for <69532@debbugs.gnu.org>; Mon, 04 Mar 2024 23:18:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=malat-biz.20230601.gappssmtp.com; s=20230601; t=1709623073; x=1710227873; darn=debbugs.gnu.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eSVbuB44JVyWTt1HqiDw/wx/2XLupuhCo9K84UjqZX8=; b=i47juEDzXl+3KXEIikWj/dTH0evURCh5nLvQ2p6wb7DN4GBl9vILMZ55b2GAawNnvO s6eXd+zIWiPmiqui591MMNwPCLiJwziXbsOFhJtsun7gnVMhyOCYYTMCOb2Ror7jK0gb wvO6H3fsgY89ZfsBAlVTtbob0p2pnEYdlzZ1shYxrbbpvPmhGFGr/b8PHWGIzGRg7kY2 0UYnQ1RcpIGYh/im4x7+x2Ow5+sam9RUVx39O1kcdblsI8Cw954X6y46fH0cRelUpLeQ oG4q/Cd4vU16A/u4pkhmyRay6K44ofHKFK6u1pvWLlB0X/jyZbia7YIiwqwMNZya11/j AIvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709623073; x=1710227873; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eSVbuB44JVyWTt1HqiDw/wx/2XLupuhCo9K84UjqZX8=; b=tTfhkX9CdkJhF7vI8JVjzgnpXCa7RGlH19H3TpHva1hKoWsvXvVGAJBRXR01hX2FYN d69NWzj/O5U9J6+3DESu5wYOSZn7cJD+KGEIm7BHQGbXovB9oDBI2qZPKKGUl92OSGcy fVOVLAVwJ5w13GpWB215KtT2aS27dDR1C8mIIwFQZG0u/b85D6mYgGhmhtKOtC5dEr48 QzQhk7ddLlYPIgH7607af1w2MysZJtqqyCayqIt24Qkkp8vQ10wVSQOAAMSK3EApZNZR bk9RnP8ZyFbFCgFgV76XjaMHGrsKDXqOTHt9gxNKT7I5n0zL8KnWG3ajLyXwpzQLLxef 9/2A== X-Gm-Message-State: AOJu0Yzw/CpcSJPwqz0nHqQjr+No0iOM93aMJ4M7aJP3VGYDO9nsQobP tFwxpt9CtCnRJlduXWSPa58y/m6icfQJAMuCakFcZxqUVgMvlKKleBz91PXh0Q== X-Google-Smtp-Source: AGHT+IGOR5sUzEaaYwFvfQ02fznfXApWidd2tiBdoniPlJ2/6QsG59vHxhwYqWMG5sa9Od2BKYPrfg== X-Received: by 2002:a17:906:ff53:b0:a43:f9ff:2571 with SMTP id zo19-20020a170906ff5300b00a43f9ff2571mr7578873ejb.45.1709623073281; Mon, 04 Mar 2024 23:17:53 -0800 (PST) Received: from ntb.petris.klfree.czf (snat2.klfree.cz. [81.201.48.25]) by smtp.gmail.com with ESMTPSA id w11-20020a17090652cb00b00a44879da0f3sm4714583ejn.143.2024.03.04.23.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 23:17:52 -0800 (PST) Date: Tue, 5 Mar 2024 08:17:34 +0100 From: Petr Malat Message-ID: References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <2c23f300-d4f9-472d-9054-c83d89c9d73a@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c23f300-d4f9-472d-9054-c83d89c9d73a@cs.ucla.edu> X-Spam-Score: -0.0 (/) 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: -1.0 (-) On Mon, Mar 04, 2024 at 04:24:27PM -0800, Paul Eggert wrote: > On 3/4/24 15:37, Petr Malat wrote: > > Why do you expect this? > > I expect it because mv has always treated destination directories that way. > This has been true since the 1970s. We should not change this basic mode of > operation. But it doesn't behave like that when one uses -T, which is fine, because it's documented. > > > To fix this, 'mv -x' should respect the usual mv behavior with respect to > > > directories. For example, when D is a directory 'mv -x A B C D' should act > > > like 'mv A B C D' except that D's old entries should be renamed back to A B > > > and C. And the -t and -T options should work with -x the same way they work > > > when -x is not specified. > > > > I do not think this is a good idea, because that operation is not > > atomic. > > There's nothing wrong with 'mv -x a b c d/' being nonatomic. "mv a b c d/" > is not atomic either, and that's fine too. The swap option description explicitly says it's atomic and the atomicity was the only motivation for adding the new option. > > Probably, the user wants to prepare a temporary directory > > instead and then atomically swap it with the directory in use. > > This usage was not at all obvious to me. If it's the intended use, I suggest > inventing a new command, or adding -x to the 'rename' command instead. > Pushing this flag onto 'mv', without making the flag reasonably orthogonal > to mv's other options, would be a mistake because it would cause too much > confusion. The problem with a new command is that it's hard to find and rename seems worst fitting than mv, because its main purpose is to replace a pattern in a filename (e.g. change .JPG to .jpeg), so to "implement" mv A B with rename one has to do rename A B A Implementing atomic swap operation there doesn't seem logical to me, I would never look for such a feature there. On the other hand when I call mv A B, I'm generally interested in knowing if there is a time frame, when no version of B exists. > > Supporting swap for more than 2 files also brings a problem, when > > the operation fails as then one doesn't know what has been swapped > > and what not. > > I don't see why not. The user can look at mv's diagnostics. It's the same as > regular "mv a b c d/". I don't find parsing diagnostics reliable and in general, it's something I try to avoid in scripts. In a case I would do something like mv *.X d/, and mv would fail, I would rather iterate over *.X than parse the output to handle the error. Petr From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 14:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , Dominique Martinet Cc: 69532@debbugs.gnu.org, Petr Malat , util-linux , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170964826619141 (code B ref 69532); Tue, 05 Mar 2024 14:18:02 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 14:17:46 +0000 Received: from localhost ([127.0.0.1]:46994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhVc2-0004yf-DY for submit@debbugs.gnu.org; Tue, 05 Mar 2024 09:17:46 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:48258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhVbz-0004yQ-2E for 69532@debbugs.gnu.org; Tue, 05 Mar 2024 09:17:45 -0500 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-412eb6e15ceso6510625e9.0 for <69532@debbugs.gnu.org>; Tue, 05 Mar 2024 06:17:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709648167; x=1710252967; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=KzS2EnTgw+IwZH1NLDbGVvnlL7zrQcj5TIrlzpV+svk=; b=QNq2hK3ZzxFz3674HFcvzHDukYcz62wwowY5vWxHEXaEHU/3M6CHM5M0lqlzbRplU5 OXmF2ZlUR4CppFoftayfMj9pgO2aF05fSxOvYCY34XO3/oavVlAcQm6/P/qtrg3FimPN GCjdjRqYuSBZDNinPVPcK2Ol84Q2u8FgmxZcPLvJGNMO33v/JxkZe7ztyuyWkYoil5Q9 HtNk9jEu7ed1iPtKQQp58QSDCbM59CVYFPZejL7SZ17Sh4XIWcMnX9PlOQO6EPlJBswc DvcGAkNHKYDEW1IwMlqggnfsKxqPd8mCBnnzd2jPJAhRgEZiJpyaVgGtUOsMQ1dsH7/v DNJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709648167; x=1710252967; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KzS2EnTgw+IwZH1NLDbGVvnlL7zrQcj5TIrlzpV+svk=; b=TvDokkQ/UWdeJnobjKaD3kgD42GooFpT4rKTiEF3UE3fu7Finj0CMAP75JOvl7gDsL +iBL8ez/dluQ+Eq8t8sY8U+3Gmphbf4ZQ4v0dw/lop00tTeeeB138q6NEZpNX5xcFDRw XGs5qgUiQsA5dxxhj3QiLi4n+KMFmb3ScsLbF7YByQM7NeoRKZFeDa6R9FPibTT6GR2T EMlcMMe0M0kgjEhwnV8TXP8cLUU2UxwLDvxAz4l28aAtGNIDWw84eT3DBPQSE93jn3fB SPwww3m7xxEv9Kvg4g8/M/sNpvj2ni561aK/n/G6FNAyh2q1kqpLK4Itmgow8/YkB8+C Kp+Q== X-Gm-Message-State: AOJu0YwwyiEkOzKqSXZMbxCfXbxk/BCjbVzHIIyYr7h9BA+tE5KxJEYd O6CwToj8VjyARHyykcpmT0GYtRcckiVHOIPdW3PmdAq4AOENSCX5 X-Google-Smtp-Source: AGHT+IE1WGVaMzGYGbqSPRvc0w/Dm/JNeswI/pvz2G9qioKhz9rUZiUtP4GGKMdcLFpaYqRAhlyb+g== X-Received: by 2002:a05:600c:a50:b0:412:de0d:6a47 with SMTP id c16-20020a05600c0a5000b00412de0d6a47mr5212161wmq.18.1709648166650; Tue, 05 Mar 2024 06:16:06 -0800 (PST) Received: from [192.168.1.56] (86-40-129-3-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.40.129.3]) by smtp.googlemail.com with ESMTPSA id e18-20020adfef12000000b0033cf5094fcesm15047724wro.36.2024.03.05.06.16.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Mar 2024 06:16:06 -0800 (PST) Message-ID: <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> Date: Tue, 5 Mar 2024 14:16:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> From: =?UTF-8?Q?P=C3=A1draig?= Brady In-Reply-To: <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) 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: -0.8 (/) On 05/03/2024 04:10, Paul Eggert wrote: > On 3/4/24 16:43, Dominique Martinet wrote: >> Adding Rob to the loop because this impacts compatibility with >> toybox/maybe busybox implementations > > Busybox does not use RENAME_EXCHANGE, so this isn't a Busybox issue. > > Toybox mv added -x to its development version yesterday: > > https://github.com/landley/toybox/commit/a2419ad52d489bf1a84a9f3aa73afb351642c765 > > so there's little prior art there, and there's still plenty of time to > fix its problems before exposing it to the world. > > >> I also see --swap mostly used by scripts and this actually feels a bit >> dangerous to me -- I'd *always* use this with -T. > > Yes, it's a problem. > > By "see --swap mostly used by scripts" I assume you mean scripts that > haven't been written yet, assuming that nobody had -x until yesterday.... > > >> (by the way, what's this "rename" command you speak of? > > https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ > > Now that I've looked into it further, util-linux already has an "exch" > command that does exactly what you want. This is the command that toybox > should implement rather than try to simulate it with "mv -x" (which > causes all sorts of problems). > > That is, toybox should revert yesterday's change to "mv", and should > implement "exch" instead. I think having the functionality in mv(1) is better than in rename(1), but since exch(1) is already released that's probably the best place for this functionality now. A separate exch command may be overkill for just this, but perhaps related functionality might be added to that command in future. For e.g. some of the discussed functionality for a "replace" command might reside there. So I think I'll remove the as yet unreleased mv --swap from coreutils, given that util-linux is as widely available as coreutils on GNU/Linux platforms. cheers, Pádraig From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Karel Zak Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 20:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Paul Eggert , Dominique Martinet , 69532@debbugs.gnu.org, Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.170967130428190 (code B ref 69532); Tue, 05 Mar 2024 20:42:01 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 20:41:44 +0000 Received: from localhost ([127.0.0.1]:49133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhbbc-0007Kc-FR for submit@debbugs.gnu.org; Tue, 05 Mar 2024 15:41:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhbba-0007KT-9n for 69532@debbugs.gnu.org; Tue, 05 Mar 2024 15:41:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709671270; 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=SwfmyMzeF5yuvnX1WKO6Yck1Kh5ga5PJbO+QbYZZYk0=; b=IUuaQbEC6LHslrFK56A8jvSGYy5VORtkGaPxYfkerKsN+DoSKxhcNga4jh3dEuKMcqB6/H 67wMzkkohPAIVDKd6ueqykjjtw8oknlyFmk9XJ7hMuuaOXjexl2ySB6k5wZUtLCUie4nBv 4r4qVzTg+shotbPSIdYbd8PikSOZ42s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-537-VK8eDl24OL6opG78ndboSQ-1; Tue, 05 Mar 2024 15:41:07 -0500 X-MC-Unique: VK8eDl24OL6opG78ndboSQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4EB1D101A526; Tue, 5 Mar 2024 20:41:06 +0000 (UTC) Received: from ws.net.home (unknown [10.45.225.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BBB2112131D; Tue, 5 Mar 2024 20:41:04 +0000 (UTC) Date: Tue, 5 Mar 2024 21:41:02 +0100 From: Karel Zak Message-ID: <20240305204102.vf5yisn2d2wy4svt@ws.net.home> References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Score: -0.0 (/) 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: -1.0 (-) On Tue, Mar 05, 2024 at 02:16:05PM +0000, Pádraig Brady wrote: > I think having the functionality in mv(1) is better than in rename(1), > but since exch(1) is already released that's probably > the best place for this functionality now. > > A separate exch command may be overkill for just this, rename(1) was also my initial idea, but it's too complex and rarely used by users for simple tasks like those we can now achieve with the new simple command exch(1). > but perhaps related functionality might be added to that command in future. > For e.g. some of the discussed functionality for a "replace" command > might reside there. > > So I think I'll remove the as yet unreleased mv --swap from coreutils, given that > util-linux is as widely available as coreutils on GNU/Linux platforms. Yes, it seems better to have this Linux-specific feature in util-linux. We should discuss such changes early next time ;-) Thanks for CC: Karel -- Karel Zak http://karelzak.blogspot.com From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Masatake YAMATO Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 05 Mar 2024 22:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: P@draigBrady.com Cc: oss@malat.biz, util-linux@vger.kernel.org, eggert@cs.ucla.edu, asmadeus@codewreck.org, 69532@debbugs.gnu.org, rob@landley.net Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.17096768438368 (code B ref 69532); Tue, 05 Mar 2024 22:15:01 +0000 Received: (at 69532) by debbugs.gnu.org; 5 Mar 2024 22:14:03 +0000 Received: from localhost ([127.0.0.1]:49221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhd2x-0002Au-73 for submit@debbugs.gnu.org; Tue, 05 Mar 2024 17:14:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43451) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhd2t-0002AJ-27 for 69532@debbugs.gnu.org; Tue, 05 Mar 2024 17:14:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709676808; 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=w0x4YdCE1RJva5yEwIIKfgCSyAIPoVovArn3e13DwKI=; b=J+M4MSKloGETpbptLIVVpYBch6HmJv5xw0dj8qY/TjxxWtWlhE+QwEE3teLQwmHH00GLbW R04HuvIVY+TGkbTmlNHh6XszpAheod2UEwdHX5Tt3vkI6gMxW5AEH5z/+uhz7BI2F/Egev W61uuq//nwSOZR6FTX1GlHmM4hmYB+Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-3g0F9G2VMgC9V-VdssyWGw-1; Tue, 05 Mar 2024 17:13:24 -0500 X-MC-Unique: 3g0F9G2VMgC9V-VdssyWGw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08D4881A261; Tue, 5 Mar 2024 22:13:24 +0000 (UTC) Received: from localhost (unknown [10.64.240.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61D8A40C6CB5; Tue, 5 Mar 2024 22:13:22 +0000 (UTC) Date: Wed, 06 Mar 2024 07:13:21 +0900 (JST) Message-Id: <20240306.071321.901317834415227362.yamato@redhat.com> From: Masatake YAMATO In-Reply-To: <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> References: <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> Organization: Red Hat Japan, K.K. Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Score: -0.0 (/) 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: -1.0 (-) When I knew RENAME_EXCHANGE, I thought we should extend mv command as you did: adding --swap. However, after researching the past challenges, I decided not to propose the feature to coreutils. https://www.gnu.org/software/coreutils/rejected_requests.html https://lists.gnu.org/archive/html/coreutils/2018-12/msg00004.html https://www.mail-archive.com/coreutils@gnu.org/msg10276.html Masatake YAMATO > On 05/03/2024 04:10, Paul Eggert wrote: >> On 3/4/24 16:43, Dominique Martinet wrote: >>> Adding Rob to the loop because this impacts compatibility with >>> toybox/maybe busybox implementations >> Busybox does not use RENAME_EXCHANGE, so this isn't a Busybox issue.= >> Toybox mv added -x to its development version yesterday: >> https://github.com/landley/toybox/commit/a2419ad52d489bf1a84a9f3aa73= afb351642c765 >> so there's little prior art there, and there's still plenty of time = to >> fix its problems before exposing it to the world. >> = >>> I also see --swap mostly used by scripts and this actually feels a = bit >>> dangerous to me -- I'd *always* use this with -T. >> Yes, it's a problem. >> By "see --swap mostly used by scripts" I assume you mean scripts tha= t >> haven't been written yet, assuming that nobody had -x until >> yesterday.... >> = >>> (by the way, what's this "rename" command you speak of? >> https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ >> Now that I've looked into it further, util-linux already has an "exc= h" >> command that does exactly what you want. This is the command that >> toybox >> should implement rather than try to simulate it with "mv -x" (which >> causes all sorts of problems). >> That is, toybox should revert yesterday's change to "mv", and should= >> implement "exch" instead. > = > I think having the functionality in mv(1) is better than in rename(1)= , > but since exch(1) is already released that's probably > the best place for this functionality now. > = > A separate exch command may be overkill for just this, > but perhaps related functionality might be added to that command in > future. > For e.g. some of the discussed functionality for a "replace" command > might reside there. > = > So I think I'll remove the as yet unreleased mv --swap from coreutils= , > given that > util-linux is as widely available as coreutils on GNU/Linux platforms= .= > = > cheers, > P=E1draig > = > = From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 17 Mar 2024 06:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171065591523138 (code B ref 69532); Sun, 17 Mar 2024 06:12:01 +0000 Received: (at 69532) by debbugs.gnu.org; 17 Mar 2024 06:11:55 +0000 Received: from localhost ([127.0.0.1]:57533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rljkC-00060u-2L for submit@debbugs.gnu.org; Sun, 17 Mar 2024 02:11:55 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:40066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rljk7-00060X-VV for 69532@debbugs.gnu.org; Sun, 17 Mar 2024 02:11:37 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id CB7203C00E420; Sat, 16 Mar 2024 23:10:51 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id Qm09HQrSh4mP; Sat, 16 Mar 2024 23:10:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id DFB353C00D400; Sat, 16 Mar 2024 23:10:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu DFB353C00D400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710655850; bh=pj9nSqraAKwVPXwoU7QOTvXSDksiUZqp+SZruK7OVLU=; h=Message-ID:Date:MIME-Version:To:From; b=PRKdmqLl+IXsptNdkGryMD6yCXeXI35sLztr1+Aw58X6lZ8fun7YjgoXeGu+gPp3Q KcKcK5+sPCPo8FEoMn2jBuvwQcTuWwk2pVTqaS1kPAI7X/1JBMFc3PGKKhkZSN5Yfr jVBHiT+HNZ51iEdH9KBfJ6lYhVIRjfXjULaYae2Brh4mW4xqarOxA3r04SwoVibb8K C45YFC3HdhwT3EcPIcHdS5Zuy6AxctBdJkGyEidv5GxAyEtpbXu4aDNlI4upLJ2pPc VYPyhSfYVx/rhea52e4be0P2pZPYHRJcXRNqohkrgk3EoaagKgHKpj8SzebX42GDCI AJr/ik8WFHSDQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 8FuNfr-1AREu; Sat, 16 Mar 2024 23:10:50 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.154.17.165]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id B13C63C00E420; Sat, 16 Mar 2024 23:10:50 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------Fjyg79VQ0mbfEzMKwmPiE07B" Message-ID: Date: Sat, 16 Mar 2024 23:10:50 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> X-Spam-Score: -0.0 (/) 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: -1.0 (-) This is a multi-part message in MIME format. --------------Fjyg79VQ0mbfEzMKwmPiE07B Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 2024-03-05 06:16, P=C3=A1draig Brady wrote: > I think I'll remove the as yet unreleased mv --swap from coreutils,=20 > given that > util-linux is as widely available as coreutils on GNU/Linux platforms. Although removing that "mv --swap" implementation was a win, I don't=20 think we can simply delegate this to util-linux's exch command.=20 Exchanging files via a renameat-like call is not limited to the Linux=20 kernel; it's also possible on macOS via renameatx_np with RENAME_SWAP,=20 and there have been noises about adding similar things to other=20 operating systems. I just now added support for macOS renameatx_np to Gnulib, so coreutils=20 does not need to worry about the macOS details; it can simply use=20 renameatu with the Linux flags. See: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=3Daf32ee824ee1825= 5839f9812b8ed61aa5257a82b Even with Linux it's dicey. People may have older util-linux installed=20 and so lack the 'exch' utility; this is true for both Fedora 39 and=20 Ubuntu 23.10, the current releases. Ubuntu is also odd in that it=20 doesn't install all the util-linux utilities as part of the util-linux=20 package, so it's not clear what they will do with 'exch'. So I propose that we implement the idea in coreutils in a better way,=20 that interacts more nicely with -t, -T, etc. Also, I suggest using the=20 Linuxish name "--exchange" instead of the macOSish name "--swap", and=20 (for now at least) not giving the option a single-letter equivalent as I=20 expect it to be useful from scripts, not interactively. After looking at various ways to do it I came up with the attached=20 proposed patch. This should work on both GNU/Linux and macOS, if your OS=20 is recent enough and the file system supports atomic exchange. --------------Fjyg79VQ0mbfEzMKwmPiE07B Content-Type: text/x-patch; charset=UTF-8; name="0001-mv-new-option-exchange.patch" Content-Disposition: attachment; filename="0001-mv-new-option-exchange.patch" Content-Transfer-Encoding: base64 RnJvbSBkNTIyYWJhMDYxMDdkMzUzMmFkNjEwMzQ3MDcyN2JmOTA1N2Y4ZDJjIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDE2IE1hciAyMDI0IDIyOjUwOjE3IC0wNzAwClN1YmplY3Q6IFtQQVRD SF0gbXY6IG5ldyBvcHRpb24gLS1leGNoYW5nZQoKKiBzcmMvY29weS5oIChzdHJ1Y3QgY3Bf b3B0aW9ucyk6IE5ldyBtZW1iZXIgJ2V4Y2hhbmdlJy4KKiBzcmMvY29weS5jIChjb3B5X2lu dGVybmFsKTogU3VwcG9ydCB0aGUgbmV3IG1lbWJlci4KKiBzcmMvbXYuYyAoRVhDSEFOR0Vf T1BUSU9OKTogTmV3IGNvbnN0YW50LgoobG9uZ19vcHRpb25zKTogQWRkIC0tZXhjaGFuZ2Uu Cih1c2FnZSk6IERvY3VtZW50IC0tZXhjaGFuZ2UuCihtYWluKTogU3VwcG9ydCAtLWV4Y2hh bmdlLgoqIHRlc3RzL212L212LWV4Y2hhbmdlLnNoOiBOZXcgdGVzdCBjYXNlLgoqIHRlc3Rz L2xvY2FsLm1rIChhbGxfdGVzdHMpOiBBZGQgaXQuCi0tLQogTkVXUyAgICAgICAgICAgICAg ICAgICAgfCAgNyArKysrKysKIGRvYy9jb3JldXRpbHMudGV4aSAgICAgIHwgMTggKysrKysr KysrKysrKysKIHNyYy9jb3B5LmMgICAgICAgICAgICAgIHwgNTQgKysrKysrKysrKysrKysr KysrKysrKystLS0tLS0tLS0tLS0tLS0tLS0KIHNyYy9jb3B5LmggICAgICAgICAgICAgIHwg IDQgKysrCiBzcmMvbXYuYyAgICAgICAgICAgICAgICB8IDE2ICsrKysrKysrKy0tLQogdGVz dHMvbG9jYWwubWsgICAgICAgICAgfCAgMSArCiB0ZXN0cy9tdi9tdi1leGNoYW5nZS5zaCB8 IDQxICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysKIDcgZmlsZXMgY2hhbmdlZCwg MTE0IGluc2VydGlvbnMoKyksIDI3IGRlbGV0aW9ucygtKQogY3JlYXRlIG1vZGUgMTAwNzU1 IHRlc3RzL212L212LWV4Y2hhbmdlLnNoCgpkaWZmIC0tZ2l0IGEvTkVXUyBiL05FV1MKaW5k ZXggZjIxZWZjN2MwLi42N2JiMjdlYmIgMTAwNjQ0Ci0tLSBhL05FV1MKKysrIGIvTkVXUwpA QCAtODEsNiArODEsMTMgQEAgR05VIGNvcmV1dGlscyBORVdTICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgLSotIG91dGxpbmUgLSotCiAgIGFuZCB0aGUgY29tbWFuZCBl eGl0cyB3aXRoIGZhaWx1cmUgc3RhdHVzIGlmIGV4aXN0aW5nIGZpbGVzLgogICBUaGUgLW4s LS1uby1jbG9iYmVyIG9wdGlvbiBpcyBiZXN0IGF2b2lkZWQgZHVlIHRvIHBsYXRmb3JtIGRp ZmZlcmVuY2VzLgogCisgIG12IG5vdyBhY2NlcHRzIGFuIC0tZXhjaGFuZ2Ugb3B0aW9uLCB3 aGljaCBjYXVzZXMgdGhlIHNvdXJjZSBhbmQKKyAgZGVzdGluYXRpb24gdG8gYmUgZXhjaGFu Z2VkLiAgSXQgc2hvdWxkIGJlIGNvbWJpbmVkIHdpdGgKKyAgLS1uby10YXJnZXQtZGlyZWN0 b3J5ICgtVCkgaWYgdGhlIGRlc3RpbmF0aW9uIGlzIGEgZGlyZWN0b3J5LgorICBUaGUgZXhj aGFuZ2UgaXMgYXRvbWljIGlmIHNvdXJjZSBhbmQgZGVzdGluYXRpb24gYXJlIG9uIGEgc2lu Z2xlCisgIGZpbGUgc3lzdGVtIHRoYXQgc3VwcG9ydHMgYXRvbWljIGV4Y2hhbmdlOyAtLWV4 Y2hhbmdlIGlzIG5vdCB5ZXQKKyAgc3VwcG9ydGVkIGluIG90aGVyIHNpdHVhdGlvbnMuCisK ICAgb2Qgbm93IHN1cHBvcnRzIHByaW50aW5nIElFRUUgaGFsZiBwcmVjaXNpb24gZmxvYXRp bmcgcG9pbnQgd2l0aCAtdCBmSCwKICAgb3IgYnJhaW4gMTYgYml0IGZsb2F0aW5nIHBvaW50 IHdpdGggLXQgZkIsIHdoZXJlIHN1cHBvcnRlZCBieSB0aGUgY29tcGlsZXIuCiAKZGlmZiAt LWdpdCBhL2RvYy9jb3JldXRpbHMudGV4aSBiL2RvYy9jb3JldXRpbHMudGV4aQppbmRleCBk MDdlZDdlNzYuLmM0NTZhMDNkOSAxMDA2NDQKLS0tIGEvZG9jL2NvcmV1dGlscy50ZXhpCisr KyBiL2RvYy9jb3JldXRpbHMudGV4aQpAQCAtMTAyNjksNiArMTAyNjksMjQgQEAgc2tpcCBl eGlzdGluZyBmaWxlcyBidXQgbm90IGZhaWwuCiBJZiBhIGZpbGUgY2Fubm90IGJlIHJlbmFt ZWQgYmVjYXVzZSB0aGUgZGVzdGluYXRpb24gZmlsZSBzeXN0ZW0gZGlmZmVycywKIGZhaWwg d2l0aCBhIGRpYWdub3N0aWMgaW5zdGVhZCBvZiBjb3B5aW5nIGFuZCB0aGVuIHJlbW92aW5n IHRoZSBmaWxlLgogCitAaXRlbSAtLWV4Y2hhbmdlCitAb3BpbmRleCAtLWV4Y2hhbmdlCitF eGNoYW5nZSBzb3VyY2UgYW5kIGRlc3RpbmF0aW9uIGluc3RlYWQgb2YgcmVuYW1pbmcgc291 cmNlIHRvIGRlc3RpbmF0aW9uLgorQm90aCBmaWxlcyBtdXN0IGV4aXN0OyB0aGV5IG5lZWQg bm90IGJlIHRoZSBzYW1lIHR5cGUuCitUaGUgZXhjaGFuZ2UgaXMgYXRvbWljIGlmIHRoZSBz b3VyY2UgYW5kIGRlc3RpbmF0aW9uIGFyZSBib3RoIGluIGEKK3NpbmdsZSBmaWxlIHN5c3Rl bSB0aGF0IHN1cHBvcnRzIGF0b21pYyBleGNoYW5nZTsKK2V4Y2hhbmdlcyBhcmUgbm90IHll dCBzdXBwb3J0ZWQgaW4gb3RoZXIgc2l0dWF0aW9ucy4KKworVGhpcyBvcHRpb24gY2FuIGJl IHVzZWQgdG8gcmVwbGFjZSBvbmUgZGlyZWN0b3J5IHdpdGggYW5vdGhlciwgYXRvbWljYWxs eS4KK1doZW4gdXNlZCB0aGlzIHdheSwgaXQgc2hvdWxkIGJlIGNvbWJpbmVkIHdpdGgKK0Bj b2Rley0tbm8tdGFyZ2V0LWRpcmVjdG9yeX0gKEBvcHRpb257LVR9KQordG8gYXZvaWQgY29u ZnVzaW9uIGFib3V0IHRoZSBkZXN0aW5hdGlvbiBsb2NhdGlvbi4KK0Fsc28sIGlmIHRoZSB0 d28gZGlyZWN0b3JpZXMgbWlnaHQgbm90IGJlIG9uIHRoZSBzYW1lIGZpbGUgc3lzdGVtLAor dXNpbmcgQGNvZGV7LS1uby1jb3B5fSB3aWxsIHByZXZlbnQgZnV0dXJlCit2ZXJzaW9ucyBv ZiBAY29tbWFuZHttdn0gZnJvbSBpbXBsZW1lbnRpbmcgdGhlIGV4Y2hhbmdlIGJ5IGNvcHlp bmcuCitGb3IgZXhhbXBsZSwgeW91IG1pZ2h0IHVzZSBAc2FtcHttdiAtVCAtLWV4Y2hhbmdl IC0tbm8tY29weQorQHZhcntkMX0gQHZhcntkMn19IHRvIGV4Y2hhbmdlIHRoZSBkaXJlY3Rv cmllcyBAdmFye2QxfSBhbmQgQHZhcntkMn0uCisKIEBpdGVtIC11CiBAaXRlbXggLS11cGRh dGUKIEBvcGluZGV4IC11CmRpZmYgLS1naXQgYS9zcmMvY29weS5jIGIvc3JjL2NvcHkuYwpp bmRleCA4ZDk5Zjg1NjIuLmU3YmY2MDIyZiAxMDA2NDQKLS0tIGEvc3JjL2NvcHkuYworKysg Yi9zcmMvY29weS5jCkBAIC0yMjIzLDkgKzIyMjMsMTEgQEAgY29weV9pbnRlcm5hbCAoY2hh ciBjb25zdCAqc3JjX25hbWUsIGNoYXIgY29uc3QgKmRzdF9uYW1lLAogICAgIHsKICAgICAg IGlmIChyZW5hbWVfZXJybm8gPCAwKQogICAgICAgICByZW5hbWVfZXJybm8gPSAocmVuYW1l YXR1IChBVF9GRENXRCwgc3JjX25hbWUsIGRzdF9kaXJmZCwgZHJlbG5hbWUsCi0gICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFTkFNRV9OT1JFUExBQ0UpCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICh4LT5leGNoYW5nZQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgPyBSRU5BTUVfRVhDSEFOR0UgOiBSRU5BTUVfTk9S RVBMQUNFKSkKICAgICAgICAgICAgICAgICAgICAgICAgID8gZXJybm8gOiAwKTsKLSAgICAg IG5vbmV4aXN0ZW50X2RzdCA9ICpyZW5hbWVfc3VjY2VlZGVkID0gcmVuYW1lX2Vycm5vID09 IDA7CisgICAgICAqcmVuYW1lX3N1Y2NlZWRlZCA9IHJlbmFtZV9lcnJubyA9PSAwOworICAg ICAgbm9uZXhpc3RlbnRfZHN0ID0gKnJlbmFtZV9zdWNjZWVkZWQgJiYgIXgtPmV4Y2hhbmdl OwogICAgIH0KIAogICBpZiAocmVuYW1lX2Vycm5vID09IDAKQEAgLTIyNDYsNyArMjI0OCw3 IEBAIGNvcHlfaW50ZXJuYWwgKGNoYXIgY29uc3QgKnNyY19uYW1lLCBjaGFyIGNvbnN0ICpk c3RfbmFtZSwKIAogICAgICAgc3JjX21vZGUgPSBzcmNfc2Iuc3RfbW9kZTsKIAotICAgICAg aWYgKFNfSVNESVIgKHNyY19tb2RlKSAmJiAheC0+cmVjdXJzaXZlKQorICAgICAgaWYgKFNf SVNESVIgKHNyY19tb2RlKSAmJiAheC0+cmVjdXJzaXZlICYmICF4LT5leGNoYW5nZSkKICAg ICAgICAgewogICAgICAgICAgIGVycm9yICgwLCAwLCAhIHgtPmluc3RhbGxfbW9kZSAvKiBj cCAqLwogICAgICAgICAgICAgICAgICA/IF8oIi1yIG5vdCBzcGVjaWZpZWQ7IG9taXR0aW5n IGRpcmVjdG9yeSAlcyIpCkBAIC0yMjg5LDcgKzIyOTEsNyBAQCBjb3B5X2ludGVybmFsIChj aGFyIGNvbnN0ICpzcmNfbmFtZSwgY2hhciBjb25zdCAqZHN0X25hbWUsCiAgICAgIHRyZWF0 ZWQgdGhlIHNhbWUgYXMgbm9uZXhpc3RlbnQgZmlsZXMuICAqLwogICBib29sIG5ld19kc3Qg PSAwIDwgbm9uZXhpc3RlbnRfZHN0OwogCi0gIGlmICghIG5ld19kc3QpCisgIGlmICghIG5l d19kc3QgJiYgISB4LT5leGNoYW5nZSkKICAgICB7CiAgICAgICAvKiBOb3JtYWxseSwgZmls bCBpbiBEU1RfU0Igb3Igc2V0IE5FV19EU1Qgc28gdGhhdCBsYXRlciBjb2RlCiAgICAgICAg ICBjYW4gdXNlIERTVF9TQiBpZiBORVdfRFNUIGlzIGZhbHNlLiAgSG93ZXZlciwgZG9uJ3Qg Ym90aGVyCkBAIC0yNjU3LDcgKzI2NTksNyBAQCBza2lwOgogICAgICBBbHNvLCB3aXRoIC0t cmVjdXJzaXZlLCByZWNvcmQgZGV2L2lubyBvZiBlYWNoIGNvbW1hbmQtbGluZSBkaXJlY3Rv cnkuCiAgICAgIFdlJ2xsIHVzZSB0aGF0IGluZm8gdG8gZGV0ZWN0IHRoaXMgcHJvYmxlbTog Y3AgLVIgZGlyIGRpci4gICovCiAKLSAgaWYgKHJlbmFtZV9lcnJubyA9PSAwKQorICBpZiAo cmVuYW1lX2Vycm5vID09IDAgfHwgeC0+ZXhjaGFuZ2UpCiAgICAgZWFybGllcl9maWxlID0g bnVsbHB0cjsKICAgZWxzZSBpZiAoeC0+cmVjdXJzaXZlICYmIFNfSVNESVIgKHNyY19tb2Rl KSkKICAgICB7CkBAIC0yNzUyLDcgKzI3NTQsNyBAQCBza2lwOgogCiAgIGlmICh4LT5tb3Zl X21vZGUpCiAgICAgewotICAgICAgaWYgKHJlbmFtZV9lcnJubyA9PSBFRVhJU1QpCisgICAg ICBpZiAocmVuYW1lX2Vycm5vID09IEVFWElTVCAmJiAheC0+ZXhjaGFuZ2UpCiAgICAgICAg IHJlbmFtZV9lcnJubyA9IChyZW5hbWVhdCAoQVRfRkRDV0QsIHNyY19uYW1lLCBkc3RfZGly ZmQsIGRyZWxuYW1lKSA9PSAwCiAgICAgICAgICAgICAgICAgICAgICAgICA/IDAgOiBlcnJu byk7CiAKQEAgLTI3ODEsNyArMjc4Myw3IEBAIHNraXA6CiAgICAgICAgICAgICAgICAgIF9k ZXN0aW5hdGlvbl8gZGV2L2lubywgc2luY2UgdGhlIHJlbmFtZSBhYm92ZSBjYW4ndCBoYXZl CiAgICAgICAgICAgICAgICAgIGNoYW5nZWQgdGhvc2UsIGFuZCAnbXYnIGFsd2F5cyB1c2Vz IGxzdGF0LgogICAgICAgICAgICAgICAgICBXZSBjb3VsZCBsaW1pdCBpdCBmdXJ0aGVyIGJ5 IG9wZXJhdGluZwotICAgICAgICAgICAgICAgICBvbmx5IG9uIG5vbi1kaXJlY3Rvcmllcy4g ICovCisgICAgICAgICAgICAgICAgIG9ubHkgb24gbm9uLWRpcmVjdG9yaWVzIHdoZW4gIXgt PmV4Y2hhbmdlLiAgKi8KICAgICAgICAgICAgICAgcmVjb3JkX2ZpbGUgKHgtPmRlc3RfaW5m bywgZHN0X3JlbG5hbWUsICZzcmNfc2IpOwogICAgICAgICAgICAgfQogCkBAIC0yODI4LDcg KzI4MzAsNyBAQCBza2lwOgogICAgICAgICAgd2hlcmUgeW91J2QgcmVwbGFjZSAnMTgnIHdp dGggdGhlIGludGVnZXIgaW4gcGFyZW50aGVzZXMgdGhhdAogICAgICAgICAgd2FzIG91dHB1 dCBmcm9tIHRoZSBwZXJsIG9uZS1saW5lciBhYm92ZS4KICAgICAgICAgIElmIG5lY2Vzc2Fy eSwgb2YgY291cnNlLCBjaGFuZ2UgJy90bXAnIHRvIHNvbWUgb3RoZXIgZGlyZWN0b3J5LiAg Ki8KLSAgICAgIGlmIChyZW5hbWVfZXJybm8gIT0gRVhERVYgfHwgeC0+bm9fY29weSkKKyAg ICAgIGlmIChyZW5hbWVfZXJybm8gIT0gRVhERVYgfHwgeC0+bm9fY29weSB8fCB4LT5leGNo YW5nZSkKICAgICAgICAgewogICAgICAgICAgIC8qIFRoZXJlIGFyZSBtYW55IHdheXMgdGhp cyBjYW4gaGFwcGVuIGR1ZSB0byBhIHJhY2UgY29uZGl0aW9uLgogICAgICAgICAgICAgIFdo ZW4gc29tZXRoaW5nIGhhcHBlbnMgYmV0d2VlbiB0aGUgaW5pdGlhbCBmb2xsb3dfZnN0YXRh dCBhbmQgdGhlCkBAIC0yODQxLDI1ICsyODQzLDI5IEBAIHNraXA6CiAgICAgICAgICAgICAg ZGVzdGluYXRpb24gZmlsZSBhcmUgbWFkZSB0b28gcmVzdHJpY3RpdmUsIHRoZSByZW5hbWUg d2lsbAogICAgICAgICAgICAgIGZhaWwuICBFdGMuICAqLwogICAgICAgICAgIGNoYXIgY29u c3QgKnF1b3RlZF9kc3RfbmFtZSA9IHF1b3RlYWZfbiAoMSwgZHN0X25hbWUpOwotICAgICAg ICAgIHN3aXRjaCAocmVuYW1lX2Vycm5vKQotICAgICAgICAgICAgewotICAgICAgICAgICAg Y2FzZSBFRFFVT1Q6IGNhc2UgRUVYSVNUOiBjYXNlIEVJU0RJUjogY2FzZSBFTUxJTks6Ci0g ICAgICAgICAgICBjYXNlIEVOT1NQQzogY2FzZSBFVFhUQlNZOgorICAgICAgICAgIGlmICh4 LT5leGNoYW5nZSkKKyAgICAgICAgICAgIGVycm9yICgwLCByZW5hbWVfZXJybm8sIF8oImNh bm5vdCBleGNoYW5nZSAlcyBhbmQgJXMiKSwKKyAgICAgICAgICAgICAgICAgICBxdW90ZWFm X24gKDAsIHNyY19uYW1lKSwgcXVvdGVkX2RzdF9uYW1lKTsKKyAgICAgICAgICBlbHNlCisg ICAgICAgICAgICBzd2l0Y2ggKHJlbmFtZV9lcnJubykKKyAgICAgICAgICAgICAgeworICAg ICAgICAgICAgICBjYXNlIEVEUVVPVDogY2FzZSBFRVhJU1Q6IGNhc2UgRUlTRElSOiBjYXNl IEVNTElOSzoKKyAgICAgICAgICAgICAgY2FzZSBFTk9TUEM6IGNhc2UgRVRYVEJTWToKICNp ZiBFTk9URU1QVFkgIT0gRUVYSVNUCi0gICAgICAgICAgICBjYXNlIEVOT1RFTVBUWToKKyAg ICAgICAgICAgICAgY2FzZSBFTk9URU1QVFk6CiAjZW5kaWYKLSAgICAgICAgICAgICAgLyog VGhlIGRlc3RpbmF0aW9uIG11c3QgYmUgdGhlIHByb2JsZW0uICBEb24ndCBtZW50aW9uCi0g ICAgICAgICAgICAgICAgIHRoZSBzb3VyY2UgYXMgdGhhdCBpcyBtb3JlIGxpa2VseSB0byBj b25mdXNlIHRoZSB1c2VyCi0gICAgICAgICAgICAgICAgIHRoYW4gYmUgaGVscGZ1bC4gICov Ci0gICAgICAgICAgICAgIGVycm9yICgwLCByZW5hbWVfZXJybm8sIF8oImNhbm5vdCBvdmVy d3JpdGUgJXMiKSwKLSAgICAgICAgICAgICAgICAgICAgIHF1b3RlZF9kc3RfbmFtZSk7Ci0g ICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIC8qIFRoZSBkZXN0aW5hdGlv biBtdXN0IGJlIHRoZSBwcm9ibGVtLiAgRG9uJ3QgbWVudGlvbgorICAgICAgICAgICAgICAg ICAgIHRoZSBzb3VyY2UgYXMgdGhhdCBpcyBtb3JlIGxpa2VseSB0byBjb25mdXNlIHRoZSB1 c2VyCisgICAgICAgICAgICAgICAgICAgdGhhbiBiZSBoZWxwZnVsLiAgKi8KKyAgICAgICAg ICAgICAgICBlcnJvciAoMCwgcmVuYW1lX2Vycm5vLCBfKCJjYW5ub3Qgb3ZlcndyaXRlICVz IiksCisgICAgICAgICAgICAgICAgICAgICAgIHF1b3RlZF9kc3RfbmFtZSk7CisgICAgICAg ICAgICAgICAgYnJlYWs7CiAKLSAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAg IGVycm9yICgwLCByZW5hbWVfZXJybm8sIF8oImNhbm5vdCBtb3ZlICVzIHRvICVzIiksCi0g ICAgICAgICAgICAgICAgICAgICBxdW90ZWFmX24gKDAsIHNyY19uYW1lKSwgcXVvdGVkX2Rz dF9uYW1lKTsKLSAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9CisgICAgICAg ICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgZXJyb3IgKDAsIHJlbmFtZV9lcnJu bywgXygiY2Fubm90IG1vdmUgJXMgdG8gJXMiKSwKKyAgICAgICAgICAgICAgICAgICAgICAg cXVvdGVhZl9uICgwLCBzcmNfbmFtZSksIHF1b3RlZF9kc3RfbmFtZSk7CisgICAgICAgICAg ICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIH0KICAgICAgICAgICBmb3JnZXRfY3JlYXRl ZCAoc3JjX3NiLnN0X2lubywgc3JjX3NiLnN0X2Rldik7CiAgICAgICAgICAgcmV0dXJuIGZh bHNlOwogICAgICAgICB9CmRpZmYgLS1naXQgYS9zcmMvY29weS5oIGIvc3JjL2NvcHkuaApp bmRleCBkZmE5NDM1YjMuLmFiODljNzVmZCAxMDA2NDQKLS0tIGEvc3JjL2NvcHkuaAorKysg Yi9zcmMvY29weS5oCkBAIC0xNTUsNiArMTU1LDEwIEBAIHN0cnVjdCBjcF9vcHRpb25zCiAg ICAgIElmIHRoYXQgZmFpbHMgYW5kIE5PX0NPUFksIGZhaWwgaW5zdGVhZCBvZiBjb3B5aW5n LiAgKi8KICAgYm9vbCBtb3ZlX21vZGUsIG5vX2NvcHk7CiAKKyAgLyogRXhjaGFuZ2UgaW5z dGVhZCBvZiByZW5hbWluZy4gIFZhbGlkIG9ubHkgaWYgTU9WRV9NT0RFIGFuZCBpZgorICAg ICBCQUNLVVBfVFlQRSA9PSBub19iYWNrdXBzLiAgKi8KKyAgYm9vbCBleGNoYW5nZTsKKwog ICAvKiBJZiB0cnVlLCBpbnN0YWxsKDEpIGlzIHRoZSBjYWxsZXIuICAqLwogICBib29sIGlu c3RhbGxfbW9kZTsKIApkaWZmIC0tZ2l0IGEvc3JjL212LmMgYi9zcmMvbXYuYwppbmRleCA5 ZGM0MGZlM2UuLjY5Mjk0M2E3MCAxMDA2NDQKLS0tIGEvc3JjL212LmMKKysrIGIvc3JjL212 LmMKQEAgLTQ4LDYgKzQ4LDcgQEAKIGVudW0KIHsKICAgREVCVUdfT1BUSU9OID0gQ0hBUl9N QVggKyAxLAorICBFWENIQU5HRV9PUFRJT04sCiAgIE5PX0NPUFlfT1BUSU9OLAogICBTVFJJ UF9UUkFJTElOR19TTEFTSEVTX09QVElPTgogfTsKQEAgLTY3LDYgKzY4LDcgQEAgc3RhdGlj IHN0cnVjdCBvcHRpb24gY29uc3QgbG9uZ19vcHRpb25zW10gPQogICB7ImJhY2t1cCIsIG9w dGlvbmFsX2FyZ3VtZW50LCBudWxscHRyLCAnYid9LAogICB7ImNvbnRleHQiLCBub19hcmd1 bWVudCwgbnVsbHB0ciwgJ1onfSwKICAgeyJkZWJ1ZyIsIG5vX2FyZ3VtZW50LCBudWxscHRy LCBERUJVR19PUFRJT059LAorICB7ImV4Y2hhbmdlIiwgbm9fYXJndW1lbnQsIG51bGxwdHIs IEVYQ0hBTkdFX09QVElPTn0sCiAgIHsiZm9yY2UiLCBub19hcmd1bWVudCwgbnVsbHB0ciwg J2YnfSwKICAgeyJpbnRlcmFjdGl2ZSIsIG5vX2FyZ3VtZW50LCBudWxscHRyLCAnaSd9LAog ICB7Im5vLWNsb2JiZXIiLCBub19hcmd1bWVudCwgbnVsbHB0ciwgJ24nfSwgICAvKiBEZXBy ZWNhdGVkLiAgKi8KQEAgLTI3MSw2ICsyNzMsOSBAQCBSZW5hbWUgU09VUkNFIHRvIERFU1Qs IG9yIG1vdmUgU09VUkNFKHMpIHRvIERJUkVDVE9SWS5cblwKICIpLCBzdGRvdXQpOwogICAg ICAgZnB1dHMgKF8oIlwKICAgICAgIC0tZGVidWcgICAgICAgICAgICAgICAgICBleHBsYWlu IGhvdyBhIGZpbGUgaXMgY29waWVkLiAgSW1wbGllcyAtdlxuXAorIiksIHN0ZG91dCk7Cisg ICAgICBmcHV0cyAoXygiXAorICAgICAgLS1leGNoYW5nZSAgICAgICAgICAgICAgIGV4Y2hh bmdlIHNvdXJjZSBhbmQgZGVzdGluYXRpb25cblwKICIpLCBzdGRvdXQpOwogICAgICAgZnB1 dHMgKF8oIlwKICAgLWYsIC0tZm9yY2UgICAgICAgICAgICAgICAgICBkbyBub3QgcHJvbXB0 IGJlZm9yZSBvdmVyd3JpdGluZ1xuXApAQCAtMzYxLDYgKzM2Niw5IEBAIG1haW4gKGludCBh cmdjLCBjaGFyICoqYXJndikKICAgICAgICAgY2FzZSBERUJVR19PUFRJT046CiAgICAgICAg ICAgeC5kZWJ1ZyA9IHgudmVyYm9zZSA9IHRydWU7CiAgICAgICAgICAgYnJlYWs7CisgICAg ICAgIGNhc2UgRVhDSEFOR0VfT1BUSU9OOgorICAgICAgICAgIHguZXhjaGFuZ2UgPSB0cnVl OworICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIE5PX0NPUFlfT1BUSU9OOgogICAg ICAgICAgIHgubm9fY29weSA9IHRydWU7CiAgICAgICAgICAgYnJlYWs7CkBAIC00NjksNyAr NDc3LDcgQEAgbWFpbiAoaW50IGFyZ2MsIGNoYXIgKiphcmd2KQogICBlbHNlCiAgICAgewog ICAgICAgY2hhciBjb25zdCAqbGFzdGZpbGUgPSBmaWxlW25fZmlsZXMgLSAxXTsKLSAgICAg IGlmIChuX2ZpbGVzID09IDIpCisgICAgICBpZiAobl9maWxlcyA9PSAyICYmICF4LmV4Y2hh bmdlKQogICAgICAgICB4LnJlbmFtZV9lcnJubyA9IChyZW5hbWVhdHUgKEFUX0ZEQ1dELCBm aWxlWzBdLCBBVF9GRENXRCwgbGFzdGZpbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgUkVOQU1FX05PUkVQTEFDRSkKICAgICAgICAgICAgICAgICAgICAgICAg ICAgPyBlcnJubyA6IDApOwpAQCAtNTE0LDExICs1MjIsMTMgQEAgbWFpbiAoaW50IGFyZ2Ms IGNoYXIgKiphcmd2KQogICAgICAgc3RyaXBfdHJhaWxpbmdfc2xhc2hlcyAoZmlsZVtpXSk7 CiAKICAgaWYgKG1ha2VfYmFja3VwcwotICAgICAgJiYgKHguaW50ZXJhY3RpdmUgPT0gSV9B TFdBWVNfU0tJUAorICAgICAgJiYgKHguZXhjaGFuZ2UKKyAgICAgICAgICB8fCB4LmludGVy YWN0aXZlID09IElfQUxXQVlTX1NLSVAKICAgICAgICAgICB8fCB4LmludGVyYWN0aXZlID09 IElfQUxXQVlTX05PKSkKICAgICB7CiAgICAgICBlcnJvciAoMCwgMCwKLSAgICAgICAgICAg ICBfKCItLWJhY2t1cCBpcyBtdXR1YWxseSBleGNsdXNpdmUgd2l0aCAtbiBvciAtLXVwZGF0 ZT1ub25lLWZhaWwiKSk7CisgICAgICAgICAgICAgXygiY2Fubm90IGNvbWJpbmUgLS1iYWNr dXAgd2l0aCAiCisgICAgICAgICAgICAgICAiLS1leGNoYW5nZSwgLW4sIG9yIC0tdXBkYXRl PW5vbmUtZmFpbCIpKTsKICAgICAgIHVzYWdlIChFWElUX0ZBSUxVUkUpOwogICAgIH0KIApk aWZmIC0tZ2l0IGEvdGVzdHMvbG9jYWwubWsgYi90ZXN0cy9sb2NhbC5tawppbmRleCA3Y2Qx ZWY3YjUuLmYwYWMwMzg2ZiAxMDA2NDQKLS0tIGEvdGVzdHMvbG9jYWwubWsKKysrIGIvdGVz dHMvbG9jYWwubWsKQEAgLTY5OCw2ICs2OTgsNyBAQCBhbGxfdGVzdHMgPQkJCQkJXAogICB0 ZXN0cy9tdi9pbnRvLXNlbGYtMy5zaAkJCVwKICAgdGVzdHMvbXYvaW50by1zZWxmLTQuc2gJ CQlcCiAgIHRlc3RzL212L2xlYWstZmQuc2gJCQkJXAorICB0ZXN0cy9tdi9tdi1leGNoYW5n ZS5zaAkJCVwKICAgdGVzdHMvbXYvbXYtbi5zaAkJCQlcCiAgIHRlc3RzL212L212LXNwZWNp YWwtMS5zaAkJCVwKICAgdGVzdHMvbXYvbm8tY29weS5zaAkJCQlcCmRpZmYgLS1naXQgYS90 ZXN0cy9tdi9tdi1leGNoYW5nZS5zaCBiL3Rlc3RzL212L212LWV4Y2hhbmdlLnNoCm5ldyBm aWxlIG1vZGUgMTAwNzU1CmluZGV4IDAwMDAwMDAwMC4uNDg1NDAzYTFkCi0tLSAvZGV2L251 bGwKKysrIGIvdGVzdHMvbXYvbXYtZXhjaGFuZ2Uuc2gKQEAgLTAsMCArMSw0MSBAQAorIyEv YmluL3NoCisjIFRlc3QgbXYgLS1leGNoYW5nZS4KKworIyBDb3B5cmlnaHQgKEMpIDIwMjQg RnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLCBJbmMuCisKKyMgVGhpcyBwcm9ncmFtIGlzIGZy ZWUgc29mdHdhcmU6IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKKyMg aXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBh cyBwdWJsaXNoZWQgYnkKKyMgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbiwgZWl0aGVy IHZlcnNpb24gMyBvZiB0aGUgTGljZW5zZSwgb3IKKyMgKGF0IHlvdXIgb3B0aW9uKSBhbnkg bGF0ZXIgdmVyc2lvbi4KKworIyBUaGlzIHByb2dyYW0gaXMgZGlzdHJpYnV0ZWQgaW4gdGhl IGhvcGUgdGhhdCBpdCB3aWxsIGJlIHVzZWZ1bCwKKyMgYnV0IFdJVEhPVVQgQU5ZIFdBUlJB TlRZOyB3aXRob3V0IGV2ZW4gdGhlIGltcGxpZWQgd2FycmFudHkgb2YKKyMgTUVSQ0hBTlRB QklMSVRZIG9yIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUiBQVVJQT1NFLiAgU2VlIHRoZQor IyBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBmb3IgbW9yZSBkZXRhaWxzLgorCisjIFlv dSBzaG91bGQgaGF2ZSByZWNlaXZlZCBhIGNvcHkgb2YgdGhlIEdOVSBHZW5lcmFsIFB1Ymxp YyBMaWNlbnNlCisjIGFsb25nIHdpdGggdGhpcyBwcm9ncmFtLiAgSWYgbm90LCBzZWUgPGh0 dHBzOi8vd3d3LmdudS5vcmcvbGljZW5zZXMvPi4KKworLiAiJHtzcmNkaXI9Ln0vdGVzdHMv aW5pdC5zaCI7IHBhdGhfcHJlcGVuZF8gLi9zcmMKK3ByaW50X3Zlcl8gbXYKKworCisjIFRl c3QgZXhjaGFuZ2luZyBmaWxlcy4KK3RvdWNoIGEgfHwgZnJhbWV3b3JrX2ZhaWx1cmVfCitt a2RpciBiIHx8IGZyYW1ld29ya19mYWlsdXJlXworaWYgISBtdiAtVCAtLWV4Y2hhbmdlIGEg YiAyPmV4Y2hhbmdlX2VycjsgdGhlbgorICBncmVwICdub3Qgc3VwcG9ydGVkJyBleGNoYW5n ZV9lcnIgfHwgeyBjYXQgZXhjaGFuZ2VfZXJyOyBmYWlsPTE7IH0KK2Vsc2UKKyAgdGVzdCAt ZCBhIHx8IGZhaWw9MQorICB0ZXN0IC1mIGIgfHwgZmFpbD0xCitmaQorCisjIFRlc3Qgd3Jv bmcgbnVtYmVyIG9mIGFyZ3VtZW50cy4KK3RvdWNoIGMgfHwgZnJhbWV3b3JrX2ZhaWx1cmVf CityZXR1cm5zXyAxIG12IC0tZXhjaGFuZ2UgYSAyPi9kZXYvbnVsbCB8fCBmYWlsPTEKK3Jl dHVybnNfIDEgbXYgLS1leGNoYW5nZSBhIGIgYyAyPi9kZXYvbnVsbCB8fCBmYWlsPTEKKwor IyBCb3RoIGZpbGVzIG11c3QgZXhpc3QuCityZXR1cm5zXyAxIG12IC0tZXhjaGFuZ2UgYSBk IDI+L2Rldi9udWxsIHx8IGZhaWw9MQorCitFeGl0ICRmYWlsCi0tIAoyLjQwLjEKCg== --------------Fjyg79VQ0mbfEzMKwmPiE07B-- From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 17 Mar 2024 11:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171067524317934 (code B ref 69532); Sun, 17 Mar 2024 11:35:01 +0000 Received: (at 69532) by debbugs.gnu.org; 17 Mar 2024 11:34:03 +0000 Received: from localhost ([127.0.0.1]:57700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlomA-0004fB-GH for submit@debbugs.gnu.org; Sun, 17 Mar 2024 07:34:02 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:52357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlom8-0004ei-HS for 69532@debbugs.gnu.org; Sun, 17 Mar 2024 07:34:01 -0400 Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3412f49bac7so457550f8f.0 for <69532@debbugs.gnu.org>; Sun, 17 Mar 2024 04:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710675137; x=1711279937; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=TwT7oMejggk2f25zPOj2X65KbA9c8QO1EvSH6Bdd1XE=; b=jZHe7+nK2wG880Xo8w6+bufEZLiqG1WUauFbCx/xnIlPH5nelf8Z/a5fs5w0rtIAa0 fhosCgnLywpK8qvjS00XnVeAtVJk4kwLYirVxlDmwEy+x8m1z38KBko4cJl1/sRSLi+Q olwLc/T98Km6FElSmQc62WdUYUPbRGilEXOgvmZmUgtQpIdtBn4pvhP4u+y6Nk5x09hC jBeGDfT6XpmTXPtdEann+0kvr4CEOPdLXJ4hyjtkROmj4t2W8E5dzBSCg6dtqG22k4sy F5Syjeq/X5yaNAMdGRODEVx/Fn9VWe2y/C91eE1BDep5VZ2RuPdz/EjFujcS1mJLZG5k Ortw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710675137; x=1711279937; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TwT7oMejggk2f25zPOj2X65KbA9c8QO1EvSH6Bdd1XE=; b=BBGLBV8flwUjx8XhNMYRbdNJGoXSfBVol2Vut7tLFVtFzBeJosqN/kTfFWzMfIZ3XV fBddOJnz609SHXGQILavsp8rN1B1RlZz8VjeyJuI355NnPsLRP+Xcgy11dxI1O4isVbH +5ItBikyQLBkAp+/8NhI+IKYzKQXpfjenfhY0s+MWRM2t+ZgiIaei5a7vtpTNVwcuxcf Hs+2aD/fCRoE2WVKIoSLUfUUKvslDbR5ePG/BzelBlCjGv8RPpH5n7WR/nsjPsZ7qTCU kxiQeXrq3Roiq7h9JpEq2T4tZXzzlBW6LDbLA9vvtrY4vjC2Ym+Mh+ziajwN8f+QupKH 5T1g== X-Gm-Message-State: AOJu0YwgLNCttvE4lfidSKEZaYq4ONGGjdz7H/iOktMWFXN6gIADz8xl m1ts0hn+GPFOCeXcyECUH1hQIi9wlCzsdO7SKBGC1cna3BRgDQ4G X-Google-Smtp-Source: AGHT+IFUj6mZn0pESrqZMh/4J0Se5KPDT79sp1MKNeIB0RhtIpQkveqe/bJ2u4Uu6XjwjwfpUGRYIw== X-Received: by 2002:adf:b319:0:b0:33e:ae46:f9d with SMTP id j25-20020adfb319000000b0033eae460f9dmr3748659wrd.4.1710675136896; Sun, 17 Mar 2024 04:32:16 -0700 (PDT) Received: from [192.168.1.39] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id a26-20020a5d457a000000b0033e7e9c8657sm7334063wrc.45.2024.03.17.04.32.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Mar 2024 04:32:16 -0700 (PDT) Message-ID: <5308840a-9de4-33d0-2520-5f3addc9718c@draigBrady.com> Date: Sun, 17 Mar 2024 11:32:15 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> From: =?UTF-8?Q?P=C3=A1draig?= Brady In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) 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: -0.8 (/) On 17/03/2024 06:10, Paul Eggert wrote: > On 2024-03-05 06:16, Pádraig Brady wrote: >> I think I'll remove the as yet unreleased mv --swap from coreutils, >> given that >> util-linux is as widely available as coreutils on GNU/Linux platforms. > > Although removing that "mv --swap" implementation was a win, I don't > think we can simply delegate this to util-linux's exch command. > Exchanging files via a renameat-like call is not limited to the Linux > kernel; it's also possible on macOS via renameatx_np with RENAME_SWAP, > and there have been noises about adding similar things to other > operating systems. > > I just now added support for macOS renameatx_np to Gnulib, so coreutils > does not need to worry about the macOS details; it can simply use > renameatu with the Linux flags. See: > > https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=af32ee824ee18255839f9812b8ed61aa5257a82b > > Even with Linux it's dicey. People may have older util-linux installed > and so lack the 'exch' utility; this is true for both Fedora 39 and > Ubuntu 23.10, the current releases. Ubuntu is also odd in that it > doesn't install all the util-linux utilities as part of the util-linux > package, so it's not clear what they will do with 'exch'. > > So I propose that we implement the idea in coreutils in a better way, > that interacts more nicely with -t, -T, etc. Also, I suggest using the > Linuxish name "--exchange" instead of the macOSish name "--swap", and > (for now at least) not giving the option a single-letter equivalent as I > expect it to be useful from scripts, not interactively. > > After looking at various ways to do it I came up with the attached > proposed patch. This should work on both GNU/Linux and macOS, if your OS > is recent enough and the file system supports atomic exchange. The implementation looks good. Re exch(1) on macos, I see util-linux is on homebrew, so it would be relatively easy to ifdef renameatx_np in util-linux also. I think the --no-copy situation is brittle, as scripts not using it now would be atomic, but then if we ever supported cross fs swaps it may become non atomic. I'd at least doc with a line in the --exchange description in usage() to say something like: "Use --no-copy to enforce atomic operation" While the most flexible, it's also quite awkward to need `mv --exchange --no-copy --no-target-directory` for most uses. I.e. it's tempting to imply the --no-... options with --exchange, but I suppose since scripting is the primary use case for this flexibility trumps conciseness, so I'm ok with the verbosity I think. thanks, Pádraig From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 17 Mar 2024 11:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171067570818707 (code B ref 69532); Sun, 17 Mar 2024 11:42:02 +0000 Received: (at 69532) by debbugs.gnu.org; 17 Mar 2024 11:41:48 +0000 Received: from localhost ([127.0.0.1]:57707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlotg-0004re-8W for submit@debbugs.gnu.org; Sun, 17 Mar 2024 07:41:48 -0400 Received: from mail-lf1-f47.google.com ([209.85.167.47]:57637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlotd-0004rP-PY for 69532@debbugs.gnu.org; Sun, 17 Mar 2024 07:41:46 -0400 Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-513d4559fb4so3882146e87.3 for <69532@debbugs.gnu.org>; Sun, 17 Mar 2024 04:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710675602; x=1711280402; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=nQCFxF+dpg/9wzkzSuUabUHGfY9fyqsLotEk8oeykAE=; b=g+YE0rWgibekB7ij7AGWbfHNDTtNn33Ilfe96T5L7h22WjymWi7y2d6Nut2jZoPD3U BP/KUuPYoWFOnwTN44x5t2b+eD56DQ6mFArpOqF29e+i3OXqqkEj13+cYnob+UpWQlxG eLTIH1fpq6T/KvdCxjcwH2u18N1AArY5RKgeZ0vJMcVcVc41W4+ob54eH12sqk64HSL0 eZi8BeHzlys869mqvRB/jWfnE6/vc7rvJiGPLtkPcLIuzoWm/TwBqTNWDSBuMnI6Rc93 kjy2ldr1PY1hK5E9CFYM4IexIDEmPZS7brbouShg2y50kQK/phj9ldl2XY7jL3GGf8Zf /UZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710675602; x=1711280402; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nQCFxF+dpg/9wzkzSuUabUHGfY9fyqsLotEk8oeykAE=; b=rflzLlRLe56UQjty5VcK/mgx6T1+V6ZxoTybYqTNZKqhxX4PVsvKr0wAtJXSiNIZcr d+fRBhIUYD2TmGUnv14b9O5g0C784xx3nW6spDqvuTqUGzAXtTiVhZYh7YSt/ckLky4z WUBR+IJWSp5VJUUXWogfBTpjO7uGs+r4dwcgU9ElvTBi4RrNd6o0/dNdH1mbBQ0+3QlP tIysB37fjA9pt/mc4tuj/+HE810LX7oJBlqXQ+fBOmNDiD+s3g3CubtmIc78Sp2qNaXO LiBKzHheGRGmYzEjudTEFfOKdV4qql4KXLXOR5gIejVRuNA5+BBu5rfLbwbQHSclVwfR cHGQ== X-Gm-Message-State: AOJu0YzjNw8JsqF0vAeVR3PrifdqTvGGH7lS+dp90+11G6MSxrCXHncF BbsCjQZE2Ef0S+sNHkkkTyDaAZFR78Re4b81v0Twr0u8l0LIK6LC X-Google-Smtp-Source: AGHT+IF0V9qNfWKurJ3xgdAo/I7FV0CDCmRfMuOuCqgxJa29FXwkq0YT7vGK3Y/XDFvsYKrjql2kUQ== X-Received: by 2002:a19:740a:0:b0:513:cc23:3b6b with SMTP id v10-20020a19740a000000b00513cc233b6bmr6947252lfe.48.1710675602122; Sun, 17 Mar 2024 04:40:02 -0700 (PDT) Received: from [192.168.1.39] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id f5-20020adffcc5000000b0033e7b05edf3sm7360952wrs.44.2024.03.17.04.40.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Mar 2024 04:40:01 -0700 (PDT) Message-ID: <9d0cd94b-0601-44e2-9218-889b1bd35336@draigBrady.com> Date: Sun, 17 Mar 2024 11:40:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig?= Brady References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <5308840a-9de4-33d0-2520-5f3addc9718c@draigBrady.com> In-Reply-To: <5308840a-9de4-33d0-2520-5f3addc9718c@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) 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: -0.8 (/) On 17/03/2024 11:32, Pádraig Brady wrote: > On 17/03/2024 06:10, Paul Eggert wrote: >> On 2024-03-05 06:16, Pádraig Brady wrote: >>> I think I'll remove the as yet unreleased mv --swap from coreutils, >>> given that >>> util-linux is as widely available as coreutils on GNU/Linux platforms. >> >> Although removing that "mv --swap" implementation was a win, I don't >> think we can simply delegate this to util-linux's exch command. >> Exchanging files via a renameat-like call is not limited to the Linux >> kernel; it's also possible on macOS via renameatx_np with RENAME_SWAP, >> and there have been noises about adding similar things to other >> operating systems. >> >> I just now added support for macOS renameatx_np to Gnulib, so coreutils >> does not need to worry about the macOS details; it can simply use >> renameatu with the Linux flags. See: >> >> https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=af32ee824ee18255839f9812b8ed61aa5257a82b >> >> Even with Linux it's dicey. People may have older util-linux installed >> and so lack the 'exch' utility; this is true for both Fedora 39 and >> Ubuntu 23.10, the current releases. Ubuntu is also odd in that it >> doesn't install all the util-linux utilities as part of the util-linux >> package, so it's not clear what they will do with 'exch'. >> >> So I propose that we implement the idea in coreutils in a better way, >> that interacts more nicely with -t, -T, etc. Also, I suggest using the >> Linuxish name "--exchange" instead of the macOSish name "--swap", and >> (for now at least) not giving the option a single-letter equivalent as I >> expect it to be useful from scripts, not interactively. >> >> After looking at various ways to do it I came up with the attached >> proposed patch. This should work on both GNU/Linux and macOS, if your OS >> is recent enough and the file system supports atomic exchange. > > The implementation looks good. > > Re exch(1) on macos, I see util-linux is on homebrew, > so it would be relatively easy to ifdef renameatx_np in util-linux also. > > I think the --no-copy situation is brittle, as scripts not using it now > would be atomic, but then if we ever supported cross fs swaps > it may become non atomic. I'd at least doc with a line in the --exchange > description in usage() to say something like: > "Use --no-copy to enforce atomic operation" > > While the most flexible, it's also quite awkward to need > `mv --exchange --no-copy --no-target-directory` for most uses. > I.e. it's tempting to imply the --no-... options with --exchange, > but I suppose since scripting is the primary use case for this > flexibility trumps conciseness, so I'm ok with the verbosity I think. Oh also in the texinfo I think it's important to mention that the swap will "exchange all data and metadata". That's not obvious otherwise. For example users may be wondering if only data was being exchanged with the macos exchangedata(2) or equivalent. cheers, Pádraig From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Mar 2024 19:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 69532@debbugs.gnu.org, util-linux , Dominique Martinet , Petr Malat , Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.17109646859328 (code B ref 69532); Wed, 20 Mar 2024 19:59:01 +0000 Received: (at 69532) by debbugs.gnu.org; 20 Mar 2024 19:58:05 +0000 Received: from localhost ([127.0.0.1]:59973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn24Z-0002QN-KT for submit@debbugs.gnu.org; Wed, 20 Mar 2024 15:58:05 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:57813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn24U-0002PZ-0W for 69532@debbugs.gnu.org; Wed, 20 Mar 2024 15:58:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-voelker.de; s=s1-ionos; t=1710964632; x=1711569432; i=mail@bernhard-voelker.de; bh=BnVtolgxNvULnkjEGPPfr5zaj18a8PAVNVTD79Tz0jE=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=VR/+43gHqzA9Er/oSuHkWRwhsYeCPicMPihDU+0E1tCCaNMF0EaehUw7Q9MiNdtt gpQad9fuaHuLaqTskK1lJCzC4/Jus4oe3fiEganau8c9i5QGIMc6/UJSDvcum2ttH ECx9SqOK9vMPyUspHY72Hv7webr4D1P5BkM+JC2YS9SjIJjpi9Qms0KMtNwkre4mb oIVfpkggXAUI6U2pgMbhWQ/d+1GQKfh6RO6aCBHbOvVbEJO8Syacu96qfebqKLei0 yGmR98CAibSu8cnvd94pq/ECWblW0LzF33FI9feVzYFMFAwZAKYJy3PMNJACrfIri zJcpArHEvDkxEW80YA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [192.168.101.10] ([91.49.76.118]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M2wCg-1rluqo17rY-003NaW; Wed, 20 Mar 2024 20:43:42 +0100 Message-ID: <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> Date: Wed, 20 Mar 2024 20:43:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> From: Bernhard Voelker In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:/DXl5kLeKeS+P9p+d2yonwdq7pkwuOyjf7QwXlr16XVyPrZ5GdX jPo7JJhsETtUqJWF5VAK9yrfPcFGgRVeWweTtpvPVxZ9CbfUnW/bxyEdYDpeHkr7Kv3QNir Wf1Fk0z6b7b7i27F6yG7XIozUbcT0DGoVNs/eRHWzsgFY4Tka8b1xiTtLx6UHgqfsfvDc2Q mJ7wRtloOjw/Yqd5h4msg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:/xtiPkqui5k=;hvx1R0p8lsi4b3A6wF8gC43A16X WyRrOEFwMAWnGhE4veWfRyVEDyzTdpO5ei117m2gCCpV3g4pPK13yvXCZkViY89uiiacN/IrJ Hp5wPJYGwElAwjW4KbMbo3pLrXoIm+Xi+W9Rakjz4OS458XFAdrdGzZ5X5yjlshrDVeAzLImf CIQYxSpzn8G5iuPorOqEFXnLdVR+Uak9TJvq9gJva9yahMu3EiiPCHwNJI0hyZ6Q+eVxfzlHS JScZfoZUK6/I7Umn7UAs6Ga00EbLFJ9dwPexikjM5IxNx+aCva4ViTNZdegd+IgpHnA/Tsh5Y 9vqdrvaLffi8wdlY6KUeVm5kXIy1iL0N+r03Y8N9F66gesK//2dmzWUhGZP9RkVIvpWzhS5BC IF3UdG7U+qlLtf+Ben5UnyTcezqvEijSaC75kSC6/nWikzQjEDWibPn/SAcuyDNWiDlVfz/pv powDFZrlIhYOaKZadrgL8hDV6TGxFWnKWmJhhXmB41bWCq9wJpYPfXK8aDAaoqGkGsv3AqIpD p1iAVAexZOm7Cih46azi/edS7i/M2/2ANO2aGcDbsw6w0vtNTHA4kq/yVydylOYHux3Rxvqwc ymXrlAywkjRCdZxxxLlj1tYrQQJmmUu16gYHczZxAVcB2qM2Fjp7Tr7iQURFjmVrXDHHkis2n QclAEapFHuQP7BSXlLLqHDvmFrIiIqKpCgoMJMFAcVAIiHE++3sQctf4B876HwJYSX+u1bmCS CIaIDrHMJwsUfWdHGCtojwm9Eto8pg6TqyTkwRY7cntiLVwjpPZNYs= X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/17/24 07:10, Paul Eggert wrote: > Although removing that "mv --swap" implementation was a win, I don't > think we can simply delegate this to util-linux's exch command. I still have some headache adding this. This stems from the fact that although mv(1) is a userland frontend for renameat(2), the user interface is different: while renameat(2) deals exactly with 2 operands, mv(1) has always been able to work on more arguments. Now, extending "exchange" to more arguments is confusing and the use is not intuitive: mv -v --exchange a b c d An "exchange" can literally only be applied to 2 files, and 'exch' is IMO fine. I have the gut feeling that we didn't think through all cases, and that some might be surprising, e.g.: $ mkdir d; echo 1 > a; echo 2 > d/a $ src/mv --exchange a a a a d/a versus $ src/mv --exchange a a a a d/a Have a nice day, Berny From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Mar 2024 20:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 69532@debbugs.gnu.org, util-linux , Dominique Martinet , Petr Malat , Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171096825930242 (code B ref 69532); Wed, 20 Mar 2024 20:58:01 +0000 Received: (at 69532) by debbugs.gnu.org; 20 Mar 2024 20:57:39 +0000 Received: from localhost ([127.0.0.1]:34562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn30E-0007rh-TI for submit@debbugs.gnu.org; Wed, 20 Mar 2024 16:57:39 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:49700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn30C-0007rM-OF for 69532@debbugs.gnu.org; Wed, 20 Mar 2024 16:57:37 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id B4C4D3C0140A4; Wed, 20 Mar 2024 13:56:50 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id Q3L8QIb1HzAM; Wed, 20 Mar 2024 13:56:50 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5EB853C0140A0; Wed, 20 Mar 2024 13:56:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 5EB853C0140A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710968210; bh=y/tKou4brdzbJCh/VY4w1YNyxY6d8ViPIRvsRyoD+rs=; h=Message-ID:Date:MIME-Version:To:From; b=hOeBXU4Z2HPuKiMrwQECelG08IiOSbN9yFy52yWvnS1XLlR13YAIF5erCqQZ4GvWS K062SO1kP19xUjfQCybjuo70uUXYdaz6E+wwKqgheG/GYcbRUjF7dbCP6jHr8glzSR Gf0fKa0duR8jzP7T0O5XHcu+nayrXhm0EbmaX/HiKufavTAM3JoMaKLCV7RYXdvXzM kXRBKOvV6XudUQFAJ+VvItQZ3NJ4o4VOGUN8/XWM9kYzyyYE1FEdg3wwBSvGNFgwFD ojr2O7sXDMzvz8Dg9VP2rX8NvjkSulMO+Hke3R9vPDTT0ZLGsbf6UHLOTEcByze4eg WIbqdwdXrCfXw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 9JECOFSqSffq; Wed, 20 Mar 2024 13:56:50 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 3C62B3C0140A4; Wed, 20 Mar 2024 13:56:50 -0700 (PDT) Message-ID: <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> Date: Wed, 20 Mar 2024 13:56:44 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/20/24 12:43, Bernhard Voelker wrote: > This stems from the fact that although mv(1) is a userland frontend > for renameat(2), the user interface is different: > while renameat(2) deals exactly with 2 operands, mv(1) has always > been able to work on more arguments. Yes, that's mv's original sin, which we cannot realistically change now. > Now, extending "exchange" to more arguments is confusing and the > use is not intuitive: > =C2=A0 mv -v --exchange=C2=A0 a b c d >=20 > An "exchange" can literally only be applied to 2 files, Sure, but that's true for "rename" too: a "rename" can be applied only=20 to 2 files. When d is a directory, "mv a b c d" does three renames so it is like "mv=20 a d/a; mv b d/b; mv c d/c". This remains true if you uniformly replace=20 "mv" with "mv --exchange", which does three exchanges. > I have the gut feeling that we didn't think through all cases, > and that some might be surprising, e.g.: >=20 > =C2=A0 $ mkdir d; echo 1 > a; echo 2 > d/a > =C2=A0 $ src/mv --exchange a a a a d/a >=20 > versus >=20 > =C2=A0 $ src/mv --exchange a a a a d/a I don't understand the word "versus" here, as the two examples look the=20 same to me. If d/a is not a directory, the example is an error, just as it would be=20 without --exchange. If d/a is a directory and you have permissions etc., "mv a a a a d/a" is=20 like attempting "mv -T a d/a/a; mv -T a d/a/a; mv -T a d/a/a; mv -T a=20 d/a/a". If you use plain "mv" only the first "mv -T a d/a/a" succeeds=20 because "a" goes away, so you get three diagnostics for the remaining=20 three "a"s. If you use "mv --exchange" all four "mv --exchange -T a=20 d/a/a" attempts succeed, and since there are an even number of exchanges=20 the end result is a no-op except for updated directory timestamps. So I=20 don't see any ambiguity about what mv should do with this contrived examp= le. From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Mar 2024 22:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.17109726768399 (code B ref 69532); Wed, 20 Mar 2024 22:12:02 +0000 Received: (at 69532) by debbugs.gnu.org; 20 Mar 2024 22:11:16 +0000 Received: from localhost ([127.0.0.1]:36165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn49U-0002BO-D9 for submit@debbugs.gnu.org; Wed, 20 Mar 2024 18:11:16 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:34326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn49R-0002B7-Aa for 69532@debbugs.gnu.org; Wed, 20 Mar 2024 18:11:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 427283C0140A0; Wed, 20 Mar 2024 15:10:27 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id wd64pYJJM46P; Wed, 20 Mar 2024 15:10:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id DEC7F3C0140A4; Wed, 20 Mar 2024 15:10:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu DEC7F3C0140A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710972626; bh=53dNscFbpWPr2qXrhA+NTEzYWA9iYoyOSfG9vgTei34=; h=Message-ID:Date:MIME-Version:To:From; b=bCv/GUilduMZ/MR6Lstn9y407OuMP4Cu57VZoepOOBbOlgDSq779nDwFC86QAgc/x 81byGbbte/fDyyj1n7B2jT1adVzzNdfsXvhkvK1PxVkQBoLMXNVSIq4U6rgFAAuBsB dNOe2zBQAfx+D4DsgE8YrUPIQifDRx4VUKGAfCHzP9Y739+8lnlCPPMb+YCT17HiC1 Snyu1Qog5m/SjimWUn+io0uWf8ChNFrk3ebpZNcrnmoHQGAnVQZhQcwuHLdFvvo6GI ZQ3quwXlSAX1b151N5Se+u74J3XZNFY5ekjMsDmcII9QVeFJ9LSBpa/+t3B77Vu3mq IRt25y1raD/xA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id tZGSG9PYpaTX; Wed, 20 Mar 2024 15:10:26 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id B049E3C0140A0; Wed, 20 Mar 2024 15:10:26 -0700 (PDT) Message-ID: <5db5740d-307f-4d6f-91a4-8451bb24e11a@cs.ucla.edu> Date: Wed, 20 Mar 2024 15:10:26 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <5308840a-9de4-33d0-2520-5f3addc9718c@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <5308840a-9de4-33d0-2520-5f3addc9718c@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/17/24 04:32, P=C3=A1draig Brady wrote: > I think the --no-copy situation is brittle, as scripts not using it now > would be atomic, but then if we ever supported cross fs swaps > it may become non atomic. I'd at least doc with a line in the --exchang= e > description in usage() to say something like: > =C2=A0 "Use --no-copy to enforce atomic operation" But --no-copy doesn't mean atomic operation; it simply means don't copy. On systems that don't have an atomic exchange, we can emulate "mv=20 --exchange --no-copy a b" with three calls link("b", "b.tmp");=20 rename("a","b"); rename("b.tmp","a"). This wouldn't copy, but it=20 wouldn't be atomic. Although atomicity is important, currently the coreutils documentation=20 doesn't cover it and the code doesn't always handle it well. For=20 example, if A and B are regular files "mv -b A B" briefly has a moment=20 when B stops existing. To my mind this is a bug: an existing destination=20 shouldn't stop existing merely because you're replacing it. At some=20 point this stuff should be documented better and this (and probably some=20 other) atomicity bugs fixed. One thought I had while looking into this was that we could add an=20 --atomic option to mv and ln, such that the command fails if the=20 destination cannot be updated atomically. That would be a stronger=20 option than --no-copy. (In some cases we could support --atomic even for=20 'cp', no?) Anyway, for now I installed the patch with some minor changes to the=20 documentation's --exchange section to try to document this tricky area=20 more clearly. Here's the revised doc section. It also incorporates your=20 later suggestion to mention both data and metadata. ---- @item --exchange @opindex --exchange Exchange source and destination instead of renaming source to destination= . Both files must exist; they need not be the same type. This exchanges all data and metadata. This option can be used to replace one directory with another. When used this way, it should be combined with @code{--no-target-directory} (@option{-T}) to avoid confusion about the destination location. For example, you might use @samp{mv -T --exchange @var{d1} @var{d2}} to exchange two directories @var{d1} and @var{d2}. Exchanges are atomic if the source and destination are both in a single file system that supports atomic exchange. Non-atomic exchanges are not yet supported. If the source and destination might not be on the same file system, using @code{--no-copy} will prevent future versions of @command{mv} from implementing the exchange by copying. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 20 18:12:23 2024 Received: (at control) by debbugs.gnu.org; 20 Mar 2024 22:12:23 +0000 Received: from localhost ([127.0.0.1]:36178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn4AY-0002DT-L4 for submit@debbugs.gnu.org; Wed, 20 Mar 2024 18:12:22 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:50076) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn4AW-0002DF-GG for control@debbugs.gnu.org; Wed, 20 Mar 2024 18:12:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 89FCA3C0140A0 for ; Wed, 20 Mar 2024 15:11:35 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id G0n3VfMeHmpt for ; Wed, 20 Mar 2024 15:11:35 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 468CD3C0140A4 for ; Wed, 20 Mar 2024 15:11:35 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 468CD3C0140A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710972695; bh=e0LDhy9eBbc8YeDYjyp91cD2qGW1+n2ZYJLSoMidq6U=; h=Message-ID:Date:MIME-Version:To:From; b=ZdniDd3QYch7W11CcwZMxuvFeg5pBswoTasvo1IUzTw26GyKj8vZ1NyyoY2k1+ZQs Fq+w0qFeuGmZhgIWoyaes5wu7znn22M17F6ev12UM2mvhA/9O7PYaZSfo0EEWG8j18 vjogSqqWSwQUep+3zbTrazztSCiwxsBIT7WuMU5e16gxtl+rJHYgSHbyJKegwW+bCE fesOfcKOiDKX5QkHS8V6XNXJXR7ORrQ9vjvQvseiUudXN6XNgVoc/9kfP2ld3Y/PTe 7Y9a0TN/gjJpvMcmAhyU4LJ4UxvuNza8futgjXUjFCDGY+74yBo1ezNWJRU+PXt9GD TO+yN25fWg7fQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id EH1eIJWGoy0f for ; Wed, 20 Mar 2024 15:11:35 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id CF2DE3C0140A0 for ; Wed, 20 Mar 2024 15:11:34 -0700 (PDT) Message-ID: <3672d3e9-a718-496b-9c7c-1cdaef4e8340@cs.ucla.edu> Date: Wed, 20 Mar 2024 15:11:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: GNU bug control From: Paul Eggert Subject: close 69532 Organization: UCLA Computer Science Department Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control 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: -0.1 (/) close 69532 From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Mar 2024 22:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171097524725696 (code B ref 69532); Wed, 20 Mar 2024 22:55:02 +0000 Received: (at 69532) by debbugs.gnu.org; 20 Mar 2024 22:54:07 +0000 Received: from localhost ([127.0.0.1]:36940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn4ox-0006gO-1V for submit@debbugs.gnu.org; Wed, 20 Mar 2024 18:54:07 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:51553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn4ov-0006fq-8r for 69532@debbugs.gnu.org; Wed, 20 Mar 2024 18:54:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-voelker.de; s=s1-ionos; t=1710975187; x=1711579987; i=mail@bernhard-voelker.de; bh=jsyJTLQUd61oOlFwsqStZDqw45pazUxe4EIgIKYBZe4=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=omtTHzuOIwpXHghIS5RXZAQl3Ti2pYQW1ZB6XCRrgr7dcRNj/ji1xanIryINXmU6 M0CjVTCHwI4jHGkzv8CKLrxyqG0HQvQ0xKUL5CGnWrEEDUAXHRZ6KMP8Id46L6BdO FLLOs2DR+Z2J3tXbHjnNfKg/K8lWu6ZI1y3uNYUyJJMtyjXW1Ojn+Ptdq57wcp54y luCWRalMbQpSnZnu2LyDOJnOufRiIp3AH/mgfTl6620oqqoS5S1/FnPxkIwHvYMhg SrvVrDd6IjBgEx0GM1Bp7VycarwrLb9QxONf3t63yq3vbAqA+cT7daaE5DSYefqWa 6bU3vrfMgrSyheTLTg== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [192.168.101.10] ([91.49.76.118]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MrPVJ-1r158u2ByJ-00oZ9M; Wed, 20 Mar 2024 23:53:07 +0100 Message-ID: Date: Wed, 20 Mar 2024 23:53:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> From: Bernhard Voelker In-Reply-To: <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:AUw4Pt2ulRQRdoCBo0gUeiPJ4PBLHNJaxRQMmpj2TPJOzGkvU/b eyJoC2BR3XCrkoiapi6+Q6OhbfWPbwgmFEUp0qiLCMP2zmkDPb9xEuD92yJcAhPGVGBsWrz KrS9PpmeBmLrm1MvboaAUBKK7JQOEVQhrFIiEG+LSBFrSu9xgTRy7ch/KgSyvwR7fEgwIsg eG7lHzhnEyUFsCvLaW1vg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:rkUmp5oMJ/Q=;aNHUdPuEkhaq5y37BXjOaen7r+P Ux66cp+bKrg/26Ugsq0PynKv4Jd/IvfZaRefEDjcmuFczQ5/GJHCzNhS1q+ytxZJaRGUMzWKL 4eFW9N8/tVhRbz+xwhStFH1FoV+Vs36+mtsUMNO+ZnlRTiUrAPliU1LHtosrdssKjJ1tzB9yt YQ7sC6Rty+In4FnfLjAWTQS0O7ZCBha2U8WMItlGBLDPTCaR+PaqUe4fIXa2Z5qMCwm8aM75k G4sZH9ub30iDZDRlTpKC/u6tQ0wdF24Nl666SycJQoX/NBu7A/YlV43tr366seN1ql82/MwOU Yxj7XFEnTevR99B4jy0p2xRBf5goZ9XOQKcTZj5pePmLH9C2iO2PaRwfMORmbCdIuXng6W/DF R+Rv6CPXVURV0bqnH5OD/URvlnftg7CwMXqh6JA47+LcvQz9PZiFnY2CSlXPFlLJnepJNJEe+ qtHdv7euoG28VVM79DRf/tfRf029lS6iqGfNZgvBWq6V6oID4wlLTMIQtZvg7B/A+MUTxu2oj kCS9J1A7LqDm/t8WOLuip+JoEd2zNkkokXNl5Pp03QHznczZ/LNc6BUU/xkuh7wN5b2s1fYIC DOOK/1I4EQw0Y3fgCN0UZnWIzX3qqntUP8XeZ+hnFq9kKgof7ecBX7ewt6igWyZOy0CiX45Gg RllkFPA+MIXMLZId4iaNc6goUjQbwnKttnjKceIbWpguxETsY2CCgJt8ILtdJrQk33P1cedwl 9gr+BMJlsx6TbKhSURIACMWf2/uFE13fCBwkZ0IPOjTysn8bP2ijr4= X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/20/24 21:56, Paul Eggert wrote: > On 3/20/24 12:43, Bernhard Voelker wrote: > >> This stems from the fact that although mv(1) is a userland frontend >> for renameat(2), the user interface is different: >> while renameat(2) deals exactly with 2 operands, mv(1) has always >> been able to work on more arguments. > > Yes, that's mv's original sin, which we cannot realistically change now. I wouldn't go that far that it was a sin. It's useful and people got used to it without having to think about it. >> I have the gut feeling that we didn't think through all cases, >> and that some might be surprising, e.g.: >> >> =C2=A0 $ mkdir d; echo 1 > a; echo 2 > d/a >> =C2=A0 $ src/mv --exchange a a a a d/a >> >> versus >> >> =C2=A0 $ src/mv --exchange a a a a d/a > > I don't understand the word "versus" here, as the two examples look the > same to me. sorry, I messed the example up. $ echo 1 > a $ mkdir d $ echo 2 > d/a $ src/mv -v --exchange a a a d renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' $ cat a 2 $ src/mv -v --exchange a a a d renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' $ cat a 1 $ src/mv -v --exchange a a a a d renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' renamed 'a' -> 'd/a' $ cat a 1 I remember some implementation where mv(1) really was just a rename(2), which failed when crossing file systems. Was it some HP-UX or Solaris mv(= 1)? mv(1) has learned to copy+delete over time, which is what people would expect from a "move". My point is that "exchange" is a different functionality. It's well somehow belonging and related to what renameat(2) is doing in th= e kernel, and therefore it comes in handy that we can simply call it with an additio= nal flag. Yet it's IMO a different operation. I bet there had been discussions whet= her to create a new syscall, but apparently it was easier to put it with a fla= g into an existing one. Fine for the kernel. On userland OTOH, we have broader choice. Karel did his choice in util-linux for exch(1), and coreutils could expose the same functionality. For other feature requests, we were much more reluctant in coreutils ... f= or good reasons: feature bloat, maintainability, etc. So I'm asking myself what is different this time? - The feature already exists -> util-linux. - Okay, we're using the same syscall, renameat(2) -> it's tempting. - How large is the useful overlap with the existing code of mv(1)? Not much: no traditional rename nor copy. - How large is the useful overlap with the existing options/modes of mv(1)= ? - exchange contradicts --backup, - exchange is not useful together with options working with a regular rename of copy, at least: --update, -Z, -n. - not sure if exchange works well together with -f. I'm currently only 20:80 for adding it to mv(1). The functionality is cool, but do we need to press it into mv(1) with so m= any incompatibilities just because it's requiring renameat(2) we already use? Maybe to consider: One tool for one thing ... means another tool for anoth= er thing. Again, I have the gut feeling that we've missed some cases to think about. And once the feature would be in ... Furthermore, why does exchange not work to exchange a regular with a direc= tory file? We've all learned that everything's a file, so it cannot be explained to u= sers that exchanging a regular file with a directory doesn't work. Finally, the test cases are very sparse: no cases with different owners, d= ifferent directory permissions, different file types (if we know already f<->d does= n't work), triggering races, etc. I don't really want to object to add it, but I find it quite odd as of tod= ay. Have a nice day, Berny From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Rob Landley Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Mar 2024 23:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker , Paul Eggert , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , 69532@debbugs.gnu.org, util-linux , Karel Zak , Dominique Martinet Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171097897432405 (code B ref 69532); Wed, 20 Mar 2024 23:57:02 +0000 Received: (at 69532) by debbugs.gnu.org; 20 Mar 2024 23:56:14 +0000 Received: from localhost ([127.0.0.1]:37122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn5n3-0008Qa-PA for submit@debbugs.gnu.org; Wed, 20 Mar 2024 19:56:13 -0400 Received: from mail-il1-f182.google.com ([209.85.166.182]:49235) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn5n2-0008QL-8p for 69532@debbugs.gnu.org; Wed, 20 Mar 2024 19:56:12 -0400 Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-368650da308so186245ab.2 for <69532@debbugs.gnu.org>; Wed, 20 Mar 2024 16:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=landley-net.20230601.gappssmtp.com; s=20230601; t=1710978867; x=1711583667; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3NzsgalDpt3X/u2NbkXOKZFM5qtBMcfLV7J3km0Lm5k=; b=lmPCMjZEJZnd9RXjlLroez2uuo08JOdXXtd0fbcFkPLtGk1tglHFUfTjqLyzZtYxNE NoB9IeIrRuu2tqvV2akJHh3ouvQShWcfCIKJkvCwue+b/Hw0VpaasXPw/gjUo+Exaorf aJwMv2Ig+qoLzc8VRzDzSnLuGOepqXiMOd24DYUO1r/RlQjPt7tU5cMUWOV3tmuQWrUw PpWbhztiwS4/L3ZMgjZVOfQd+uJSRCpTs7dxGSvYwo3OD/WosehhwwrbkvmReJINRdQT vLZOCwwjxL0mRXVScCs++zopsZGmkLZuDwN8V7zxPG9b7bvRmK9G2RXV+8vSUQggmc1c 0H6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710978867; x=1711583667; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3NzsgalDpt3X/u2NbkXOKZFM5qtBMcfLV7J3km0Lm5k=; b=GYYynGvi6rEfM7gF9lk8tCygSudlF3yGnUoHlH6opx0aioLAp5xc3vj/PqcQktiZdg REVtThRV3iyqfOHYOVWzH2C4SMO0/A9Jh9PaJS143idFrluYXmNEY01M9HjToP+U96OR OHuCQ6mlw6HfdITxo95y8o4JOyi8cv6VUyO327yC4z8KEa+69jQkggG2qC7io5ZRcc5w R0rxwY5Ai2Zu3tCRP9poVvGEVHAh51pPsFFAtKVo2y1HnSOfMlQQGGnu9mQKheJ6/H7I hoQjZUSXnmeij1wu+S8brsEnBgARve4Ab0Yoo2Kq3KCmFIfqBKapAlMgLqH8RHjZ55Zc kXpA== X-Forwarded-Encrypted: i=1; AJvYcCWovVSn6MUaILYVif9PDhOq8Ag0pubbR0UViJFWN3pX8ad9O4OcE5tANpPCpyQJ/Oc1jKOo5C99GkqFbbuf+NfEA18lrhI= X-Gm-Message-State: AOJu0YxD3WY/uqrUXFaSUmbiSTuozTJsVhGSLIfG0SNjHdKKZgz4Gr3W h4Mg0IMNUxkeF2byurbhS9odTSXExl2uRIqwzlRDTuUkdHzSC6e1UR1IrJZkdaM= X-Google-Smtp-Source: AGHT+IF/5aNP6ZYnIyWJ827jffp8nmmuZOe0YE/YtulkKLljl8gLYWjzLnB4Gm3/IsEb6ueG9ZRlag== X-Received: by 2002:a92:dd89:0:b0:367:82b5:555d with SMTP id g9-20020a92dd89000000b0036782b5555dmr394628iln.8.1710978866972; Wed, 20 Mar 2024 16:54:26 -0700 (PDT) Received: from [172.16.32.83] ([198.232.126.202]) by smtp.gmail.com with ESMTPSA id p17-20020a92c611000000b0036697c6315asm3400016ilm.87.2024.03.20.16.54.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Mar 2024 16:54:26 -0700 (PDT) Message-ID: <5fb89ff4-74fc-7391-5dde-f6ad24132b34@landley.net> Date: Wed, 20 Mar 2024 19:03:09 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> From: Rob Landley In-Reply-To: <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.3 (---) 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: -4.3 (----) On 3/20/24 14:43, Bernhard Voelker wrote: > On 3/17/24 07:10, Paul Eggert wrote: > Now, extending "exchange" to more arguments is confusing and the > use is not intuitive: > mv -v --exchange a b c d It's also pointless. An atomic exchange on more than 2 files ISN'T ATOMIC. That's why I didn't do it. You already had "mv -T" requiring exactly two arguments, so thinking mv -x has cooties because it works the same way is just weird. > I have the gut feeling that we didn't think through all cases, Sounds like. Having mv modify its source directory during recursive descent is creepy. Toybox implemented: -x Atomically exchange source/dest (--swap) Which behaves like: $ ./mv -x one two $ ./mv -x one two three mv: -x needs 2 args My change from this discussion was adding the "--swap" synonym you wanted. Rob From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Mar 2024 23:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 69532@debbugs.gnu.org, util-linux , Dominique Martinet , Petr Malat , Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171097904232518 (code B ref 69532); Wed, 20 Mar 2024 23:58:01 +0000 Received: (at 69532) by debbugs.gnu.org; 20 Mar 2024 23:57:22 +0000 Received: from localhost ([127.0.0.1]:37127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn5oA-0008SQ-44 for submit@debbugs.gnu.org; Wed, 20 Mar 2024 19:57:22 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:36480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rn5o7-0008SC-S6 for 69532@debbugs.gnu.org; Wed, 20 Mar 2024 19:57:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 372AF3C0140A0; Wed, 20 Mar 2024 16:56:34 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id aabSwXU3zZT9; Wed, 20 Mar 2024 16:56:33 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id C87573C0140A4; Wed, 20 Mar 2024 16:56:33 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu C87573C0140A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710978993; bh=D5qLNRZIIU2ePWcIgK6Jz5FhdW88fwgXCaBV5/aPmLI=; h=Message-ID:Date:MIME-Version:To:From; b=Po+694Xu1lP1w83lYBqJXPBv5O0emUu/O9C0xkrpJqnszXABY3vlONTHImmCHX2x6 wFINGIRnBQs5qhsxcz39BVm2I0JOSGGoiKnLzbAUj2ltuTrBwxj7PT5AybhdWJvii1 dkQ0cemnONYfLoXriQ4YJxZ4n23KQbRI1dJZ5yqA7RF1rqpQqD1JU8Z69ArhX5S8xs BLFpLKuFg7spoSVD/idVqoRGzAdRjty6xUlDs+9FHZJQ5K58i/caJlQMSb4n1uVFgR igRFbDBhgUD9bzNsIqO6O1DAdfq+BKF+NIRS7n78xrZ62kH7WhZ22poXzEBP93GuCJ hjFGYaPPokRxA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id unVHSK5E99S9; Wed, 20 Mar 2024 16:56:33 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 9B8163C0140A0; Wed, 20 Mar 2024 16:56:33 -0700 (PDT) Message-ID: Date: Wed, 20 Mar 2024 16:56:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/20/24 15:53, Bernhard Voelker wrote: > =C2=A0 $ echo 1 > a > =C2=A0 $ mkdir d > =C2=A0 $ echo 2 > d/a > =C2=A0 $ src/mv -v --exchange a a a d > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 $ cat a > =C2=A0 2 > =C2=A0 $ src/mv -v --exchange a a a d > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 $ cat a > =C2=A0 1 > =C2=A0 $ src/mv -v --exchange a a a a d > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 renamed 'a' -> 'd/a' > =C2=A0 $ cat a > =C2=A0 1 Yes, that's the expected behavior for this contrived case. Just as one=20 would get odd behavior if one did the same thing without --exchange. > I remember some implementation where mv(1) really was just a rename(2), > which failed when crossing file systems. Was it some HP-UX or Solaris = mv(1)? I doubt it. Even 7th Edition 'mv' (1979) fell back on 'cp' when the link=20 syscall failed (this was before 'rename' existed). > My point is that "exchange" is a different functionality. Yes, but it's closely related. Arguably --backup is also a different=20 functionality too (and arguably --exchange is simply an alternative=20 backup scheme!) but 'mv' has --backup. > - How large is the useful overlap with the existing code of mv(1)? > =C2=A0 Not much: no traditional rename nor copy. I don't follow this point. The code change was fairly small, which=20 indicates there was a lot of overlap with existing functionality. > - How large is the useful overlap with the existing options/modes of mv= (1)? > =C2=A0 - exchange contradicts --backup, That could be fixed for regular files, if there's a need, by backing up=20 the destination via 'link' before exchanging. For directories it's=20 admittedly a problem, but that's also the case for plain 'mv' (or for=20 'cp' or 'ln', for that matter) so there's not much new here. > =C2=A0 - exchange is not useful together with options working with a r= egular > =C2=A0=C2=A0=C2=A0 rename of copy, at least: --update, -Z, -n. It should work with --update and -Z. -n of course is logically=20 incompatible, but this not the only set of logically incompatible=20 options (e.g., -t vs -T). > =C2=A0 - not sure if exchange works well together with -f. What problems do you see there? > why does exchange not work to exchange a regular with a=20 > directory file? It works. I don't see a problem there. $ touch a $ mkdir d $ ./mv -T --exchange a d $ ls -ld a d drwxr-xr-x. 2 eggert eggert 4096 Mar 20 16:52 a -rw-r--r--. 1 eggert eggert 0 Mar 20 16:52 d > Finally, the test cases are very sparse: Feel free to add some. :-) From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 21 Mar 2024 21:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171105759018723 (code B ref 69532); Thu, 21 Mar 2024 21:47:01 +0000 Received: (at 69532) by debbugs.gnu.org; 21 Mar 2024 21:46:30 +0000 Received: from localhost ([127.0.0.1]:38656 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnQF4-0004ru-3q for submit@debbugs.gnu.org; Thu, 21 Mar 2024 17:46:30 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:53245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnQF1-0004rQ-8E for 69532@debbugs.gnu.org; Thu, 21 Mar 2024 17:46:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-voelker.de; s=s1-ionos; t=1711057526; x=1711662326; i=mail@bernhard-voelker.de; bh=ATx4+0ICmBNQwgurRPS4yT+RJF+a071y5R+BTVUa4/c=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=ktaZYLbw4QxyxU2tie4Tnhg26wuH7/CE30y8ZozfoSB350M6YsD8Qn7JhLzEQhSD I82rDhL2/l2bDCygZNX6OXOiMKbJPxl+30tRwPjaqYG8/c/fzlviQGiQ12TaRgCap gM7w9axhP/dhRO11klQcsaw7NbLrenSvJnfRp2sCMOKdv4A+a41AI7lghp+nVJ5dp m0v1cmtNShH64m5X7mGfllg9m5vpnAqLh4eZpQ7o0U2fEq3+q8o8Pr9iMz3LF1P3g XOWIviH7Bt+UhnoU/DB7vO0RlTZwMlZ8OBRPxs2V2o10ASHWHNFl3lLacpWFTkFbg hmNlKL0k6mKfUquJhg== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [192.168.101.10] ([91.49.76.118]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M7JrG-1rfjeU0Ypw-007oE3; Thu, 21 Mar 2024 22:45:26 +0100 Message-ID: Date: Thu, 21 Mar 2024 22:45:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> From: Bernhard Voelker In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:OD3B9/ctLfwk8eitD6WCbD0eW3ZvcFj4GeiqkuMY7gqQfZLYh5r fAUsNA4xXmE2SIR/H0TiiQ2Cp8MU9EZHBKrY592iCKfrx7XqmVMc7C7zrBtqukCbthGiedf oWfAMMTUwBypkxsX1luiBC5VjYrJNxe7ja93yDb4vDP4itA4/g9qs1XliiJ8sFn6JwjY1Wi CEutdZVzlLHLUd5E98Rww== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:Tpspq5xNKl0=;+stEOdDku/VufBtlYDtEIJUgjIA Kp+JXnSe6bO7tWugfabAWT6PZIo2jdeCgWbZwH/Qec+AjY+uXOVfhepw1x7zakL/Sgw9JAOOa enq6b5q9LKpsvNqBwBDfXYB1SP+FYa874TUXm8N9ieIJULESZfa0sXCDSGLVSpS9+ZuMlvMwq Mh4+A1ohcm1Eh2t3OGSyvAqX5CVnBtD43q+Rt3bVL+Nza98rGUf+SbiNurbf/MM+Vhk9vThSs ScPhDMDqljOKGuXxnCjs8J7nnGr1TsbIf/FoZTiCenBWfxK2kGqAc0yQSYTugt7NrgPYUBIxH sXrbw179XOVsSgqRtU6BqHPZsVN5bra0Z2mCERUsBhqses2LrGbImj/+Wcqm5we47ruMCqtlH neFDNlDeki8t0UufbDjQ7UoSvWkvOSDPWo8/+xyn29R1p1evLicE0lIQS7CYIlO3/LRtLUWCG eoaS9gi/OGsN4UUBif4jIM86Lmhd6h5TJoA+J4SC+s2qcLFGb5yUaLqskWR6tqwe+kcUJCKoQ WmuHwMw2bEA9iKROF1SBhBF7BesO+CQUiiy8UtY724nsJxXmwfaGbNQkV5Kd2u9wTrJlP2P46 CNZnptQdW/K5BOFa8qsXOXIZM3fH/7Ma1TQSqdiSMBoaFGS9sCJBUDzhnOHdQHVFVzGHGmgoZ 5fL0b2EIzZvlGGiQKloeSu8bE9lJST1eMWjQeUpguC9og5+NROUnDRp6VTLxxfWAE2k0i1ni3 gcI36SrjWPx8C4L2gfjdZBNpoIm8xgqbxelNq0/oWMWJuAkshplfzg= X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/21/24 00:56, Paul Eggert wrote: > On 3/20/24 15:53, Bernhard Voelker wrote: > Yes, that's the expected behavior for this contrived case. Just as one > would get odd behavior if one did the same thing without --exchange. There's another which is not consistent with/without --exchange: $ src/mv -v a a src/mv: 'a' and 'a' are the same file $ src/mv -v --exchange a a renamed 'a' -> 'a' RENAME_EXCHANGE is allowed (but useless?) for 1 file. BTW: shouldn't the -v diagnostic better say "exchanged 'a' <-> 'a'" because that's what happened? >> =C2=A0 - not sure if exchange works well together with -f. > > What problems do you see there? it's up to the tests to proof that. >> why does exchange not work to exchange a regular with a >> directory file? > > It works. I don't see a problem there. > > $ touch a > $ mkdir d > $ ./mv -T --exchange a d > $ ls -ld a d > drwxr-xr-x. 2 eggert eggert 4096 Mar 20 16:52 a > -rw-r--r--. 1 eggert eggert 0 Mar 20 16:52 d indeed, it works. It seems my test was wrong, sorry. >> Finally, the test cases are very sparse: > > Feel free to add some. :-) Unfortunately, I cannot currently spend as much time as I'd love to. It seems that -i is skipped: $ src/mv -iv --exchange a b renamed 'a' -> 'b' As far as I know Padraig would like to do the next release very soon, so I would recommend to not hurrying this one into it, and instead ironing all out after the release. Have a nice day, Berny From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Karel Zak Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 22 Mar 2024 10:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: Petr Malat , util-linux , Paul Eggert , Dominique Martinet , 69532@debbugs.gnu.org, Rob Landley , =?UTF-8?Q?P=C3=A1draig?= Brady Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171110305131890 (code B ref 69532); Fri, 22 Mar 2024 10:25:02 +0000 Received: (at 69532) by debbugs.gnu.org; 22 Mar 2024 10:24:11 +0000 Received: from localhost ([127.0.0.1]:40657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnc4J-0008II-1N for submit@debbugs.gnu.org; Fri, 22 Mar 2024 06:24:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnc4H-0008I6-0P for 69532@debbugs.gnu.org; Fri, 22 Mar 2024 06:24:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711103007; 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: in-reply-to:in-reply-to:references:references; bh=o5sPM2Batsn22gB3Xn2YlCAHaTr6jCqx4AgiquccGOk=; b=eyQR2pjztDY87CYIYR9/JBVPXCjQOYB8aQQXup40uW9tfCPAtidm4WJC8ak+VN8p/JTl1j yMCIVXQWvZOqzjpNliNGLf0ZYAkgzRUh8sJ7G07KVsWV/pZ8LRasqtjHAIPEv5t56E8ggm 6FtkOoKN6ND47PNq27kcr0bwE7eSfV0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-cC8vSq0wM1agWRa1YyRg3A-1; Fri, 22 Mar 2024 06:23:22 -0400 X-MC-Unique: cC8vSq0wM1agWRa1YyRg3A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1BE12801584; Fri, 22 Mar 2024 10:23:21 +0000 (UTC) Received: from ws.net.home (unknown [10.45.242.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8FCB4073598; Fri, 22 Mar 2024 10:23:19 +0000 (UTC) Date: Fri, 22 Mar 2024 11:22:57 +0100 From: Karel Zak Message-ID: <20240322102257.ovv5kpnm4zsgtf7n@ws.net.home> References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Score: -0.0 (/) 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: -1.0 (-) On Wed, Mar 20, 2024 at 11:53:05PM +0100, Bernhard Voelker wrote: > On userland OTOH, we have broader choice. > Karel did his choice in util-linux for exch(1), and coreutils could expose > the same functionality. > > For other feature requests, we were much more reluctant in coreutils ... for > good reasons: feature bloat, maintainability, etc. > > So I'm asking myself what is different this time? > - The feature already exists -> util-linux. Note that we can move exch(1) from util-linux to coreutils if, at the end of the brainstorming session, the conclusion will be that mv(1) is a bad choice :-) > I'm currently only 20:80 for adding it to mv(1). I think the functionality will be lost in the mv(1) for many users. Karel -- Karel Zak http://karelzak.blogspot.com From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 23 Mar 2024 01:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171115886013276 (code B ref 69532); Sat, 23 Mar 2024 01:55:02 +0000 Received: (at 69532) by debbugs.gnu.org; 23 Mar 2024 01:54:20 +0000 Received: from localhost ([127.0.0.1]:38972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnqaR-0003Rz-15 for submit@debbugs.gnu.org; Fri, 22 Mar 2024 21:54:19 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:35250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnqaO-0003RY-SU for 69532@debbugs.gnu.org; Fri, 22 Mar 2024 21:54:18 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 116723C00E411; Fri, 22 Mar 2024 18:44:43 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id oqe3CpLK5I-E; Fri, 22 Mar 2024 18:44:42 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 6D2993C00E413; Fri, 22 Mar 2024 18:44:42 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 6D2993C00E413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1711158282; bh=8B2AzFDBaUbInB+EEwCel7UljC2jp7oK0m623rnGf3U=; h=Message-ID:Date:MIME-Version:To:From; b=K2kH7fo45N8BwU+RFvIdfUXHP020ihgbVBgzvcZKWWbSlzjvmZ/D6FYNhKYmMBiVF DgsjL7thvAb6J+2b5nMpJciNCGwgbJmTLWuy2dYxAzPWivxxuoF9f0MAH5xpGXHcYC dDYriasF2e6b73Y58YRofDNGG8CJ0qEMDV9hi5GMeqSGlfnCJxDgyNBFkkr8iTQtkF 3UE2Pq950HTUOADABSNYNWY7+iUw8et1IgXGHSVFDu/n0Gc9cxpwLIKtPy0qMzkk8+ yUreXDIu+GHeJ9YF1j0ZAEEcVXcaC7OkZsn2sDPu4FACBR9xdNUTDtTd+6UmhvDHML XbjkNk12F/xeQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id M5UWaFVP-mTZ; Fri, 22 Mar 2024 18:44:42 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 413DE3C00E411; Fri, 22 Mar 2024 18:44:42 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------fIjJrgD18tdHjNRAzoW8QqaV" Message-ID: <47c15dcf-3054-4a0a-9ca9-d9f7601db3ca@cs.ucla.edu> Date: Fri, 22 Mar 2024 18:44:39 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: X-Spam-Score: -0.0 (/) 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: -1.0 (-) This is a multi-part message in MIME format. --------------fIjJrgD18tdHjNRAzoW8QqaV Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 3/21/24 14:45, Bernhard Voelker wrote: > On 3/21/24 00:56, Paul Eggert wrote: >> On 3/20/24 15:53, Bernhard Voelker wrote: >> Yes, that's the expected behavior for this contrived case. Just as one >> would get odd behavior if one did the same thing without --exchange. >=20 > There's another which is not consistent with/without --exchange: >=20 > =C2=A0 $ src/mv -v a a > =C2=A0 src/mv: 'a' and 'a' are the same file >=20 > =C2=A0 $ src/mv -v --exchange a a > =C2=A0 renamed 'a' -> 'a' >=20 > RENAME_EXCHANGE is allowed (but useless?) for 1 file. Yes, thanks, --exchange should act more like non --exchange there. > BTW: shouldn't the -v diagnostic better say "exchanged 'a' <-> 'a'" > because that's what happened? Good suggestion. > It seems that -i is skipped: >=20 > =C2=A0 $ src/mv -iv --exchange a b > =C2=A0 renamed 'a' -> 'b' Yes, I suppose -i should be treated similarly too. I installed the attached patches to do the above. (Basically, the=20 problem was that my earlier patches were too ambitious; these patches=20 scale things back to avoid some optimizations so that mv --exchange is=20 more like ordinary mv.) The first patch simplifies the code (and fixes a diagnostic to be more=20 useful) without otherwise changing behavior; it's more of a refactoring.=20 The second patch does the real work. Thanks again. --------------fIjJrgD18tdHjNRAzoW8QqaV Content-Type: text/x-patch; charset=UTF-8; name="0001-cp-ln-mv-improve-dir-vs-nondir-diagnostics.patch" Content-Disposition: attachment; filename="0001-cp-ln-mv-improve-dir-vs-nondir-diagnostics.patch" Content-Transfer-Encoding: base64 RnJvbSBmZjQyYWRiNTVlOTkyMjZmNTVhN2IxNDEzMTZlZTJhN2I4NGE0ODU3IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBGcmksIDIyIE1hciAyMDI0IDEyOjAyOjQxIC0wNzAwClN1YmplY3Q6IFtQQVRD SCAxLzJdIGNwLGxuLG12OiBpbXByb3ZlIGRpciB2cyBub25kaXIgZGlhZ25vc3RpY3MKCiog c3JjL2NvcHkuYyAoY29weV9pbnRlcm5hbCk6IFNpbXBsaWZ5IGxvZ2ljIGZvciBjb3B5aW5n CmZyb20gZGlyZWN0b3J5IHRvIG5vbi1kaXJlY3Rvcnkgb3IgdmljZSB2ZXJzYSwgYW5kIGFs d2F5cwpkaWFnbm9zZSB3aXRoIGJvdGggc291cmNlIGFuZCBkZXN0aW5hdGlvbiBmaWxlIG5h bWVzLgotLS0KIHNyYy9jb3B5LmMgfCA4OCArKysrKysrKysrKysrKysrLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAyNiBpbnNlcnRp b25zKCspLCA2MiBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9zcmMvY29weS5jIGIvc3Jj L2NvcHkuYwppbmRleCBlN2JmNjAyMmYuLjhiNGEyOTY5MiAxMDA2NDQKLS0tIGEvc3JjL2Nv cHkuYworKysgYi9zcmMvY29weS5jCkBAIC0yNDUxLDcyICsyNDUxLDM2IEBAIHNraXA6CiAg ICAgICAgICAgaWYgKHJldHVybl9ub3cpCiAgICAgICAgICAgICByZXR1cm4gcmV0dXJuX3Zh bDsKIAotICAgICAgICAgIGlmICghU19JU0RJUiAoZHN0X3NiLnN0X21vZGUpKQorICAgICAg ICAgIC8qIENvcHlpbmcgYSBkaXJlY3Rvcnkgb250byBhIG5vbi1kaXJlY3RvcnksIG9yIHZp Y2UgdmVyc2EsCisgICAgICAgICAgICAgaXMgb2sgb25seSB3aXRoIC0tYmFja3VwLiAgKi8K KyAgICAgICAgICBpZiAoIVNfSVNESVIgKHNyY19tb2RlKSAhPSAhU19JU0RJUiAoZHN0X3Ni LnN0X21vZGUpCisgICAgICAgICAgICAgICYmIHgtPmJhY2t1cF90eXBlID09IG5vX2JhY2t1 cHMpCiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgIGlmIChTX0lTRElSIChzcmNfbW9k ZSkpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgaWYgKHgtPm1vdmVf bW9kZSAmJiB4LT5iYWNrdXBfdHlwZSAhPSBub19iYWNrdXBzKQotICAgICAgICAgICAgICAg ICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgLyogTW92aW5nIGEgZGlyZWN0b3J5IG9u dG8gYW4gZXhpc3RpbmcKLSAgICAgICAgICAgICAgICAgICAgICAgICBub24tZGlyZWN0b3J5 IGlzIG9rIG9ubHkgd2l0aCAtLWJhY2t1cC4gICovCi0gICAgICAgICAgICAgICAgICAgIH0K LSAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAg ICAgICAgICAgICAgICAgIGVycm9yICgwLCAwLAotICAgICAgICAgICAgICAgICAgICAgICBf KCJjYW5ub3Qgb3ZlcndyaXRlIG5vbi1kaXJlY3RvcnkgJXMgd2l0aCBkaXJlY3RvcnkgJXMi KSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVvdGVhZl9uICgwLCBkc3RfbmFt ZSksIHF1b3RlYWZfbiAoMSwgc3JjX25hbWUpKTsKLSAgICAgICAgICAgICAgICAgICAgICBy ZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9 Ci0KLSAgICAgICAgICAgICAgLyogRG9uJ3QgbGV0IHRoZSB1c2VyIGRlc3Ryb3kgdGhlaXIg ZGF0YSwgZXZlbiBpZiB0aGV5IHRyeSBoYXJkOgotICAgICAgICAgICAgICAgICBUaGlzIG12 IGNvbW1hbmQgbXVzdCBmYWlsIChsaWtld2lzZSBmb3IgY3ApOgotICAgICAgICAgICAgICAg ICAgIHJtIC1yZiBhIGIgYzsgbWtkaXIgYSBiIGM7IHRvdWNoIGEvZiBiL2Y7IG12IGEvZiBi L2YgYwotICAgICAgICAgICAgICAgICBPdGhlcndpc2UsIHRoZSBjb250ZW50cyBvZiBiL2Yg d291bGQgYmUgbG9zdC4KLSAgICAgICAgICAgICAgICAgSW4gdGhlIGNhc2Ugb2YgJ2NwJywg Yi9mIHdvdWxkIGJlIGxvc3QgaWYgdGhlIHVzZXIgc2ltdWxhdGVkCi0gICAgICAgICAgICAg ICAgIGEgbW92ZSB1c2luZyBjcCBhbmQgcm0uCi0gICAgICAgICAgICAgICAgIE5vdGUgdGhh dCBpdCB3b3JrcyBmaW5lIGlmIHlvdSB1c2UgLS1iYWNrdXA9bnVtYmVyZWQuICAqLwotICAg ICAgICAgICAgICBpZiAoY29tbWFuZF9saW5lX2FyZwotICAgICAgICAgICAgICAgICAgJiYg eC0+YmFja3VwX3R5cGUgIT0gbnVtYmVyZWRfYmFja3VwcwotICAgICAgICAgICAgICAgICAg JiYgc2Vlbl9maWxlICh4LT5kZXN0X2luZm8sIGRzdF9yZWxuYW1lLCAmZHN0X3NiKSkKLSAg ICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICBlcnJvciAoMCwgMCwKLSAgICAg ICAgICAgICAgICAgICAgICAgICBfKCJ3aWxsIG5vdCBvdmVyd3JpdGUganVzdC1jcmVhdGVk ICVzIHdpdGggJXMiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICBxdW90ZWFmX24gKDAs IGRzdF9uYW1lKSwgcXVvdGVhZl9uICgxLCBzcmNfbmFtZSkpOwotICAgICAgICAgICAgICAg ICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQot ICAgICAgICAgIGlmICghU19JU0RJUiAoc3JjX21vZGUpKQotICAgICAgICAgICAgewotICAg ICAgICAgICAgICBpZiAoU19JU0RJUiAoZHN0X3NiLnN0X21vZGUpKQotICAgICAgICAgICAg ICAgIHsKLSAgICAgICAgICAgICAgICAgIGlmICh4LT5tb3ZlX21vZGUgJiYgeC0+YmFja3Vw X3R5cGUgIT0gbm9fYmFja3VwcykKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAg ICAgICAgICAgICAgIC8qIE1vdmluZyBhIG5vbi1kaXJlY3Rvcnkgb250byBhbiBleGlzdGlu ZwotICAgICAgICAgICAgICAgICAgICAgICAgIGRpcmVjdG9yeSBpcyBvayBvbmx5IHdpdGgg LS1iYWNrdXAuICAqLwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAg ICBlbHNlCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICBl cnJvciAoMCwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICBfKCJjYW5ub3Qgb3Zlcndy aXRlIGRpcmVjdG9yeSAlcyB3aXRoIG5vbi1kaXJlY3RvcnkiKSwKLSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgcXVvdGVhZiAoZHN0X25hbWUpKTsKLSAgICAgICAgICAgICAgICAg ICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAg ICAgICB9CisgICAgICAgICAgICAgIGVycm9yICgwLCAwLAorICAgICAgICAgICAgICAgICAg ICAgXyhTX0lTRElSIChzcmNfbW9kZSkKKyAgICAgICAgICAgICAgICAgICAgICAgPyAoImNh bm5vdCBvdmVyd3JpdGUgbm9uLWRpcmVjdG9yeSAlcyAiCisgICAgICAgICAgICAgICAgICAg ICAgICAgICJ3aXRoIGRpcmVjdG9yeSAlcyIpCisgICAgICAgICAgICAgICAgICAgICAgIDog KCJjYW5ub3Qgb3ZlcndyaXRlIGRpcmVjdG9yeSAlcyAiCisgICAgICAgICAgICAgICAgICAg ICAgICAgICJ3aXRoIG5vbi1kaXJlY3RvcnkgJXMiKSksCisgICAgICAgICAgICAgICAgICAg ICBxdW90ZWFmX24gKDAsIGRzdF9uYW1lKSwgcXVvdGVhZl9uICgxLCBzcmNfbmFtZSkpOwor ICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAg ICBpZiAoeC0+bW92ZV9tb2RlKQorICAgICAgICAgIC8qIERvbid0IGxldCB0aGUgdXNlciBk ZXN0cm95IHRoZWlyIGRhdGEsIGV2ZW4gaWYgdGhleSB0cnkgaGFyZDoKKyAgICAgICAgICAg ICBUaGlzIG12IGNvbW1hbmQgbXVzdCBmYWlsIChsaWtld2lzZSBmb3IgY3ApOgorICAgICAg ICAgICAgIHJtIC1yZiBhIGIgYzsgbWtkaXIgYSBiIGM7IHRvdWNoIGEvZiBiL2Y7IG12IGEv ZiBiL2YgYworICAgICAgICAgICAgIE90aGVyd2lzZSwgdGhlIGNvbnRlbnRzIG9mIGIvZiB3 b3VsZCBiZSBsb3N0LgorICAgICAgICAgICAgIEluIHRoZSBjYXNlIG9mICdjcCcsIGIvZiB3 b3VsZCBiZSBsb3N0IGlmIHRoZSB1c2VyIHNpbXVsYXRlZAorICAgICAgICAgICAgIGEgbW92 ZSB1c2luZyBjcCBhbmQgcm0uCisgICAgICAgICAgICAgTm90ZSB0aGF0IGl0IHdvcmtzIGZp bmUgaWYgeW91IHVzZSAtLWJhY2t1cD1udW1iZXJlZC4gICovCisgICAgICAgICAgaWYgKCFT X0lTRElSIChkc3Rfc2Iuc3RfbW9kZSkgJiYgY29tbWFuZF9saW5lX2FyZworICAgICAgICAg ICAgICAmJiB4LT5iYWNrdXBfdHlwZSAhPSBudW1iZXJlZF9iYWNrdXBzCisgICAgICAgICAg ICAgICYmIHNlZW5fZmlsZSAoeC0+ZGVzdF9pbmZvLCBkc3RfcmVsbmFtZSwgJmRzdF9zYikp CiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgIC8qIERvbid0IGFsbG93IHVzZXIgdG8g bW92ZSBhIGRpcmVjdG9yeSBvbnRvIGEgbm9uLWRpcmVjdG9yeS4gICovCi0gICAgICAgICAg ICAgIGlmIChTX0lTRElSIChzcmNfc2Iuc3RfbW9kZSkgJiYgIVNfSVNESVIgKGRzdF9zYi5z dF9tb2RlKQotICAgICAgICAgICAgICAgICAgJiYgeC0+YmFja3VwX3R5cGUgPT0gbm9fYmFj a3VwcykKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICBlcnJvciAoMCwg MCwKLSAgICAgICAgICAgICAgICAgICAgICAgXygiY2Fubm90IG1vdmUgZGlyZWN0b3J5IG9u dG8gbm9uLWRpcmVjdG9yeTogJXMgLT4gJXMiKSwKLSAgICAgICAgICAgICAgICAgICAgICAg ICBxdW90ZWZfbiAoMCwgc3JjX25hbWUpLCBxdW90ZWZfbiAoMCwgZHN0X25hbWUpKTsKLSAg ICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9CisgICAg ICAgICAgICAgIGVycm9yICgwLCAwLAorICAgICAgICAgICAgICAgICAgICAgXygid2lsbCBu b3Qgb3ZlcndyaXRlIGp1c3QtY3JlYXRlZCAlcyB3aXRoICVzIiksCisgICAgICAgICAgICAg ICAgICAgICBxdW90ZWFmX24gKDAsIGRzdF9uYW1lKSwgcXVvdGVhZl9uICgxLCBzcmNfbmFt ZSkpOworICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICB9CiAKICAg ICAgICAgICBjaGFyIGNvbnN0ICpzcmNiYXNlOwotLSAKMi40NC4wCgo= --------------fIjJrgD18tdHjNRAzoW8QqaV Content-Type: text/x-patch; charset=UTF-8; name="0002-mv-treat-exchange-more-like-non-exchange.patch" Content-Disposition: attachment; filename="0002-mv-treat-exchange-more-like-non-exchange.patch" Content-Transfer-Encoding: base64 RnJvbSA1YTFkMDBlNDUwNDIwNGRjNGM4NGViNjQxYWJiOTYxZTgwNzRhMjE4IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBGcmksIDIyIE1hciAyMDI0IDE4OjM4OjA4IC0wNzAwClN1YmplY3Q6IFtQQVRD SCAyLzJdIG12OiB0cmVhdCAtLWV4Y2hhbmdlIG1vcmUgbGlrZSBub24tZXhjaGFuZ2UKTUlN RS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVURi04 CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDhiaXQKCkFsc28sIGltcHJvdmUgcXVhbGl0 eSBvZiBkaWFnbm9zdGljcy4KUHJvYmxlbXMvc3VnZ2VzdGlvbnMgYnkgQmVybmhhcmQgVm9l bGtlciBpbgo8aHR0cHM6Ly9idWdzLmdudS5vcmcvNjk1MzIjODI+LgoqIHNyYy9jb3B5LmMg KGVtaXRfdmVyYm9zZSk6IE5ldyBhcmcgRk9STUFULiAgQWxsIHVzZXMgY2hhbmdlZCwKdG8g aW1wcm92ZSBxdWFsaXR5IG9mIGRpYWdub3N0aWNzIHdoZW4gLS1leGNoYW5nZSBpcyB1c2Vk LgooY29weV9pbnRlcm5hbCk6IERvbuKAmXQgdHJ5IHRvIG9wdGltaXplIC0tZXhjaGFuZ2Ug c28gbXVjaDsgdGhpcwpzaW1wbGlmaWVzIHRoZSBjb2RlIGFuZCBrZWVwcyBpdCBjbG9zZXIg dG8gdGhlIG5vbiAtLWV4Y2hhbmdlIGNhc2UuCi0tLQogc3JjL2NvcHkuYyB8IDQ4ICsrKysr KysrKysrKysrKysrKysrKysrLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogMSBmaWxlIGNo YW5nZWQsIDIzIGluc2VydGlvbnMoKyksIDI1IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBh L3NyYy9jb3B5LmMgYi9zcmMvY29weS5jCmluZGV4IDhiNGEyOTY5Mi4uODE3ZDViMTNiIDEw MDY0NAotLS0gYS9zcmMvY29weS5jCisrKyBiL3NyYy9jb3B5LmMKQEAgLTIwNzUsOSArMjA3 NSwxMCBAQCBhYmFuZG9uX21vdmUgKGNvbnN0IHN0cnVjdCBjcF9vcHRpb25zICp4LAogICAg SWYgQkFDS1VQX0RTVF9OQU1FIGlzIG5vbi1udWxsLCB0aGVuIGFsc28gaW5kaWNhdGUgdGhh dCBpdCBpcwogICAgdGhlIG5hbWUgb2YgYSBiYWNrdXAgZmlsZS4gICovCiBzdGF0aWMgdm9p ZAotZW1pdF92ZXJib3NlIChjaGFyIGNvbnN0ICpzcmMsIGNoYXIgY29uc3QgKmRzdCwgY2hh ciBjb25zdCAqYmFja3VwX2RzdF9uYW1lKQorZW1pdF92ZXJib3NlIChjaGFyIGNvbnN0ICpm b3JtYXQsIGNoYXIgY29uc3QgKnNyYywgY2hhciBjb25zdCAqZHN0LAorICAgICAgICAgICAg ICBjaGFyIGNvbnN0ICpiYWNrdXBfZHN0X25hbWUpCiB7Ci0gIHByaW50ZiAoIiVzIC0+ICVz IiwgcXVvdGVhZl9uICgwLCBzcmMpLCBxdW90ZWFmX24gKDEsIGRzdCkpOworICBwcmludGYg KGZvcm1hdCwgcXVvdGVhZl9uICgwLCBzcmMpLCBxdW90ZWFmX24gKDEsIGRzdCkpOwogICBp ZiAoYmFja3VwX2RzdF9uYW1lKQogICAgIHByaW50ZiAoXygiIChiYWNrdXA6ICVzKSIpLCBx dW90ZWFmIChiYWNrdXBfZHN0X25hbWUpKTsKICAgcHV0Y2hhciAoJ1xuJyk7CkBAIC0yMjE5 LDE1ICsyMjIwLDEzIEBAIGNvcHlfaW50ZXJuYWwgKGNoYXIgY29uc3QgKnNyY19uYW1lLCBj aGFyIGNvbnN0ICpkc3RfbmFtZSwKICAgKmNvcHlfaW50b19zZWxmID0gZmFsc2U7CiAKICAg aW50IHJlbmFtZV9lcnJubyA9IHgtPnJlbmFtZV9lcnJubzsKLSAgaWYgKHgtPm1vdmVfbW9k ZSkKKyAgaWYgKHgtPm1vdmVfbW9kZSAmJiAheC0+ZXhjaGFuZ2UpCiAgICAgewogICAgICAg aWYgKHJlbmFtZV9lcnJubyA8IDApCiAgICAgICAgIHJlbmFtZV9lcnJubyA9IChyZW5hbWVh dHUgKEFUX0ZEQ1dELCBzcmNfbmFtZSwgZHN0X2RpcmZkLCBkcmVsbmFtZSwKLSAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgKHgtPmV4Y2hhbmdlCi0gICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICA/IFJFTkFNRV9FWENIQU5HRSA6IFJFTkFNRV9OT1JF UExBQ0UpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRU5BTUVfTk9S RVBMQUNFKQogICAgICAgICAgICAgICAgICAgICAgICAgPyBlcnJubyA6IDApOwotICAgICAg KnJlbmFtZV9zdWNjZWVkZWQgPSByZW5hbWVfZXJybm8gPT0gMDsKLSAgICAgIG5vbmV4aXN0 ZW50X2RzdCA9ICpyZW5hbWVfc3VjY2VlZGVkICYmICF4LT5leGNoYW5nZTsKKyAgICAgIG5v bmV4aXN0ZW50X2RzdCA9ICpyZW5hbWVfc3VjY2VlZGVkID0gcmVuYW1lX2Vycm5vID09IDA7 CiAgICAgfQogCiAgIGlmIChyZW5hbWVfZXJybm8gPT0gMApAQCAtMjI0OCw3ICsyMjQ3LDcg QEAgY29weV9pbnRlcm5hbCAoY2hhciBjb25zdCAqc3JjX25hbWUsIGNoYXIgY29uc3QgKmRz dF9uYW1lLAogCiAgICAgICBzcmNfbW9kZSA9IHNyY19zYi5zdF9tb2RlOwogCi0gICAgICBp ZiAoU19JU0RJUiAoc3JjX21vZGUpICYmICF4LT5yZWN1cnNpdmUgJiYgIXgtPmV4Y2hhbmdl KQorICAgICAgaWYgKFNfSVNESVIgKHNyY19tb2RlKSAmJiAheC0+cmVjdXJzaXZlKQogICAg ICAgICB7CiAgICAgICAgICAgZXJyb3IgKDAsIDAsICEgeC0+aW5zdGFsbF9tb2RlIC8qIGNw ICovCiAgICAgICAgICAgICAgICAgID8gXygiLXIgbm90IHNwZWNpZmllZDsgb21pdHRpbmcg ZGlyZWN0b3J5ICVzIikKQEAgLTIyOTEsNyArMjI5MCw3IEBAIGNvcHlfaW50ZXJuYWwgKGNo YXIgY29uc3QgKnNyY19uYW1lLCBjaGFyIGNvbnN0ICpkc3RfbmFtZSwKICAgICAgdHJlYXRl ZCB0aGUgc2FtZSBhcyBub25leGlzdGVudCBmaWxlcy4gICovCiAgIGJvb2wgbmV3X2RzdCA9 IDAgPCBub25leGlzdGVudF9kc3Q7CiAKLSAgaWYgKCEgbmV3X2RzdCAmJiAhIHgtPmV4Y2hh bmdlKQorICBpZiAoISBuZXdfZHN0KQogICAgIHsKICAgICAgIC8qIE5vcm1hbGx5LCBmaWxs IGluIERTVF9TQiBvciBzZXQgTkVXX0RTVCBzbyB0aGF0IGxhdGVyIGNvZGUKICAgICAgICAg IGNhbiB1c2UgRFNUX1NCIGlmIE5FV19EU1QgaXMgZmFsc2UuICBIb3dldmVyLCBkb24ndCBi b3RoZXIKQEAgLTI0NTIsOSArMjQ1MSw5IEBAIHNraXA6CiAgICAgICAgICAgICByZXR1cm4g cmV0dXJuX3ZhbDsKIAogICAgICAgICAgIC8qIENvcHlpbmcgYSBkaXJlY3Rvcnkgb250byBh IG5vbi1kaXJlY3RvcnksIG9yIHZpY2UgdmVyc2EsCi0gICAgICAgICAgICAgaXMgb2sgb25s eSB3aXRoIC0tYmFja3VwLiAgKi8KKyAgICAgICAgICAgICBpcyBvayBvbmx5IHdpdGggLS1i YWNrdXAgb3IgLS1leGNoYW5nZS4gICovCiAgICAgICAgICAgaWYgKCFTX0lTRElSIChzcmNf bW9kZSkgIT0gIVNfSVNESVIgKGRzdF9zYi5zdF9tb2RlKQotICAgICAgICAgICAgICAmJiB4 LT5iYWNrdXBfdHlwZSA9PSBub19iYWNrdXBzKQorICAgICAgICAgICAgICAmJiB4LT5iYWNr dXBfdHlwZSA9PSBub19iYWNrdXBzICYmICF4LT5leGNoYW5nZSkKICAgICAgICAgICAgIHsK ICAgICAgICAgICAgICAgZXJyb3IgKDAsIDAsCiAgICAgICAgICAgICAgICAgICAgICBfKFNf SVNESVIgKHNyY19tb2RlKQpAQCAtMjQ3Miw5ICsyNDcxLDkgQEAgc2tpcDoKICAgICAgICAg ICAgICBPdGhlcndpc2UsIHRoZSBjb250ZW50cyBvZiBiL2Ygd291bGQgYmUgbG9zdC4KICAg ICAgICAgICAgICBJbiB0aGUgY2FzZSBvZiAnY3AnLCBiL2Ygd291bGQgYmUgbG9zdCBpZiB0 aGUgdXNlciBzaW11bGF0ZWQKICAgICAgICAgICAgICBhIG1vdmUgdXNpbmcgY3AgYW5kIHJt LgotICAgICAgICAgICAgIE5vdGUgdGhhdCBpdCB3b3JrcyBmaW5lIGlmIHlvdSB1c2UgLS1i YWNrdXA9bnVtYmVyZWQuICAqLworICAgICAgICAgICAgIE5vdGhpbmcgaXMgbG9zdCBpZiB5 b3UgdXNlIC0tYmFja3VwPW51bWJlcmVkIG9yIC0tZXhjaGFuZ2UuICAqLwogICAgICAgICAg IGlmICghU19JU0RJUiAoZHN0X3NiLnN0X21vZGUpICYmIGNvbW1hbmRfbGluZV9hcmcKLSAg ICAgICAgICAgICAgJiYgeC0+YmFja3VwX3R5cGUgIT0gbnVtYmVyZWRfYmFja3VwcworICAg ICAgICAgICAgICAmJiB4LT5iYWNrdXBfdHlwZSAhPSBudW1iZXJlZF9iYWNrdXBzICYmICF4 LT5leGNoYW5nZQogICAgICAgICAgICAgICAmJiBzZWVuX2ZpbGUgKHgtPmRlc3RfaW5mbywg ZHN0X3JlbG5hbWUsICZkc3Rfc2IpKQogICAgICAgICAgICAgewogICAgICAgICAgICAgICBl cnJvciAoMCwgMCwKQEAgLTI1OTEsNyArMjU5MCw3IEBAIHNraXA6CiAgICAgIHN1cmUgd2Un bGwgY3JlYXRlIGEgZGlyZWN0b3J5LiAgQWxzbyBkb24ndCBhbm5vdW5jZSB5ZXQgd2hlbiBt b3ZpbmcKICAgICAgc28gd2UgY2FuIGRpc3Rpbmd1aXNoIHJlbmFtZXMgdmVyc3VzIGNvcGll cy4gICovCiAgIGlmICh4LT52ZXJib3NlICYmICF4LT5tb3ZlX21vZGUgJiYgIVNfSVNESVIg KHNyY19tb2RlKSkKLSAgICBlbWl0X3ZlcmJvc2UgKHNyY19uYW1lLCBkc3RfbmFtZSwgZHN0 X2JhY2t1cCk7CisgICAgZW1pdF92ZXJib3NlICgiJXMgLT4gJXMiLCBzcmNfbmFtZSwgZHN0 X25hbWUsIGRzdF9iYWNrdXApOwogCiAgIC8qIEFzc29jaWF0ZSB0aGUgZGVzdGluYXRpb24g ZmlsZSBuYW1lIHdpdGggdGhlIHNvdXJjZSBkZXZpY2UgYW5kIGlub2RlCiAgICAgIHNvIHRo YXQgaWYgd2UgZW5jb3VudGVyIGEgbWF0Y2hpbmcgZGV2L2lubyBwYWlyIGluIHRoZSBzb3Vy Y2UgdHJlZQpAQCAtMjcxOCwxNyArMjcxNywxOSBAQCBza2lwOgogCiAgIGlmICh4LT5tb3Zl X21vZGUpCiAgICAgewotICAgICAgaWYgKHJlbmFtZV9lcnJubyA9PSBFRVhJU1QgJiYgIXgt PmV4Y2hhbmdlKQotICAgICAgICByZW5hbWVfZXJybm8gPSAocmVuYW1lYXQgKEFUX0ZEQ1dE LCBzcmNfbmFtZSwgZHN0X2RpcmZkLCBkcmVsbmFtZSkgPT0gMAorICAgICAgaWYgKHJlbmFt ZV9lcnJubyA9PSBFRVhJU1QpCisgICAgICAgIHJlbmFtZV9lcnJubyA9ICgocmVuYW1lYXR1 IChBVF9GRENXRCwgc3JjX25hbWUsIGRzdF9kaXJmZCwgZHJlbG5hbWUsCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICB4LT5leGNoYW5nZSA/IFJFTkFNRV9FWENIQU5H RSA6IDApCisgICAgICAgICAgICAgICAgICAgICAgICAgPT0gMCkKICAgICAgICAgICAgICAg ICAgICAgICAgID8gMCA6IGVycm5vKTsKIAogICAgICAgaWYgKHJlbmFtZV9lcnJubyA9PSAw KQogICAgICAgICB7CiAgICAgICAgICAgaWYgKHgtPnZlcmJvc2UpCi0gICAgICAgICAgICB7 Ci0gICAgICAgICAgICAgIHByaW50ZiAoXygicmVuYW1lZCAiKSk7Ci0gICAgICAgICAgICAg IGVtaXRfdmVyYm9zZSAoc3JjX25hbWUsIGRzdF9uYW1lLCBkc3RfYmFja3VwKTsKLSAgICAg ICAgICAgIH0KKyAgICAgICAgICAgIGVtaXRfdmVyYm9zZSAoXyh4LT5leGNoYW5nZQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgID8gImV4Y2hhbmdlZCAlcyA8LT4gJXMiCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgOiAicmVuYW1lZCAlcyAtPiAlcyIpLAorICAgICAg ICAgICAgICAgICAgICAgICAgICBzcmNfbmFtZSwgZHN0X25hbWUsIGRzdF9iYWNrdXApOwog CiAgICAgICAgICAgaWYgKHgtPnNldF9zZWN1cml0eV9jb250ZXh0KQogICAgICAgICAgICAg ewpAQCAtMjg1MywxMCArMjg1NCw3IEBAIHNraXA6CiAgICAgICAgIH0KIAogICAgICAgaWYg KHgtPnZlcmJvc2UgJiYgIVNfSVNESVIgKHNyY19tb2RlKSkKLSAgICAgICAgewotICAgICAg ICAgIHByaW50ZiAoXygiY29waWVkICIpKTsKLSAgICAgICAgICBlbWl0X3ZlcmJvc2UgKHNy Y19uYW1lLCBkc3RfbmFtZSwgZHN0X2JhY2t1cCk7Ci0gICAgICAgIH0KKyAgICAgICAgZW1p dF92ZXJib3NlIChfKCJjb3BpZWQgJXMgLT4gJXMiKSwgc3JjX25hbWUsIGRzdF9uYW1lLCBk c3RfYmFja3VwKTsKICAgICAgIG5ld19kc3QgPSB0cnVlOwogICAgIH0KIApAQCAtMjk1Niw3 ICsyOTU0LDcgQEAgc2tpcDoKICAgICAgICAgICAgICAgaWYgKHgtPm1vdmVfbW9kZSkKICAg ICAgICAgICAgICAgICBwcmludGYgKF8oImNyZWF0ZWQgZGlyZWN0b3J5ICVzXG4iKSwgcXVv dGVhZiAoZHN0X25hbWUpKTsKICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAg IGVtaXRfdmVyYm9zZSAoc3JjX25hbWUsIGRzdF9uYW1lLCBudWxscHRyKTsKKyAgICAgICAg ICAgICAgICBlbWl0X3ZlcmJvc2UgKCIlcyAtPiAlcyIsIHNyY19uYW1lLCBkc3RfbmFtZSwg bnVsbHB0cik7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgIGVsc2UKLS0gCjIu NDQuMAoK --------------fIjJrgD18tdHjNRAzoW8QqaV-- From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 23 Mar 2024 10:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Petr Malat , util-linux , Dominique Martinet , 69532@debbugs.gnu.org, Karel Zak , Rob Landley Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171118984711485 (code B ref 69532); Sat, 23 Mar 2024 10:31:01 +0000 Received: (at 69532) by debbugs.gnu.org; 23 Mar 2024 10:30:47 +0000 Received: from localhost ([127.0.0.1]:44740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnyeE-0002z8-L9 for submit@debbugs.gnu.org; Sat, 23 Mar 2024 06:30:47 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:43853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnyeC-0002ym-4B for 69532@debbugs.gnu.org; Sat, 23 Mar 2024 06:30:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-voelker.de; s=s1-ionos; t=1711189796; x=1711794596; i=mail@bernhard-voelker.de; bh=ahTUDxAKGsVbeJmCiEBdmJXUUAcLGa+gE+NHVUF1AcE=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=Xrmrvn0x6Q7TzMNVlkAn/Gx4vsWsmAsX7Z8hZpF2zG8gHzbzIs9akss93f83bodw oAONu20BQ2iTIMYYkjdPP1VeC+37vnp71Paax6IUQwTX7t5JvJoPHHhSaTV4uml6V oGtoAXeQcanFG20R9ILoiCC+/RnbNzHYAHTdBBdGZuTuWpR8iOoDbr15AFP/aHGiz 3F/xQVTpJmXZqVuQqFj62GKMHPjhz4rsI+/Qa95FQWRvDtQv76yjdtXvI8bRz1+xR JYBFH5unX2sZ4m0h3eODZuIkjwSti/1WqIVFH+blMjTqf2RNhFaSP7/KCByWL20SV ASryNgtZZeBSdhvdZA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [192.168.101.10] ([91.49.76.118]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MTiDV-1rKZZc0Xan-00U3fc; Sat, 23 Mar 2024 11:24:17 +0100 Message-ID: <1429185f-f57c-4252-b6ec-4e60cd5d3341@bernhard-voelker.de> Date: Sat, 23 Mar 2024 11:24:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> <47c15dcf-3054-4a0a-9ca9-d9f7601db3ca@cs.ucla.edu> From: Bernhard Voelker In-Reply-To: <47c15dcf-3054-4a0a-9ca9-d9f7601db3ca@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:NW4AqlCwMgkFEOpsctolvBYrDC2rv44Mswhr5dz6yJn1Rtmy2Ox wHT9y1aEa25MD91NFk4AtE2gG3D97k2UmdwoQlS4CYps3V59vJRYU9zetLqWguc2Z5tw7Yl vwS0R7Ortjh7bBMggmEMApSwhntqeWv+ulDC2CyL7gANH5IgUF+9A89Ug4dI8cMejIY+1iY GU/PK0h3nmnpvaH+DdUrw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:turO8QW3wXE=;DZAalZA/Zh9Zjo2mqlYKQE3zhH0 d6fgwtoYo2iQ6sTVwcMd6uO/Oa2XPIRrHh+1HPKsCip+n4kNXpr6FZ2QMeyw0Rcp0tIiua01B m25rkTN4vjMRbuqX4PCX6G/eTJNInYofvAy9f7x5Zz76loS71LkCLET8equ2bWVx16W20FCw+ ez4Uk+Yk6kNSMbO9fL5vi1V+P20zv/cJ83lb1UAQ6kwVIKGNOjY2aRlq2bQaF/l4ECiUVGNlb UNoZ4zNHJT/VjfsSRhEIYSGh35jv4994aQ+UWcdA4e5Ou+0i+2gJpFcMxhremVe5covm00Hxw B+MXHazdPCfpn5hL2xJs9j6lPw5jJMHGL7ySUR07dPnk5JKK0CnYVI/Ln1N7CFU2IKb4N0RMn +F1OupZXhQFLh3t0/fjv8ijV4cUYFWTT2mAs71ftWU9Ef87aZ7xX0QJiCJGFH7l3TqmC50+Zo 6uB5qxIiElWZKB+EM18bFivPGWwkpRYfWkb34ZLnajja76N8JWQ8mbxWGvouQQSQBDXSWvOim hxX5vXnM1ppubwTYT5UBunv3aIZ0H0sqfKiLoG+WS7T15xzFdurHg9oY3jiYQYTAFTUs+gM6e Q0M8bPzmWZRpaM+2MMJNQJ8WnbZoOwVHBDh+X3u0ags5SbhBOrhuaaia4X4p5aFprZJebP5PO 8S2Lhmu7or/ofPlZ9cQDJ8Z5ENxuAtH+zWIv2+yCnYvSs6FAvwahj/NuR0j+xwyBo7t9o3bfe ax/TU5EijKJyrNot8xOzJGrPs5yas+sT1cQJvqUuI1HVhFkkpvzXNA= X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/23/24 02:44, Paul Eggert wrote: > I installed the attached patches to do the above. (Basically, the > problem was that my earlier patches were too ambitious; these patches > scale things back to avoid some optimizations so that mv --exchange is > more like ordinary mv.) > > The first patch simplifies the code (and fixes a diagnostic to be more > useful) without otherwise changing behavior; it's more of a refactoring. > The second patch does the real work. Thanks. We should put adding more tests on our TODO list still. Have a nice day, Berny From unknown Sat Sep 20 03:58:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 23 Mar 2024 10:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69532 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Karel Zak Cc: Petr Malat , util-linux , Paul Eggert , Dominique Martinet , 69532@debbugs.gnu.org, Rob Landley , =?UTF-8?Q?P=C3=A1draig?= Brady Received: via spool by 69532-submit@debbugs.gnu.org id=B69532.171119031712651 (code B ref 69532); Sat, 23 Mar 2024 10:39:01 +0000 Received: (at 69532) by debbugs.gnu.org; 23 Mar 2024 10:38:37 +0000 Received: from localhost ([127.0.0.1]:45161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnylp-0003Hy-6a for submit@debbugs.gnu.org; Sat, 23 Mar 2024 06:38:37 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnylm-0003Hb-Nx for 69532@debbugs.gnu.org; Sat, 23 Mar 2024 06:38:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-voelker.de; s=s1-ionos; t=1711190267; x=1711795067; i=mail@bernhard-voelker.de; bh=sKIQ7I6MjdP9NB8ImdLhiS68+0GJUL2QjAz1J9+HMZw=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=RVmcpOfNNpmmktLTVoaYlYvuS9iqOxDdvQ9pAAZ8i303Kd+ywBdmDlTtj7bNYcxq 2Ies8Fn2/0+Cl2y6bqSP3kU7Ayk39ynhMwqMVo+Hii06IjHLEZmGalo4CsnekknAb 95jXdVs43SeogVo6sM/wxWFL3SbHb8mlZXvxaZ7l4evokKz6wkJrkgAh2I7jtarx4 6llQ6cWA+uPG8tbK3T8KM4GDwuXtX+r9qfXvpvFQ5SZhoZGBNiKYM6zIXAtVQEUuD eQ2lt+oJFHoYvlzI4k1vTr1TEmkAWcTMyb1FNLLqI9NxG7h1SioMvsyBOoXRRH67h v6MDJY5m/j05qvF7lw== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [192.168.101.10] ([91.49.76.118]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mbzhv-1rB3Mb4BAN-00dVty; Sat, 23 Mar 2024 11:24:19 +0100 Message-ID: <9bbddfd0-d4a6-40f8-8ec3-bdbdecbc16ba@bernhard-voelker.de> Date: Sat, 23 Mar 2024 11:24:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <10c814a7-cb68-4fb4-ad8d-f88f286fb0b1@cs.ucla.edu> <58281f96-f9c6-4567-e3c9-c6a6cfa6ce27@draigBrady.com> <5914e8b2-48ac-456b-9753-6a7bae7a9bbb@cs.ucla.edu> <636f1247-0de0-2f32-cb04-f6952b6807aa@draigBrady.com> <11c9a6a2-c73d-4b99-b071-48e7eab2fd19@bernhard-voelker.de> <4356f3eb-544e-4ce9-b9ea-374cd01663d5@cs.ucla.edu> <20240322102257.ovv5kpnm4zsgtf7n@ws.net.home> From: Bernhard Voelker In-Reply-To: <20240322102257.ovv5kpnm4zsgtf7n@ws.net.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:9ojPAkfYOlqMShsx5QHz4FVAsgcZNxS7rAp/CVoVkhklX+DH9NH dSsVzV830WAZpBRaQnp7mmlGZqzKPrXC/jWoya7aVhXwSNvLxSKF4FRBHoskgGWmXjLK0A2 d2pEMZ9v4o0TSR2f0pvx+6XtJ2FXuUbA0EOH0L7muBv4JhwzpUkxQGMiioGGzoBdeVnHMCB 7REA4aA+rY3zPeTGSUkdw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:v0YIyOZLmsM=;BsMn/hh8hwtjXD8Dez7Jz7ytEch j4vJNQc2VRkbHKSSTS0rC/rKLG0e3q23mNmqlPnptCSLaWkkrj7lJC6lcOl5IyhWyGYZhjvuX nori0LxgYISfkBaxQcRtLRojAdJPCrhA62VacvA1oELiNl+QZTYQhqMrxko8wojfnwxGJ7cPb UIfjMWBSPcJfUdQi/UbBiXS4L4H34eu5wHz5Bqo4o+SquRGz+wFXFuNinpgpfKXkiNN6p25YS ej2f4FlIp+LOyFHqU8hFS0Y7GxYaVDsRdFDDSlKP9N3bw+3g/kXQ4Kj0e4IcA/g2Sz68q+LoC w5LedBK1nXukSGM2PmPHHgIZ1GZhl8r3txH2apGSISldHvotU/JtbU2+04OehXpdKKp4L7N7S yGERYoEwlQNOoG+WzvSQ/o4Qu2f32seZcDE/S2LcOKmn1hMkUr8w1ZuFo9qOAC7078+MHJUiT NWYlbfvmQddYrkIprTqeneq3WsLq6YazK0VHWYPCr4tP1oSA3n+PSzAF0O8GDZzTI7AonGOH/ RvP+HMWxYOb3nOFbcAAKodVZmAhuxkUXbKirDLZ/l82UI5Z1LYVP622/Wqc94rIWGb7yaz1u7 fOwK1bP9j6Rcxmbk/YgISJay4Ai2rEYs546aH/4/xHAiwrFed0uGnj6AgQREQxHRYxpEWB4GT beZI5XJhsYpG8uWor8MXt9wo26uWCl4qrR6GiAeFcrM6Pp+CzRZqAHJz0cemJmhGpWcJVjlAi reyarXqdG222rsaXQ1T3T9diIpM2AZfmH2vhEusRLU+pCMtLYfAVdg= X-Spam-Score: -0.0 (/) 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: -1.0 (-) On 3/22/24 11:22, Karel Zak wrote: > On Wed, Mar 20, 2024 at 11:53:05PM +0100, Bernhard Voelker wrote:>> On userland OTOH, we have broader choice. >> Karel did his choice in util-linux for exch(1), and coreutils could expose >> the same functionality. >> >> For other feature requests, we were much more reluctant in coreutils ... for >> good reasons: feature bloat, maintainability, etc. >> >> So I'm asking myself what is different this time? >> - The feature already exists -> util-linux. > > Note that we can move exch(1) from util-linux to coreutils if, at the > end of the brainstorming session, the conclusion will be that mv(1) is > a bad choice :-) I'd be for that as well, because ... >> I'm currently only 20:80 for adding it to mv(1). > > I think the functionality will be lost in the mv(1) for many users. ... that's a fair point. The code for the functionality is in copy.c, so - as with mv.c/cp.c/install.c - we could have a exch.c using just that part, and thus expose a clearer interface to the users. Have a nice day, Berny