I'm out of ideas, then.
I don't mean to sound repetitive or rude, but I'm not sure I believe you. *Something* else has got to be affecting this. If my original example was executed just as I showed it:
$ cat script.pl
system("rcp file host:/tmp");
$ rcp file host:/tmp
$ perl script.pl
$
and the first manual rcp succeeded normally while the second one (via the Perl script) did not, something is seriously wrong with your environment.
If your code varies in ANY way from that simplistic example above, investigate EACH assumption you're making about each item, and be absolutely certain each is behaving as you expect it. If you're using variables in the Perl side of things instead of static text (like I am above), be 100% certain that those variables are set correctly. If you are modifying your environment in any way (your $ENV{PATH} for example), check assumptions there.
Finally, the whole problem itself that you are describing is very fishy! The fact that 'rsh' would create a file but fail to put any data in it tells me that it had a problem reading data from the original file, or writing anything to the destination file. If your script's Perl environment is unchanged (not changing uid's or gid's or something), perhaps the destination system's filesystem ran out of space? It's equally weird that rsh is not giving you any errors. Try running, say, 'perl -e "system('rcp file host:/tmp')"' in lieu of running a script at all. If that succeeds normally, then you clearly have something in your script that is messing things up. Is it prompting for a password? Should it? Does rcp have any debugging options or a 'verbose' setting? Anything out of the ordinary there?
If you've still exhausted all options, and have tried my example above and still get a normal file when running it by hand but get a zero-length file the other way, I am out of options. Perhaps it's some strange bug with Perl or rsh. Something certainly smells like you're not telling me everything, or you're assuming something that seems benign enough to you so as not to mention it wouldn't be causing any problems, when in fact it is. It's impossible for me to tell. |