texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: install-info: Fix dir file mode being restricted


From: Arsen Arsenović
Subject: branch master updated: install-info: Fix dir file mode being restricted
Date: Fri, 24 Feb 2023 12:57:05 -0500

This is an automated email from the git hooks/post-receive script.

arsen pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 94ac7b4ecc install-info: Fix dir file mode being restricted
94ac7b4ecc is described below

commit 94ac7b4ecc69b46b3ecbc9591ace0f1a1c39836b
Author: Arsen Arsenović <arsen@aarsen.me>
AuthorDate: Fri Feb 24 17:02:40 2023 +0100

    install-info: Fix dir file mode being restricted
    
    The recent switch to mkstemp and atomic updating of the directory
    file unintentionally lead to overly restrictive permissions being
    set on directory file.  This error was originally introduced in
    93162b78d84f731710025b300bc0cd7ca8b14347 (2022-12-03 Gavin Smith
    <gavinsmith0123@gmail.com>).
    * install-info/install-info.c (output_dirfile): Change mode of
    installed dir file back to its usual value, rather than the
    mkstemp default of 0600.
---
 ChangeLog                   | 13 +++++++++++++
 install-info/install-info.c | 10 ++++++++++
 2 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4ae80e4dc7..de0d88666a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-02-24  Arsen Arsenović  <arsen@aarsen.me>
+
+       install-info: Fix dir file mode being restricted
+
+       The recent switch to mkstemp and atomic updating of the directory
+       file unintentionally lead to overly restrictive permissions being
+       set on directory file.  This error was originally introduced in
+       93162b78d84f731710025b300bc0cd7ca8b14347 (2022-12-03 Gavin Smith
+       <gavinsmith0123@gmail.com>).
+       * install-info/install-info.c (output_dirfile): Change mode of
+       installed dir file back to its usual value, rather than the
+       mkstemp default of 0600.
+
 2023-02-23  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/end_line.c
diff --git a/install-info/install-info.c b/install-info/install-info.c
index dcc36def2e..9d8201c977 100644
--- a/install-info/install-info.c
+++ b/install-info/install-info.c
@@ -1053,6 +1053,16 @@ output_dirfile (char *dirfile, int dir_nlines, struct 
line_data *dir_lines,
   else
     fclose (output);
 
+  /* Reset the mode that the file is set to.  */
+  mode_t um = umask (0022);
+  umask (um);
+  if (fchmod (tempfile, 0666 & um) < 0)
+    {
+      perror ("chmod");
+      remove (tempname);
+      exit (EXIT_FAILURE);
+    }
+
   /* Update dir file atomically.  This stops the dir file being corrupted
      if install-info is interrupted. */
   if (rename (tempname, dirfile) == -1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]