Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-04 21:42:36 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-04 21:42:36 +0300
commit286b33721d5f6afd615f752ea83bbd72658c6bb9 (patch)
tree93c9efb8b08a9674eca57c5ce1f30bdc6f54f9b3 /testsuite
parented2af2e82dbcfccb7392e9fbc3f837de1594c103 (diff)
sed: correctly handle 'w FILE' commands writing to the same file
function old new delta sed_xfopen_w - 84 +84 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/sed.tests9
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/sed.tests b/testsuite/sed.tests
index 2b78c9b12..e62b839f7 100755
--- a/testsuite/sed.tests
+++ b/testsuite/sed.tests
@@ -405,6 +405,15 @@ testing "sed ^ OR not^" \
"" \
"abca\n"
+# This only works if file name is exactly the same.
+# For example, w FILE; w ./FILE won't work.
+testing "sed understands duplicate file name" \
+ "sed -n -e '/a/w sed.output' -e '/c/w sed.output' 2>&1 && cat sed.output && rm sed.output" \
+ "a\nc\n" \
+ "" \
+ "a\nb\nc\n"
+
+
# testing "description" "commands" "result" "infile" "stdin"
exit $FAILCOUNT