Subject: Re: mv(1) and signals
To: None <jklowden@schemamania.org>
From: Arnaud Lacombe <lacombar@gmail.com>
List: tech-userlevel
Date: 10/18/2006 06:46:11
On Tue, Oct 17, 2006 at 04:55:33PM -0400, jklowden@schemamania.org wrote:
> $ ps | grep mv 13718 p7 D      0:23.08 
> mv -PRp dat /usr/users/home[...]
> 
> Hmm.  Those aren't documented options, and I hadn't typed them.
> 
there is no such 'P', 'R' or 'p' options in the code. Even the GNU mv
has no such option. 

> Now, I understand that mv(1) is supposed to be atomic, and I know from
> the manpage moving files across filesystems employs magic under the
> covers.  But  think atomic is different from irreversible, and I think
> irreversible is suboptimal.
> 
> Without looking at the code, I would guess that mv(1) is masking
> signals, perhaps in an effort to achieve atomicity.  Yet of course it
> can't make a non-atomic action (moving a set of files over a network)
> atomic, and preventing kill(8) from terminating the task looks to be
> more annoying than anything else.
I just made a test to move a directory across filesystem; no sources
files are deleted if I interrupt mv(1) (with ^C).  Moreover, no signal
are masked in source file.

This looks quite strage to me :/

regards,

 - Arnaud