From Bugzilla Helper: User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686) Description of problem: When rcp'ing a file to /dev/null, an error is caused because the devfs implementation of /dev/null doesn't seem to allow ftruncate() to be called on it. rcp calls ftruncate() after the end of a transfer (on the receiver). This was never a problem before using a non-devfs /dev/null. Our batch queueing software copies the stdout and stderr files back to the submitting host using rcp. Many of our scripts copy these to /dev/null when they are not needed. Hence the problem. Because an error is thrown, there is a delay of ~30 at the end of every batch job. As a quick fix, I modified rcp.c and recompiled. This worked but I'm guessing it would be better to fix devfs to allow ftruncate calls. How reproducible: Always Steps to Reproduce: [pedretti@foo ~]$ rcp filename foo:/dev/null Actual Results: rcp: can't truncate /dev/null: Permission denied Expected Results: No error messages Additional info: My fix, beginning line 883 in rcp.c: if (ftruncate(ofd, size)) { /* fix to avoid calling ftruncate() on /dev/null */ if (strncmp(np, "/dev/null", 9) != 0) { error("rcp: can't truncate %s: %s\n", np, strerror(errno)); wrerr = DISPLAYED; } }
I agree. On the other hand, according to the 'official' specification for ftruncate the behaviour of it is unspecified for anything but regular files or shared memory segments, so an app must not rely on the fact that it does anything reasonable on anything else. So i'll fix it a little more thoroughly than you did, but it needs to be fixed in rcp as it is broken there. The next version (0.17-6) will have the fix included. Should be available via rawhide real soon now (in the next couple of days). Read ya, Phil