GNU bug report logs - #6353
cp and mv with single wild card argument acts as if multiple arguments were entered.

Previous Next

Package: coreutils;

Reported by: Darwin Gregory <darwin.gregory <at> gmail.com>

Date: Fri, 4 Jun 2010 16:17:01 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Darwin Gregory <darwin.gregory <at> gmail.com>
Subject: bug#6353: closed (Re: bug#6353: cp and mv with single wild card
 argument acts as if multiple arguments were entered.)
Date: Mon, 07 Jun 2010 22:51:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#6353: cp and mv with single wild card argument acts as if multiple  arguments were entered.

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 6353 <at> debbugs.gnu.org.

-- 
6353: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6353
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Bob Proulx <bob <at> proulx.com>
To: Darwin Gregory <darwin.gregory <at> gmail.com>
Cc: 6353-done <at> debbugs.gnu.org
Subject: Re: bug#6353: cp and mv with single wild card argument acts as if
	multiple arguments were entered.
Date: Mon, 7 Jun 2010 16:50:18 -0600
Hi Darwin,

I am happy that you are satisfied with the responses.  I am going to
close the bug ticket in the bug tracking system with this message.

Bob

[Message part 3 (message/rfc822, inline)]
From: Darwin Gregory <darwin.gregory <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: cp and mv with single wild card argument acts as if multiple 
	arguments were entered.
Date: Fri, 4 Jun 2010 12:13:46 -0400
[Message part 4 (text/plain, inline)]
I did a quick search of the archive, and didn't find this one, but there
seems to be a potential logical failure in the cp and mv commands.  It may
be specific to an implementation, but I feel it is a critical issue.

I have tested this on Suse Enterprise 10.x and OpenSuse 11.x (the only
implementations I currently have access to).

If you execute "cp /path/*" the command expands the wildcard, and treats the
last file as the destination directory.  If the last file in /path/ is not a
directory the command fails, but not with the appropriate error.  However,
if the last file in the directory (or other wildcard expansion) is a
directory, it will copy all earlier files in the expansion to that
directory.

The same happens for mv.  I did mv * in my home directory where the last
entry was a workspace subdirectory.  It moved all of my files and
directories to my workspace subdirectory.

I feel this is an unacceptable outcome for a single argument that is a
wildcard, since whether it works or not is based on the arbitrary presence
or absence of a directory as the final element in the wildcard expansion.
It would be much better to fail with an error indicating  "missing
destination file operand" as it does if the first argument does not
contain a wildcard.

Also, if a wildcard expansion contains exactly 2 elements, the second is
treated as a target whether or not it is a directory, causing a potential
overlay of data.

... Darwin
[Message part 5 (text/html, inline)]

This bug report was last modified 14 years and 356 days ago.

Previous Next


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