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: Andreas Gruenbacher
Subject: Re: [bug-patch] [PATCH] do not validate target name when it is specified on the command line
Date: Mon, 14 Feb 2011 09:59:04 +0100
User-agent: KMail/1.13.5 (Linux/2.6.34.7-0.4-desktop; KDE/4.4.4; x86_64; ; )

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.

Thanks,
Andreas



reply via email to

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