diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2025-08-29 14:24:35 -0500 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2025-08-29 14:24:35 -0500 |
| commit | cc36624b2a8be3fbf180c5ae8d310d86486884bc (patch) | |
| tree | d193954c44c9ff5e2953b7977604dda475b9296b /usr.bin | |
| parent | f97b6a8f84b3ed209c2aea0958a7b889d0bf27ed (diff) | |
patch: test for unified diffs with spaces in filenames
The older GNU patch that we had in base did not properly handle spaces
in filenames in unified diffs, but bsdpatch seems to have handled this
fine at least since the version we imported into base initially. Add a
test with spaces in the filename specifically to be sure.
PR: 181272
Diffstat (limited to 'usr.bin')
| -rwxr-xr-x | usr.bin/patch/tests/unified_patch_test.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/usr.bin/patch/tests/unified_patch_test.sh b/usr.bin/patch/tests/unified_patch_test.sh index 47c4dc5faf73..a4b46ef34221 100755 --- a/usr.bin/patch/tests/unified_patch_test.sh +++ b/usr.bin/patch/tests/unified_patch_test.sh @@ -161,6 +161,23 @@ file_removal_body() atf_check -o inline:"y\n" cat foo } +atf_test_case namespace +namespace_head() +{ + atf_set "descr" "Test that patch(1) handles files with spaces in the name" +} +namespace_body() +{ + echo "ABC" > "with spaces.orig" + echo "ZYX" > "with spaces" + + atf_check -s not-exit:0 -o save:spaces.diff \ + diff -u "with spaces.orig" "with spaces" + + atf_check mv "with spaces.orig" "with spaces" + atf_check -o not-empty patch < spaces.diff +} + atf_test_case plinelen plinelen_body() { @@ -187,5 +204,6 @@ atf_init_test_cases() atf_add_test_case file_creation atf_add_test_case file_nodupe atf_add_test_case file_removal + atf_add_test_case namespace atf_add_test_case plinelen } |
