This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] update-copyright.py: Retain file mode
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Jun 2016 16:14:57 +0200
- Subject: [PATCH] update-copyright.py: Retain file mode
- Authentication-results: sourceware.org; auth=none
Hi!
Ok for trunk?
thanks,
contrib/ChangeLog
2016-06-21 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* update-copyright.py (Copyright.process_file): Retain original
file mode.
---
contrib/update-copyright.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py
index ebefa46..04afd18 100755
--- a/contrib/update-copyright.py
+++ b/contrib/update-copyright.py
@@ -393,8 +393,10 @@ class Copyright:
lines = []
changed = False
line_filter = filter.get_line_filter (dir, filename)
+ mode = None
with open (pathname, 'r') as file:
prev = None
+ mode = os.fstat (file.fileno()).st_mode
for line in file:
while line:
next_line = None
@@ -421,6 +423,7 @@ class Copyright:
with open (tmp_pathname, 'w') as file:
for line in lines:
file.write (line)
+ os.fchmod (file.fileno(), mode)
if self.use_quilt:
subprocess.call (['quilt', 'add', pathname])
os.rename (tmp_pathname, pathname)
--
2.8.1