News for hackers. Stuff that matters.
Re:Heroku Fucking Console by sbierwagen on Friday March 01, 2013 @12:44PM (#5305701)
cp(1)'s handling of directories.

  ~/foo$ mv bar baz
  ~/foo$ ls
  baz
  ~/foo$ cp baz bar
  cp: omitting directory `baz'
  ~/foo$ ls
  baz
Re:Heroku Fucking Console by sirclueless on Friday March 01, 2013 @01:12PM (#5305891)
To be fair, `cp baz bar` is the only one of those commands that might take three hours.
Re:Heroku Fucking Console by vidarh on Friday March 01, 2013 @01:48PM (#5306103)
That's not true. mv across filesystems degrades to a copy, and can take just as long.
Re:Heroku Fucking Console by wtallis on Friday March 01, 2013 @02:15PM (#5306306)
And CoW filesystems are getting more common, so cp's best case can be almost as fast as mv's.
Re:Heroku Fucking Console by loeg on Friday March 01, 2013 @09:50PM (#5308237)
Really? After some quick digging, nope. Tl;dr: Not by default, and only on Linux, and only with btrfs (still marked experimental) and only with the `--reflink` flag.

FreeBSD `cp(1)`: `copy_file()` does a simple `read()`/`write()` loop with a buffer[0] (despite ZFS maybe supporting CoW).

GNU coreutils `cp(1)`: `copy_reg()` calls out to `clone_file()` if and only if `--reflink` was passed[1], and `clone_file()` fails on everything but btrfs[2].

[0]: FreeBSD `copy_file()`: https://github.com/freebsd/freebsd/blob/master/bin/cp/utils....

[1]: coreutils `copy_reg()`: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f...

[2]: coreutils `clone_file()`: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f...