Page MenuHomeFreeBSD

Fix -S with -l not being atomic.

Authored by bdrewery on Aug 9 2016, 7:29 PM.



It was unlinking the target even though it uses rename(2) which already
effectively does that. -S is intended to not unlink(2) the target first.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

Test Plan

Truss and:

/usr/tests/usr.bin/xinstall # kyua test
install_test:copy_self  ->  passed  [0.036s]
install_test:copy_self_comparing  ->  passed  [0.035s]
install_test:copy_self_safe  ->  passed  [0.035s]
install_test:copy_self_safe_comparing  ->  passed  [0.035s]
install_test:copy_to_nonexistent  ->  passed  [0.035s]
install_test:copy_to_nonexistent_backup  ->  passed  [0.035s]
install_test:copy_to_nonexistent_backup_safe  ->  passed  [0.035s]
install_test:copy_to_nonexistent_comparing  ->  passed  [0.035s]
install_test:copy_to_nonexistent_preserving  ->  passed  [0.035s]
install_test:copy_to_nonexistent_safe  ->  passed  [0.035s]
install_test:copy_to_nonexistent_safe_comparing  ->  passed  [0.035s]
install_test:hard_link  ->  passed  [0.033s]
install_test:mkdir_simple  ->  passed  [0.052s]
install_test:overwrite  ->  passed  [0.035s]
install_test:overwrite_backup  ->  passed  [0.036s]
install_test:overwrite_backup_comparing  ->  passed  [0.037s]
install_test:overwrite_backup_safe  ->  passed  [0.036s]
install_test:overwrite_backup_safe_comparing  ->  passed  [0.037s]
install_test:overwrite_comparing  ->  passed  [0.035s]
install_test:overwrite_eq  ->  passed  [0.035s]
install_test:overwrite_eq_comparing  ->  passed  [0.035s]
install_test:overwrite_eq_safe  ->  passed  [0.035s]
install_test:overwrite_eq_safe_comparing  ->  passed  [0.035s]
install_test:overwrite_safe  ->  passed  [0.035s]
install_test:overwrite_safe_comparing  ->  passed  [0.035s]
install_test:strip_changing  ->  passed  [0.045s]
install_test:strip_changing_comparing  ->  passed  [0.045s]
install_test:strip_changing_overwrite  ->  passed  [0.045s]
install_test:strip_changing_overwrite_comparing  ->  passed  [0.045s]
install_test:strip_changing_overwrite_eq  ->  passed  [0.045s]
install_test:strip_changing_overwrite_eq_comparing  ->  passed  [0.045s]
install_test:strip_noop  ->  passed  [0.038s]
install_test:symbolic_link  ->  passed  [0.035s]
install_test:symbolic_link_absolute  ->  passed  [0.036s]
install_test:symbolic_link_relative  ->  passed  [0.036s]

Results file id is usr_tests_usr.bin_xinstall.20160809-192916-083663
Results saved to /root/.kyua/store/results.usr_tests_usr.bin_xinstall.20160809-192916-083663.db

35/35 passed (0 failed)

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bdrewery retitled this revision from to Fix -S with -l not being atomic..
bdrewery updated this object.
bdrewery edited the test plan for this revision. (Show Details)
bdrewery added reviewers: brooks, jhb, bapt.

These came in with the initial import of -l from NetBSD, but NetBSD never had these unlinks. The unlink is kept for the default (no -S) case.

jhb edited edge metadata.
This revision is now accepted and ready to land.Aug 10 2016, 1:47 PM
This revision was automatically updated to reflect the committed changes.