[busybox] `cp' bug: Small test suite.
I've begun writing a small test setup for `busybox'. It's
implemented in `make'. Here's the output of the first successful
run, which demonstrates the bug I was talking about. I know what is
wrong, and plan to fix it. I will mail a patch; give me a few days;
I'm a novice. I'll put the test suite up also, when it's ready.
There are a lot of test cases for `cp'. It will take a while to
write one up for every path through the code.
I guess that eventually what this test setup should do is direct the
`ls -l' output into a file, then `diff' the results of GNU `cp' with
those of BusyBox `cp'. Any difference would indicate an error in
BusyBox. It will be simple to add a test for any other of BusyBox's
$0's that might need one; just write a makefile chunk and plug it in.
Look closely at the last two sections, where BusyBox `cp' sets the
permissions of `afile', the thing that the symlink points to, to the
modes of the symlink. `chmod' follows links; the error (one of
several I've found over the last two days) is in
`utility.c:copyFile'.
cd /usr/local/src/cvs.debian.org/debian-boot/boot-floppies/utilities/busybox/tests/
make
rm -rf cp_tests;
mkdir cp_tests;
cd cp_tests; \
mkdir there there1; \
cd there; \
ln -s ../afile .; \
ls -l afile;
lrwxrwxrwx 1 karlheg karlheg 8 Jan 26 18:22 afile -> ../afile
cd cp_tests; \
touch afile; \
ls -l afile; \
/bin/cp there/afile there1/; \
ls -l afile there1/afile;
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 there1/afile
rm -f cp_tests/afile cp_tests/there1/afile;
cd cp_tests; \
touch afile; \
ls -l afile; \
/usr/local/src/cvs.debian.org/debian-boot/boot-floppies/utilities/busybox/tests/cp there/afile there1/; \
ls -l afile there1/afile;
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 there1/afile
rm -f cp_tests/afile cp_tests/there1/afile;
cd cp_tests; \
touch afile; \
ls -l afile; \
/bin/cp -a there/afile there1/; \
ls -l afile there1/afile;
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
lrwxrwxrwx 1 karlheg karlheg 8 Jan 26 18:22 there1/afile -> ../afile
rm -f cp_tests/afile cp_tests/there1/afile;
cd cp_tests; \
touch afile; \
ls -l afile; \
/usr/local/src/cvs.debian.org/debian-boot/boot-floppies/utilities/busybox/tests/cp -a there/afile there1/; \
ls -l afile there1/afile;
-rw-r--r-- 1 karlheg karlheg 0 Jan 26 18:22 afile
-rwxrwxrwx 1 karlheg karlheg 0 Jan 26 18:22 afile
lrwxrwxrwx 1 karlheg karlheg 8 Jan 26 18:22 there1/afile -> ../afile
Compilation finished at Wed Jan 26 18:22:35
Reply to: