summaryrefslogtreecommitdiffstats
path: root/test/missing-newline.test
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2018-11-05 17:01:28 +0100
committerJean Delvare <jdelvare@suse.de>2018-11-05 17:01:28 +0100
commitcbde26f240a64bf6b4bd58951113e3524fc8db88 (patch)
tree5d0346cc9f649dde5e95644012f6f7ee1b12621d /test/missing-newline.test
parentc57dd873c7e0c917b53946c750e6694dc6bce022 (diff)
downloadquilt-cbde26f240a64bf6b4bd58951113e3524fc8db88.tar.gz
new: Fix series file corruption when trailing newline is missing
When editing the series file with certain editors, it is possible that no trailing newline character is present on the last line. In such case, adding a new patch at the end of the series would corrupt the series file. Prevent that by ensuring that a newline character is always present. This fixes the second issue reported in bug #54295: https://savannah.nongnu.org/bugs/?54295 Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'test/missing-newline.test')
-rw-r--r--test/missing-newline.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/missing-newline.test b/test/missing-newline.test
new file mode 100644
index 0000000..0b7abe7
--- /dev/null
+++ b/test/missing-newline.test
@@ -0,0 +1,22 @@
+$ mkdir patches
+
+$ echo foo > foo
+$ quilt new 1.patch
+> Patch %{P}1.patch is now on top
+
+$ quilt add foo
+> File foo added to patch %{P}1.patch
+
+$ echo bar > foo
+$ quilt refresh -p ab
+> Refreshed patch %{P}1.patch
+
+# Sabotage the series file
+$ echo -n 1.patch > patches/series
+
+# quilt should insert the missing newline before appending
+$ quilt new 2.patch
+> Patch %{P}2.patch is now on top
+$ cat patches/series
+> 1.patch
+> 2.patch