[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Heads up, mv -x (--swap) option.
From:       Rob Landley <rob () landley ! net>
Date:       2024-03-04 23:34:35
Message-ID: f5e12408-1a53-6669-7c60-17d69eea25e3 () landley ! net
[Download RAW message or body]

FYI it was added to coreutils here:

  https://github.com/coreutils/coreutils/commit/6cd2d5e5335b

And toybox here:

  https://github.com/landley/toybox/commit/a2419ad52d48

mv -x takes exactly two arguments and calls:

  renameat2(AT_FDCWD, argv[1], AT_FDCWD, argv[2], RENAME_EXCHANGE);

Which does an atomic exchange.

Rob

P.S. My toybox patch is fluffy because I support building a subset of the
commands on freebsd and macos, and didn't want to break cp/mv/install there
calling a linux-only syscall/flag, so I added a wrapper to lib/portability.c to
quarrantine the #ifdef. Both the syscall and the exchange flag for it were added
to linux in 2014, so maybe they've caught up by now or have an equivalent?
Dunno. I tweaked some help text while I was there, 80% of that patch is
basically noise to you guys. I haven't actually looked at the coreutils patch
because gplv3...
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic