cp /dev/null

John Kelly jakelly at shtc.net
Tue Nov 1 19:03:57 UTC 2005


cp /dev/null myfile

should create a (normal) empty file named "myfile" but it copies the
device file /dev/null, as though the -a flag was specified.

This bug has been around for a while, because it fails in 1.00 and
snapshot 20051030.  Same problem for /dev/zero, maybe others too.

I discovered this when trying to run e2fsprogs make check (mainline,
not the busybox version).  Most of the tests started failing, because
the test script does a cp /dev/null to create an empty file.

This is such a common shell technique, funny that nobody else noticed
the bug before now.

Guess I should file a bug report ...




More information about the busybox mailing list