Martin Coxall wrote:

>> Could this be it?  You could check by verifying the return
>> value of the various calls to Kernel.system, no?
> 
> The odd thing is, that seems like the obvious answer. However, if you
> take only the first two lines:
> 
> Dir.chroot(Dir.pwd)
> Kernel.system('echo "new file" > foo')
> 
> I'd expect that to work, because 'echo' is a builtin on most shells.

Yes, it's tree, "echo " is built into most shells, but after changing roots,
the program can't find the shell itself. Remember that "system" either
finds an external command or it finds a shell to run the shell's internal
commands. but if it can't find either, you will always get an error.

> But it doesn't, not on a random debian box I just tried. I don't
> understand that.

Ask yourself how "system" functions at all. It must always find a shell, a
command processor, to execute.

-- 
Paul Lutus
http://www.arachnoid.com