cp: can't create link 'b/a': No such file or directory

Timo Teras timo.teras at iki.fi
Mon Mar 17 09:52:01 UTC 2014


On Mon, 17 Mar 2014 10:35:55 +0100
Harald Becker <ralda at gmx.de> wrote:

> Hi Timo !
> 
> >$ cp -af a a b
> 
> Did not analyze if there is a deeper error, but your initial
> approach seems to be wrong.
> 
> cp FILE FILE DIR
> 
> shall copy both source files under there original names in given
> directory. So how can you have two files of same name in one
> directory. This will fail both on hard linking and physical
> copying.
> 
> So what is your intention to do this?

Yes, as use case it does not make sense. But the problem is that
busybox cp aborts, and exits with error. Especially big issue if -f is
specified.

For reference, coreutils cp just prints:
cp: warning: source file 'a' specified more than once

But regardless of -f or not, it never returns error.

This breaks certain makefiles and build scripts that for some weird
reason get same source file specified twice in the list of files to
copy. Yes, those should be fixed - but busybox cp does need fixing too.

- Timo


More information about the busybox mailing list