On Fri, 5 Nov 2004, Brendan Byrd/SineSwiper wrote:
Also, I have a question about how files are moved. Currently, all files are copied to a new diskspace, and then the old diskspace is removed.
Only when the file is moving across filesystem boundaries.
Try this to see how mv usually behaves: $ strace -e trace=file mv /tmp/foo /tmp/bar
execve("/bin/mv", ["mv", "a", "/b"], [/* 54 vars */]) = 0
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=32570, ...}) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0755, st_size=1475331, ...}) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=32058672, ...}) = 0
stat64("/b", 0xbffff4c0) = -1 ENOENT (No such file or directory)
lstat64("a", {st_mode=S_IFREG|0644, st_size=454656, ...}) = 0
lstat64("/b", 0xbffff280) = -1 ENOENT (No such file or directory)
rename("a", "/b") = 0
Okay, after looking at the code again, this makes more sense. The copy routine doubles as a rename command if in move_mode, hence the "rename_successful" variable.
Paul Eggert wrote: > Brendan Byrd/SineSwiper <[EMAIL PROTECTED]> writes: > >>I hashed out a patch for mv which is more or less the opposite of the >>"--symbolic-link" option for cp. Instead of creating symlinks on the >>destination before the copy, it creates symlinks on the source after >>the move. > > Before we talk about the patch itself (which was not enclosed in your > email, by the way), could you give an illustration why such an option > is useful? Often the most important part of such changes is the > documentation, and the illustration should be put there.
Hmmm...it was in an attachment, according to my Sent file. I guess the mailing list doesn't support attachments. I could sent it in the e-mail, but I'm afraid that long lines would get word wrapped. Is there a place to send attachments/patches?
Sorry, I did forget about the man page, but I can easily add that in. (The mv --help was changed, though.) I just wanted to release the patch to see if the idea would be applied. As far as application and usefulness, three things come to mind:
1. Retaining glob information during a mv/ln. This was my itch to stratch. I wanted to move IRC *.log files to /var/log/ircd and then link those to the moved files. Unforunately, after you move them, you can't just type "ln /var/log/ircd/*.log ." if there are log files already in the directory other than the ones you move. With the mv -s, all of the glob information is retained, so it knows exactly which files get the symlinks.
2. Moving directories from one filesystem to another. A common way of shifting HD space on a multi-partitioned system is to move a large directory from the full partition, to area owned by partition with space to spare, followed by symlinking to the directory. This is made easier with a "mv -s" command.
3. Better compatibility/completeness with the cp command. In comparison to the cp command, the mv command is bereft of options. It's probably true that the cp command has a bunch of little used or legacy options, but this was one that I thought would have been added to mv already.
-- Brendan Byrd/SineSwiper <[EMAIL PROTECTED]> Computer techie, Perl hacker, and all-purpose Internet guru Resonator Software (http://www.ResonatorSoft.org/)
_______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-coreutils