Skip to contentSkip to conversation

Makefile.am: Avoid redirection of input and output files

PATCH Superseded Khem Raj 2 participants 5 messages Nov 6, 2019 – Mar 6, 2020 Kbuild

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 Makefile.am: Avoid redirection of input and output files

Ensure that directory is created before its written to

This can cause a build race in a highly parallelised build where a directory is not yet created but output file is being written using redirection e.g.

rst2man.py --strict --no-raw --no-generator --no-datestamp < ../git/monitor/iwmon.rst > monitor/iwmon.1 /bin/sh: monitor/iwmon.1: No such file or directory
make[1]: *** [Makefile:3544: monitor/iwmon.1] Error 1

---
v2: create directory before emitting doc files into it

 Makefile.am | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Makefile.am +3 -2
index 823b7d02..1bd0005c 100644
@@ -626,8 +626,9 @@ SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
 		< $< > $@
 
 if RUN_RST2MAN
-RST2MAN_PROCESS = $(AM_V_GEN)$(RST2MAN) --strict --no-raw --no-generator \
-			--no-datestamp < $< > $@
+RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+			$(AM_V_GEN)$(RST2MAN) --strict --no-raw \
+			--no-generator --no-datestamp $< $@
 else
 RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
 		{ echo "Generated manual page $@ does not exist"; false; }
Signature · 1 line
2.24.0
author
#1 lore raw

ping

Quoted 36 lines · Khem Raj

Ensure that directory is created before its written to

This can cause a build race in a highly parallelised build where a directory is not yet created but
output file is being written using redirection e.g.

rst2man.py --strict --no-raw --no-generator --no-datestamp < ../git/monitor/iwmon.rst > monitor/iwmon.1 /bin/sh: monitor/iwmon.1: No such file or directory make[1]: *** [Makefile:3544: monitor/iwmon.1] Error 1

---
v2: create directory before emitting doc files into it

 Makefile.am | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Makefile.am +3 -2
index 823b7d02..1bd0005c 100644
@@ -626,8 +626,9 @@ SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) &&
 $(SED) \
 		< $< > $@
 
 if RUN_RST2MAN
-RST2MAN_PROCESS = $(AM_V_GEN)$(RST2MAN) --strict --no-raw --no-
 generator \
-			--no-datestamp < $< > $@
+RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+			$(AM_V_GEN)$(RST2MAN) --strict --no-raw \
+			--no-generator --no-datestamp $< $@
 else

RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
{ echo "Generated manual page $@ does not exist";
false; }

author
#2 lore raw

gentle ping

Quoted 41 lines · Khem Raj

ping

Quoted 36 lines · Khem Raj

Ensure that directory is created before its written to

This can cause a build race in a highly parallelised build where a directory is not yet created but
output file is being written using redirection e.g.

rst2man.py --strict --no-raw --no-generator --no-datestamp < ../git/monitor/iwmon.rst > monitor/iwmon.1 /bin/sh: monitor/iwmon.1: No such file or directory make[1]: *** [Makefile:3544: monitor/iwmon.1] Error 1

---
v2: create directory before emitting doc files into it

 Makefile.am | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Makefile.am +3 -2
index 823b7d02..1bd0005c 100644
@@ -626,8 +626,9 @@ SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) &&
 $(SED) \
              < $< > $@
 
 if RUN_RST2MAN
-RST2MAN_PROCESS = $(AM_V_GEN)$(RST2MAN) --strict --no-raw --no-
 generator \
-                     --no-datestamp < $< > $@
+RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+                     $(AM_V_GEN)$(RST2MAN) --strict --no-raw \
+                     --no-generator --no-datestamp $< $@
 else
 RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
              { echo "Generated manual page $@ does not exist";

false; }

#3 lore raw
In reply to Khem Raj

Hi Khem,

Quoted 9 lines

Ensure that directory is created before its written to

This can cause a build race in a highly parallelised build where a directory is not yet created but output file is being written using redirection e.g.

rst2man.py --strict --no-raw --no-generator --no-datestamp < ../git/monitor/iwmon.rst > monitor/iwmon.1 /bin/sh: monitor/iwmon.1: No such file or directory
make[1]: *** [Makefile:3544: monitor/iwmon.1] Error 1

Quoted 5 lines

---
v2: create directory before emitting doc files into it

Makefile.am | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)

sorry for looking at this so late, can you send me a version that applies to the latest HEAD.

Regards

Marcel

author
#4 lore raw

Hi Marcel

Sent a v3

Quoted 24 lines · Marcel Holtmann

Hi Khem,

Quoted 9 lines

Ensure that directory is created before its written to

This can cause a build race in a highly parallelised build where a directory is not yet created but output file is being written using redirection e.g.

rst2man.py --strict --no-raw --no-generator --no-datestamp < ../git/monitor/iwmon.rst > monitor/iwmon.1 /bin/sh: monitor/iwmon.1: No such file or directory
make[1]: *** [Makefile:3544: monitor/iwmon.1] Error 1

Quoted 5 lines

---
v2: create directory before emitting doc files into it

Makefile.am | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)

sorry for looking at this so late, can you send me a version that applies to the latest HEAD.

Regards

Marcel