From unknown Sun Jun 22 00:42:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15105: [mv] overwrite files unexpectedly Resent-From: Hai Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 15 Aug 2013 15:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15105 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 15105@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.137658174530288 (code B ref -1); Thu, 15 Aug 2013 15:50:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Aug 2013 15:49:05 +0000 Received: from localhost ([127.0.0.1]:60629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V9znM-0007sS-H2 for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:49:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33538) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V9zIm-0005vX-JS for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:17:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9zIY-0001iM-Pl for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:17:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9zIY-0001i3-MD for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:17:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9zIQ-0006Hd-8O for bug-coreutils@gnu.org; Thu, 15 Aug 2013 11:17:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9zIF-0001cs-LG for bug-coreutils@gnu.org; Thu, 15 Aug 2013 11:17:06 -0400 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:53427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9zIF-0001cV-EX for bug-coreutils@gnu.org; Thu, 15 Aug 2013 11:16:55 -0400 Received: by mail-pd0-f175.google.com with SMTP id q10so953023pdj.34 for ; Thu, 15 Aug 2013 08:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=P3DbH41v3fEIAJbTSYd287hZeQOPVtcgltLF8X4Ve5w=; b=I7qPHn7eAT8pEAo9v0/zDrRPClr634UFI/KH5z6zA/q5s2JAowCqOnSCpUuiNFcMRV iBdzTEWLls4dQO2x1V7mN7vmwz3T3r/yAHI0K1qKvAdaGvsiRi2HUjLmrOlAqg6p0XXt Clm5qFYCFw/orCzevIDHBeKsRR242vPSyPLOZEbWSq3jsKvQFS8/m37ApwWW5th5K3Bo Gm1Z0SufLB9t/Cdq6Yo1YmQKREbyYP7eiKil4aqB1P25E1biyk5F79PdRIVQj1BLAW4x GwTiVRoFVWgmDdyaUZ6RR8WiQDm87lByzrX06PEmHXxe4ErYPdduKzAx20Hl4DCaM8Bp J30Q== X-Received: by 10.67.3.34 with SMTP id bt2mr16264643pad.3.1376579813766; Thu, 15 Aug 2013 08:16:53 -0700 (PDT) Received: from [192.168.1.103] ([223.251.33.189]) by mx.google.com with ESMTPSA id qp10sm88184pab.13.2013.08.15.08.16.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Aug 2013 08:16:52 -0700 (PDT) Message-ID: <520CF0E0.7030301@gmail.com> Date: Thu, 15 Aug 2013 23:16:48 +0800 From: Hai User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -2.4 (--) X-Mailman-Approved-At: Thu, 15 Aug 2013 11:49:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.4 (--) Hi All If someone else have issued this thing before, please forgive my disturbance. Command $mv a_file* will overwrite one of your files iff 2 files with the same prefix under the folder. I know we should know what we are doing with the command given by ourselves. But I think this is an unusual case, and tools should complain it. Scenario: $ tree . |-- a_file |-- a_file.c Having these 2 files under a folder. And I want to mv these 2 files to another folder with the given command('cause I forget to type the destination directory), so the command will be interpreted to $mv a_file a_file.c, this is a totally correct command, so it will be performed perfectly. but one of my file is overwritten. Can mv check the args before parsing the data in it? 'Cause I think no body is going to rename a file with this kind of command 'mv a_file*', so there should be a potential error, and should better tell the user. Regards & Thanks Hai Guo From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 15 12:51:10 2013 Received: (at control) by debbugs.gnu.org; 15 Aug 2013 16:51:10 +0000 Received: from localhost ([127.0.0.1]:60767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VA0lS-0001HP-6M for submit@debbugs.gnu.org; Thu, 15 Aug 2013 12:51:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44292) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VA0lO-0001H9-0j; Thu, 15 Aug 2013 12:51:07 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7FGp4da026581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Aug 2013 12:51:04 -0400 Received: from [10.3.113.47] (ovpn-113-47.phx2.redhat.com [10.3.113.47]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7FGp2qF017123; Thu, 15 Aug 2013 12:51:04 -0400 Message-ID: <520D06F6.7040409@redhat.com> Date: Thu, 15 Aug 2013 10:51:02 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: Hai Subject: Re: bug#15105: [mv] overwrite files unexpectedly References: <520CF0E0.7030301@gmail.com> In-Reply-To: <520CF0E0.7030301@gmail.com> X-Enigmail-Version: 1.5.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -7.8 (-------) X-Debbugs-Envelope-To: control Cc: 15105-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -7.8 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable tag 15105 notabug thanks On 08/15/2013 09:16 AM, Hai wrote: > Hi All >=20 > If someone else have issued this thing before, please forgive my > disturbance. >=20 > Command $mv a_file* will overwrite one of your files iff 2 files with > the same prefix under the folder. Yes, and this is a feature, required by POSIX. >=20 > I know we should know what we are doing with the command given by > ourselves. > But I think this is an unusual case, and tools should complain it. Unfortunately, mv cannot distinguish between 'mv a*' and 'mv a1 a2' - the globbing has already happened in the shell before mv ever sees its command line arguments. > Can mv check the args before parsing the data in it? 'Cause I think no > body is going to rename a file with this kind of command 'mv a_file*', > so there should be a potential error, and should better tell the user. I could suggest that you consider setting up an alias in your environment, such as: alias mv=3D'mv -n ' or alias mv=3D'mv -i ' so that if you type 'mv a*' and the glob expands to a valid command that would overwrite the second file, then it will fail or prompt you. But be careful - if you create an alias by the same name, but then use a different machine where the alias is not active, you may find that you have become reliant on the alias doing the dirty work for you, and losing data on the machine that lacks the alias. Also, this would mean that mv prompts you even when you spell out the overwrite in longhand, and you may find yourself needing to use to '\mv a b' to avoid the alias. (Personally, I hate distros that pre-alias mv to 'mv -i', and that's one of the first things that I check for and undo in my customization of a new account on such a machine - but some people swear by it, or distros wouldn't do it...) In short, because there is no way to make mv behave differently if you used a glob compared to spelling in longhand, and because there is already an option to prevent overwrites, I don't think we need to change anything in coreutils, so I'm closing this bug report. Feel free, however, to continue the conversation in this thread if you have more questions or ideas. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSDQb2AAoJEKeha0olJ0NqPzwH/0Op95SPIs10r21d1bwIEE/F KTVuCD46IL5/LNCRw9Zo6Iz2C9vrTHfTExcRFb266LCLS6uAKJklasaX2QPvSDa2 jrNM4ErSK8aRS8+1G0FexuluqrATB9CV9cCFyzBvRVzwZz9IvMyZl2DuVb76q3cR ziIg6rEXspQgspvLvhIWO9KO7o4ex22yAjh/qWkbPfbS7WqiocK3FkTpvzzRNO/b 0tDWqpT+fpuZqk6P93qAeBphSNEI0Cw6NXiW1ppC68p2U6wkQw+6iK/ZY1g39kEf oxPCQx7vKkLMfCPPZf6UApmH4k3B/WjSmkW/mdjh/4vGRJS0rMd7pkDKDBWHnC0= =hJ+q -----END PGP SIGNATURE----- --R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc-- From unknown Sun Jun 22 00:42:46 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Hai Subject: bug#15105: closed (Re: bug#15105: [mv] overwrite files unexpectedly) Message-ID: References: <520D06F6.7040409@redhat.com> <520CF0E0.7030301@gmail.com> X-Gnu-PR-Message: they-closed 15105 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: notabug Reply-To: 15105@debbugs.gnu.org Date: Thu, 15 Aug 2013 16:52:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1376585524-5019-1" This is a multi-part message in MIME format... ------------=_1376585524-5019-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15105: [mv] overwrite files unexpectedly which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15105@debbugs.gnu.org. --=20 15105: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15105 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1376585524-5019-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15105-done) by debbugs.gnu.org; 15 Aug 2013 16:51:10 +0000 Received: from localhost ([127.0.0.1]:60765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VA0lQ-0001HM-Pm for submit@debbugs.gnu.org; Thu, 15 Aug 2013 12:51:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44292) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VA0lO-0001H9-0j; Thu, 15 Aug 2013 12:51:07 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7FGp4da026581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Aug 2013 12:51:04 -0400 Received: from [10.3.113.47] (ovpn-113-47.phx2.redhat.com [10.3.113.47]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7FGp2qF017123; Thu, 15 Aug 2013 12:51:04 -0400 Message-ID: <520D06F6.7040409@redhat.com> Date: Thu, 15 Aug 2013 10:51:02 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: Hai Subject: Re: bug#15105: [mv] overwrite files unexpectedly References: <520CF0E0.7030301@gmail.com> In-Reply-To: <520CF0E0.7030301@gmail.com> X-Enigmail-Version: 1.5.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -7.8 (-------) X-Debbugs-Envelope-To: 15105-done Cc: 15105-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -7.8 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable tag 15105 notabug thanks On 08/15/2013 09:16 AM, Hai wrote: > Hi All >=20 > If someone else have issued this thing before, please forgive my > disturbance. >=20 > Command $mv a_file* will overwrite one of your files iff 2 files with > the same prefix under the folder. Yes, and this is a feature, required by POSIX. >=20 > I know we should know what we are doing with the command given by > ourselves. > But I think this is an unusual case, and tools should complain it. Unfortunately, mv cannot distinguish between 'mv a*' and 'mv a1 a2' - the globbing has already happened in the shell before mv ever sees its command line arguments. > Can mv check the args before parsing the data in it? 'Cause I think no > body is going to rename a file with this kind of command 'mv a_file*', > so there should be a potential error, and should better tell the user. I could suggest that you consider setting up an alias in your environment, such as: alias mv=3D'mv -n ' or alias mv=3D'mv -i ' so that if you type 'mv a*' and the glob expands to a valid command that would overwrite the second file, then it will fail or prompt you. But be careful - if you create an alias by the same name, but then use a different machine where the alias is not active, you may find that you have become reliant on the alias doing the dirty work for you, and losing data on the machine that lacks the alias. Also, this would mean that mv prompts you even when you spell out the overwrite in longhand, and you may find yourself needing to use to '\mv a b' to avoid the alias. (Personally, I hate distros that pre-alias mv to 'mv -i', and that's one of the first things that I check for and undo in my customization of a new account on such a machine - but some people swear by it, or distros wouldn't do it...) In short, because there is no way to make mv behave differently if you used a glob compared to spelling in longhand, and because there is already an option to prevent overwrites, I don't think we need to change anything in coreutils, so I'm closing this bug report. Feel free, however, to continue the conversation in this thread if you have more questions or ideas. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSDQb2AAoJEKeha0olJ0NqPzwH/0Op95SPIs10r21d1bwIEE/F KTVuCD46IL5/LNCRw9Zo6Iz2C9vrTHfTExcRFb266LCLS6uAKJklasaX2QPvSDa2 jrNM4ErSK8aRS8+1G0FexuluqrATB9CV9cCFyzBvRVzwZz9IvMyZl2DuVb76q3cR ziIg6rEXspQgspvLvhIWO9KO7o4ex22yAjh/qWkbPfbS7WqiocK3FkTpvzzRNO/b 0tDWqpT+fpuZqk6P93qAeBphSNEI0Cw6NXiW1ppC68p2U6wkQw+6iK/ZY1g39kEf oxPCQx7vKkLMfCPPZf6UApmH4k3B/WjSmkW/mdjh/4vGRJS0rMd7pkDKDBWHnC0= =hJ+q -----END PGP SIGNATURE----- --R2RCP0NPnK9J4WsnEB5qbgqgQnnhsKllc-- ------------=_1376585524-5019-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Aug 2013 15:49:05 +0000 Received: from localhost ([127.0.0.1]:60629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V9znM-0007sS-H2 for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:49:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33538) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V9zIm-0005vX-JS for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:17:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9zIY-0001iM-Pl for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:17:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9zIY-0001i3-MD for submit@debbugs.gnu.org; Thu, 15 Aug 2013 11:17:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9zIQ-0006Hd-8O for bug-coreutils@gnu.org; Thu, 15 Aug 2013 11:17:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9zIF-0001cs-LG for bug-coreutils@gnu.org; Thu, 15 Aug 2013 11:17:06 -0400 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:53427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9zIF-0001cV-EX for bug-coreutils@gnu.org; Thu, 15 Aug 2013 11:16:55 -0400 Received: by mail-pd0-f175.google.com with SMTP id q10so953023pdj.34 for ; Thu, 15 Aug 2013 08:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=P3DbH41v3fEIAJbTSYd287hZeQOPVtcgltLF8X4Ve5w=; b=I7qPHn7eAT8pEAo9v0/zDrRPClr634UFI/KH5z6zA/q5s2JAowCqOnSCpUuiNFcMRV iBdzTEWLls4dQO2x1V7mN7vmwz3T3r/yAHI0K1qKvAdaGvsiRi2HUjLmrOlAqg6p0XXt Clm5qFYCFw/orCzevIDHBeKsRR242vPSyPLOZEbWSq3jsKvQFS8/m37ApwWW5th5K3Bo Gm1Z0SufLB9t/Cdq6Yo1YmQKREbyYP7eiKil4aqB1P25E1biyk5F79PdRIVQj1BLAW4x GwTiVRoFVWgmDdyaUZ6RR8WiQDm87lByzrX06PEmHXxe4ErYPdduKzAx20Hl4DCaM8Bp J30Q== X-Received: by 10.67.3.34 with SMTP id bt2mr16264643pad.3.1376579813766; Thu, 15 Aug 2013 08:16:53 -0700 (PDT) Received: from [192.168.1.103] ([223.251.33.189]) by mx.google.com with ESMTPSA id qp10sm88184pab.13.2013.08.15.08.16.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Aug 2013 08:16:52 -0700 (PDT) Message-ID: <520CF0E0.7030301@gmail.com> Date: Thu, 15 Aug 2013 23:16:48 +0800 From: Hai User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: [mv] overwrite files unexpectedly Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 15 Aug 2013 11:49:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.4 (--) Hi All If someone else have issued this thing before, please forgive my disturbance. Command $mv a_file* will overwrite one of your files iff 2 files with the same prefix under the folder. I know we should know what we are doing with the command given by ourselves. But I think this is an unusual case, and tools should complain it. Scenario: $ tree . |-- a_file |-- a_file.c Having these 2 files under a folder. And I want to mv these 2 files to another folder with the given command('cause I forget to type the destination directory), so the command will be interpreted to $mv a_file a_file.c, this is a totally correct command, so it will be performed perfectly. but one of my file is overwritten. Can mv check the args before parsing the data in it? 'Cause I think no body is going to rename a file with this kind of command 'mv a_file*', so there should be a potential error, and should better tell the user. Regards & Thanks Hai Guo ------------=_1376585524-5019-1--