[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] gnulib-tool: Don't assume writable source
From: |
Benno Fünfstück |
Subject: |
Re: [PATCH] gnulib-tool: Don't assume writable source |
Date: |
Tue, 18 Feb 2020 22:03:41 +0100 |
Ah, this patch still has an issue I just found right now: gnulib
actually wants to preserve +x access rights, some parts rely on that.
Any idea what the best way to fix this would be?
--
Benno
Am Di., 18. Feb. 2020 um 21:20 Uhr schrieb Benno Fünfstück
<address@hidden>:
>
> If the location in which gnulib-tool is installed is not writable (the
> files are readonly), then cp'ing those files creates readonly files as
> well. To avoid this, use `cat $foo > $bar` to create a new file, with
> fresh attributes.
> ---
> gnulib-tool | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/gnulib-tool b/gnulib-tool
> index 89f6077e5..158873d4f 100755
> --- a/gnulib-tool
> +++ b/gnulib-tool
> @@ -1715,8 +1715,7 @@ func_lookup_file ()
> lookedup_tmp=
> if test -n "$lkpatches"; then
> lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
> - rm -f "$tmp/$lkbase"
> - cp "$lookedup_file" "$tmp/$lkbase"
> + cat "$lookedup_file" > "$tmp/$lkbase"
> save_IFS="$IFS"
> IFS="$PATH_SEPARATOR"
> for patchfile in $lkpatches; do
> @@ -5224,7 +5223,7 @@
> s,^\(.................................................[^ ]*\) *,
> esac
> func_dest_tmpfilename "$g"
> func_lookup_file "$f"
> - cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
> + cat "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
> case "$f" in
> *.class | *.mo )
> # Don't process binary files with sed.
> @@ -7316,7 +7315,7 @@ s/\([.*$]\)/[\1]/g'
> fi
> # Copy the file.
> func_dest_tmpfilename "$g"
> - cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
> + cat "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
> already_present=true
> if test -f "$destdir/$g"; then
> # The file already exists.
> --
> 2.25.1
>