This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Keep patch file permissions in mklog

On 01-08-14 06:21, Yury Gribov wrote:
Cc Diego.

From: Tom de Vries <>
Sent:  Saturday, May 31, 2014 11:47AM
To: Geoff Keating <>
Cc: GCC Patches
Subject: [PATCH] Keep patch file permissions in mklog

On 05/31/2014 11:47 AM, Tom de Vries wrote:

Currently, mklog resets the permissions on a patch file:


The permissions problem does not occur anymore with the latests versions of mklog, since it doesn't modify the patch file anymore.

This patch adds a script contrib/mklog-in-patch, which uses mklog to generate the skeleton log, but generates the log at the start of the patch as mklog did before (which is how I like to use it).

OK for trunk?

I can also try to add an --inline option to mklog instead.

- Tom

2014-08-01  Tom de Vries  <>

	* mklog-in-patch: New script.

diff --git a/contrib/mklog-in-patch b/contrib/mklog-in-patch
new file mode 100755
index 0000000..6d041eb
--- /dev/null
+++ b/contrib/mklog-in-patch
@@ -0,0 +1,61 @@
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This file is part of GCC.
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+# Check for errors
+set -e
+scriptdir=$(dirname $0)
+prog=$(basename $0)
+if [ "$diff" = "" ]; then
+   usage
+    echo <<EOF
+usage: $prog file.diff
+Invokes mklog, and prepends the generated log to file.diff.
+elif [ ! -r "$diff" ]; then
+    echo "Could not open file $diff for reading"
+    exit 1
+# Generate log in $temp
+if ! $scriptdir/mklog "$diff" > "$temp"; then
+    echo "Could not write log file to $temp"
+    exit 1
+# Append patch to $temp, and move $temp to $patch.  For the latter, we use cat
+# rather than mv to keep $diff permissions the same.
+if ! ( cat $diff >>$temp && cat $temp >$diff ); then
+    echo "Could not add the ChangeLog entry to $diff"
+    exit 1
+if ! rm $temp; then
+    echo "Could not remove $temp"
+    exit 1

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]