bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-patch] [PATCH] do not validate target name when it is specified


From: Jim Meyering
Subject: Re: [bug-patch] [PATCH] do not validate target name when it is specified on the command line
Date: Mon, 14 Feb 2011 10:16:12 +0100

Andreas Gruenbacher wrote:

> On Monday 14 February 2011 07:14:19 Jim Meyering wrote:
>> Can you give an example in which patch would have
>> selected a bad name, yet there is still a reason to prompt?
>
> Patch ignores filenames with too few pathname components, and prompts in a
> case like this:
>
>       $ cat f.diff
>       --- f
>       +++ f
>       @@ -1 +1 @@
>       -1
>       +2
>       $ patch -p1 < f.diff
>       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:
>       --------------------------
>       |--- f
>       |+++ f
>       --------------------------
>       File to patch:
>
> Malformed names could be treated the same way, for example,
>
>       $ cat f.diff
>       --- ../f
>       +++ ../f
>       @@ -1 +1 @@
>       -1
>       +2
>       $ patch -p0 < f.diff
>       ignoring file name with ".." component: ../f
>       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:
>       --------------------------
>       |--- ../f
>       |+++ ../f
>       --------------------------
>       File to patch:
>
>> I confess I'm biased: I do not like being prompted, and if there's
>> anything suspicious about a patch, I'd rather avoid the prompt
>> altogether.
>
> The -f and -t options will turn the prompting off; that's what I use.

I see what you mean, but invalid names seem important enough that I would
not want to be prompted -- not even with a warning -- about the patch
in question.  When being prompted, it is too easy to miss the preceding
warning among the already relatively verbose output.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]