[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] [PATCH] Fix handling of patch files with ':' in their na
From: |
Benjamin Poirier |
Subject: |
Re: [Quilt-dev] [PATCH] Fix handling of patch files with ':' in their name. |
Date: |
Tue, 4 Dec 2012 09:01:38 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On 2012/12/04 10:27, Jean Delvare wrote:
> >
> > diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
> > index d0c426e..08b7469 100644
> > --- a/quilt/scripts/patchfns.in
> > +++ b/quilt/scripts/patchfns.in
> > @@ -651,7 +651,7 @@ files_in_patch()
> > then
> > find "$path" -type f \
> > -a ! -path "$path/.timestamp" |
> > - sed -e "s:$path/::"
> > + sed -e "s/$(quote_bre "$path")\///"
> > fi
> > }
> >
>
> The sed part is always working now, but the -path part isn't... -path
> treats its argument as a pattern, i.e. it will try to expand '?', '*'
> and [] (at least) in the pattern. Not an issue in your specific case,
> ':' isn't affected, but let's fix it as well while we're here:
Good catch to you too ;)
>
> --- quilt.orig/quilt/scripts/patchfns.in
> +++ quilt/quilt/scripts/patchfns.in
> @@ -88,6 +88,12 @@ quote_re()
> echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g'
> }
>
> +# Quote a string for use in a pattern.
> +quote_pat()
> +{
> + echo "$1" | sed -e 's:\([][*?\\]\):\\\1:g'
> +}
> +
> patch_file_name()
> {
> echo "$QUILT_PATCHES/$1"
> @@ -650,8 +656,8 @@ files_in_patch()
> if [ -d "$path" ]
> then
> find "$path" -type f \
> - -a ! -path "$path/.timestamp" |
> - sed -e "s:$path/::"
> + -a ! -path "$(quote_pat $path)/.timestamp" |
Do not forget to quote $path, else bash will perform word splitting and
munge spaces.
> + sed -e "s/$(quote_bre "$path")\///"
> fi
> }
>
Re: [Quilt-dev] [PATCH] Fix handling of patch files with ':' in their name., Martin Quinson, 2012/12/02