[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: patch does not respect the posix filename determination
From: "Liu, Shuang (ADITG/ESM)" <sliu () de ! adit-jv ! com>
Date: 2019-06-26 14:52:01
Message-ID: 9040470146CBEE468A322327A78EFE6D7B8B8AA8 () HI2EXCH01 ! adit-jv ! com
[Download RAW message or body]
Hi,
We created a ticket as https://bugs.busybox.net/show_bug.cgi?id=11981
If a filename is not given, busybox patch uses the newname in the line +++.
This does not align with the posix filename determination rule.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/patch.html
The posix filename determination said:
If the type of diff is context, the patch utility shall delete the pathname \
components (as specified by the -p option) from the filename on the line beginning \
with "---" (if copied context) or "+++" (if unified context), then test for the \
existence of this file relative to the current directory (or the directory specified \
with the -d option). If the file exists, the patch utility shall use this filename.
Steps to Reproduce:
$ echo test > test.txt
$ echo updated_test > utest.txt
$ diff -u test.txt utest.txt
--- test.txt
+++ utest.txt
@@ -1 +1 @@
-test
+updated_test
$ diff -u test.txt utest.txt > test.patch
$ busybox patch < test.patch
patching file utest.txt
Hunk 1 FAILED 1/1.
-test
+updated_test
Expected behavior with GNU patch --posix:
$ patch --posix < test.patch
patching file test.txt
Best regards
Shuang Liu
Engineering Software Multimedia (ADITG/ESM)
_______________________________________________
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