groff-commit
[Top][All Lists]
Advanced

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

[groff] 18/27: [build]: Avoid potential race when building neqn.


From: G. Branden Robinson
Subject: [groff] 18/27: [build]: Avoid potential race when building neqn.
Date: Tue, 3 May 2022 14:27:17 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit cc0bcaf240254e2104d6c9f25b2a15e557700a36
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon May 2 19:49:06 2022 -0500

    [build]: Avoid potential race when building neqn.
    
    * src/preproc/eqn/eqn.am (neqn): Produce temporary file first and set
      its permissions before moving it into place.  If anything in the
      future ever has a dependency on it, this avoids a race where the file
      exists, satisfying a dependency, but execution is attempted before its
      `x` permission bit is set.
---
 ChangeLog              | 8 ++++++++
 src/preproc/eqn/eqn.am | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 57a75e9f..0029b65d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-05-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/eqn/eqn.am (neqn): Produce temporary file first
+       and set its permissions before moving it into place.  If
+       anything in the future ever has a dependency on it, this avoids
+       a race where the file exists, satisfying a dependency, but
+       execution is attempted before its `x` permission bit is set.
+
 2022-05-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [build]: Ensure that we install *.me source files, but don't
diff --git a/src/preproc/eqn/eqn.am b/src/preproc/eqn/eqn.am
index cece865b..30e6b9ad 100644
--- a/src/preproc/eqn/eqn.am
+++ b/src/preproc/eqn/eqn.am
@@ -62,8 +62,9 @@ neqn: $(top_srcdir)/src/preproc/eqn/neqn.sh 
$(SH_DEPS_SED_SCRIPT)
               -f $(SH_DEPS_SED_SCRIPT) \
               -e $(SH_SCRIPT_SED_CMD) \
               $(top_srcdir)/src/preproc/eqn/neqn.sh \
-              >$@ \
-       && chmod +x $@
+              >$@.tmp \
+       && chmod +x $@.tmp \
+       && mv $@.tmp $@
 
 
 # Local Variables:



reply via email to

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