[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dh_movefiles, tar vs. mv



On Friday 25 February 2005 12:36 pm, Frank Küster wrote:
> Well, fine. But the question remains: dh_install uses cp, not mv.  What
> is the problem with using mv?  And would it be safe to use mv if I only
> move complete directories?

  I'd imagine that it doesn't use mv for the same reason "install" doesn't; 
ie, its purpose is to COPY files, not MOVE them.

  Anyway, I thought you were joking in your first message, but it looks like 
you're serious, so I'll answer this time.  If you're copying between files on 
the same device, mv will use the rename(2) system call, which is an atomic 
operation: ie, it doesn't "copy" the source files at all, it just links them 
into the target directory.  If you're copying between devices, mv will 
presumably copy the whole file before deleting it -- to actually remove a 
file "block-by-block" would mean a whole lot of totally pointless extra work 
in order to make the program less robust (there's no direct way to delete the 
first block of a file, so you'd have to either copy from the back or shift 
the whole file back a block at a time and then truncate it).

  Daniel

-- 
/------------------- Daniel Burrows <dburrows@debian.org> ------------------\
|                    "Is it too late to extricate myself                    |
|                     from this plot line?"                                 |
|                    "Yes." -- Fluble                                       |
\------ (if (not (understand-this)) (go-to http://www.schemers.org)) -------/

Attachment: pgplUzjWvPp0h.pgp
Description: PGP signature


Reply to: