Subject: bug#20603: Possible bug in cp

From: Pádraig Brady <[email-masked]>
Date: Mon, 18 May 2015 16:55:40 +0100

tag 20603 notabug
close 20603
stop

On 18/05/15 14:04, Chris Puttick wrote:
> Hi
> 
> In moment of tiredness issued a cp command similar to
> 
> cp /path/to/files/*
> 
> neglecting to add a destination (should have been ./)
> 
> The files in the directory were 2 vdisks both ending .qcow2.
> 
> No error message was generated and the apparent result of running the
> command is that the file whose name came first alphabetically was
> copied over the other.
> 
> The installed OS on the machine was Ubuntu 12.04 and cp version 7.4.
> 
> I can provide more details on request.

You were unlucky that the glob expanded to two files.
With more files you would have gotten an error.
However the expansion is done before cp executes,
and so there is no opportunity to behave differently here.

thanks,
Pádraig