I checked in the long-pending update to cp, which turned into a largeish rewrite. (Actually several iterative rewrites to figure out how _not_ to have it be a giant forest of gotos but still be reasonably efficient.)

It's now using the current dirtree stuff, and using openat() and friends instead of generating a long path, and it's handling block/char/sock/fifo entries correctly. Plus I managed to strip it down to just one main() function and one dirtree callback function.

It's doing -l (copy as hardlinks) but I haven't implemented -s (copy as symlinks) yet. I also have -HLP left to do. (I note that -Lr is pilot error: it detects source and destination being the same, both in the current file and the "we've recursed down to the top level directory again ala "cp -R .. .", but you can still make follow-symlink loops it won't catch.) Also, I need to test cp -r with both files and directories of mode 000. I know what I'm currently doing won't work on NFS (ask me if I care), but what other corner cases am I missing. (Really I can just create everything mode 600 and then fix it in the -p logic, I just don't like doing two metadata syscalls when I don't have to. There's always a potential race condition between create and adjust on a live filesystem and I'm never quite sure I've caught 'em all...)

Next up along this axis is "mv", which is a bit funky in that mv across devices is a combined cp and rm. I'll probably fold mv into cp because of this (but not rm because posix's fiddly behavior requirements for that are horrible).

Rob

P.S. I just noticed Busybox has a "preserve hardlink" thing I'm not doing yet either. (Spotted it when yanking more entries from Aboriginal's baseconfig-busybox.) I'd planned to tackle that for tar/zip/cpio and such, and can make it generic then.
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to