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
This commit is contained in:
Kyle Evans
2025-08-29 14:24:35 -05:00
parent f97b6a8f84
commit cc36624b2a
+18
View File
@@ -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
}