diff options
author | Jim Meyering <meyering@redhat.com> | 2011-02-17 09:59:56 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-02-17 10:00:57 +0100 |
commit | e0f707523cab26f74ec23f4a20a27add8702ed5b (patch) | |
tree | fd621c6f3b11270d9bd670f4b129534909b5c456 /tests/bad-filenames | |
parent | f663762bf0aa5089fee41d62a4e7528f436164d4 (diff) | |
download | patch-e0f707523cab26f74ec23f4a20a27add8702ed5b.tar.gz |
don't warn twice about the same invalid file name
* src/pch.c (name_is_valid): Don't warn about the same name twice.
* tests/bad-filenames (emit_patch): Exercise the new code.
Diffstat (limited to 'tests/bad-filenames')
-rw-r--r-- | tests/bad-filenames | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/bad-filenames b/tests/bad-filenames index 0bc23eb..e1b9e92 100644 --- a/tests/bad-filenames +++ b/tests/bad-filenames @@ -114,3 +114,27 @@ echo 1 > g check 'patch -f -p1 --dry-run < d.diff || echo status: $?' <<EOF patching file g EOF + +mkdir d +cd d +cat > d.diff <<EOF +--- ../h ++++ ../h +@@ -0,0 +1 @@ ++x +EOF + +touch ../h +check 'patch -f -p0 < d.diff || echo status: $?' <<EOF +Ignoring potentially dangerous file name ../h +can't find file to patch at input line 3 +Perhaps you used the wrong -p or --strip option? +The text leading up to this was: +-------------------------- +|--- ../h +|+++ ../h +-------------------------- +No file to patch. Skipping patch. +1 out of 1 hunk ignored +status: 1 +EOF |