+2020-02-22 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Ensure copied files are writable.
+ Reported by Benno Fünfstück <benno.fuenfstueck@gmail.com> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00101.html>.
+ * gnulib-tool (func_ensure_writable): New function.
+ (func_ln_s, func_hardlink, func_lookup_file, func_import,
+ func_create_testdir, copy-file): Invoke it after copying a file.
+
2020-02-22 Bruno Haible <bruno@clisp.org>
users.txt: Update.
done
}
+# func_ensure_writable DEST
+# Ensures the file DEST is writable.
+func_ensure_writable ()
+{
+ test -w "$1" || chmod u+w "$1"
+}
+
# func_ln_s SRC DEST
# Like ln -s, except use cp -p if ln -s fails.
func_ln_s ()
esac
cp -p "$cp_src" "$2"
+ func_ensure_writable "$2"
}
}
ln "$1" "$2" || {
echo "$progname: ln failed; falling back on cp -p" >&2
cp -p "$1" "$2"
+ func_ensure_writable "$2"
}
}
lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
rm -f "$tmp/$lkbase"
cp "$lookedup_file" "$tmp/$lkbase"
+ func_ensure_writable "$tmp/$lkbase"
save_IFS="$IFS"
IFS="$PATH_SEPARATOR"
for patchfile in $lkpatches; do
func_dest_tmpfilename "$g"
func_lookup_file "$f"
cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
+ func_ensure_writable "$tmpfile"
case "$f" in
*.class | *.mo )
# Don't process binary files with sed.
func_lookup_file "$f"
if test -n "$lookedup_tmp"; then
cp -p "$lookedup_file" "$testdir/$g"
+ func_ensure_writable "$testdir/$g"
else
func_should_link
if test "$copyaction" = symlink; then
func_hardlink "$lookedup_file" "$testdir/$g"
else
cp -p "$lookedup_file" "$testdir/$g"
+ func_ensure_writable "$testdir/$g"
fi
fi
fi
# Copy the file.
func_dest_tmpfilename "$g"
cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
+ func_ensure_writable "$tmpfile"
already_present=true
if test -f "$destdir/$g"; then
# The file already exists.