On Friday 28 March 2008 15:36, Joakim Tjernlund wrote:
> I just tried to "cp /dev/mtdblock1 myfile" and I got
> a copy of the mtdblock1 file, not the contents:
>
> > ls -l myfile
> brw-r----- 1 root root 31, 1 Mar 28 15:33 myfile
Well, which behavior is correct is a question of taste.
POSIX is silent on this.
> Someone also mentioned problems copy files from /proc that has a zero
> file size, i.e, it seemed like bb cp stats the file to get the size and
> the copies that many bytes. Files in /proc don't always report correct
> file size.
Correct, That's why cp does not trust the size, it copies until EOF is seen:
libbb/copy_file.c:
if (bb_copyfd_eof(src_fd, dst_fd) == -1)
retval = -1;
Here I copy a /proc file with no problems:
# ls -l /proc/cmdline
-r--r--r-- 1 root root 0 Mar 28 16:34 /proc/cmdline
# cp /proc/cmdline /tmp/cmdline
# ls -l /tmp/cmdline
-r--r--r-- 1 root root 114 Mar 28 16:34 /tmp/cmdline
# cp --help
BusyBox v1.10.0 (2008-03-22 15:35:10 CET) multi-call binary
...
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox