All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Makefile.am: Avoid redirection of input and output files
@ 2019-11-05  1:07 Khem Raj
  2019-11-05  6:11 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2019-11-05  1:07 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

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
---
 Makefile.am | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 823b7d02..21dd707c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -627,7 +627,7 @@ 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 < $< > $@
+			--no-datestamp
 else
 RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
 		{ echo "Generated manual page $@ does not exist"; false; }
@@ -637,13 +637,13 @@ endif
 	$(SED_PROCESS)
 
 %.1: %.rst Makefile
-	$(RST2MAN_PROCESS)
+	$(RST2MAN_PROCESS) $< $@
 
 %.5: %.rst Makefile
-	$(RST2MAN_PROCESS)
+	$(RST2MAN_PROCESS) $< $@
 
 %.8: %.rst Makefile
-	$(RST2MAN_PROCESS)
+	$(RST2MAN_PROCESS) $< $@
 
 install-data-local:
 if !SYSTEMD_SERVICE
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Makefile.am: Avoid redirection of input and output files
  2019-11-05  1:07 [PATCH] Makefile.am: Avoid redirection of input and output files Khem Raj
@ 2019-11-05  6:11 ` Marcel Holtmann
  2019-11-05 13:37   ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2019-11-05  6:11 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]

Hi Khem,

> 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
> ---
> Makefile.am | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 823b7d02..21dd707c 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -627,7 +627,7 @@ 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 < $< > $@
> +			--no-datestamp
> else
> RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
> 		{ echo "Generated manual page $@ does not exist"; false; }

so this is bad in case the else clause is used.

> @@ -637,13 +637,13 @@ endif
> 	$(SED_PROCESS)
> 
> %.1: %.rst Makefile
> -	$(RST2MAN_PROCESS)
> +	$(RST2MAN_PROCESS) $< $@
> 
> %.5: %.rst Makefile
> -	$(RST2MAN_PROCESS)
> +	$(RST2MAN_PROCESS) $< $@
> 
> %.8: %.rst Makefile
> -	$(RST2MAN_PROCESS)
> +	$(RST2MAN_PROCESS) $< $@

Is adding this to the RST2MAN_PROCESS variable not working?

Regards

Marcel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Makefile.am: Avoid redirection of input and output files
  2019-11-05  6:11 ` Marcel Holtmann
@ 2019-11-05 13:37   ` Khem Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2019-11-05 13:37 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]

On Mon, Nov 4, 2019 at 10:11 PM Marcel Holtmann <marcel@holtmann.org> wrote:

> Hi Khem,
>
> > 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
> > ---
> > Makefile.am | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/Makefile.am b/Makefile.am
> > index 823b7d02..21dd707c 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -627,7 +627,7 @@ 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 < $< > $@
> > +                     --no-datestamp
> > else
> > RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
> >               { echo "Generated manual page $@ does not exist"; false; }
>
> so this is bad in case the else clause is used.
>
> > @@ -637,13 +637,13 @@ endif
> >       $(SED_PROCESS)
> >
> > %.1: %.rst Makefile
> > -     $(RST2MAN_PROCESS)
> > +     $(RST2MAN_PROCESS) $< $@
> >
> > %.5: %.rst Makefile
> > -     $(RST2MAN_PROCESS)
> > +     $(RST2MAN_PROCESS) $< $@
> >
> > %.8: %.rst Makefile
> > -     $(RST2MAN_PROCESS)
> > +     $(RST2MAN_PROCESS) $< $@
>
> Is adding this to the RST2MAN_PROCESS variable not working?


I think that will work fine I just moved it here for
Convenience I can move it back I think real race is that directory is not
created before a file inside the directory is being redirected to. This
happens when doing out of tree build so the directory is not pre existing

>
>
> Regards
>
> Marcel
>
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2620 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-05 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05  1:07 [PATCH] Makefile.am: Avoid redirection of input and output files Khem Raj
2019-11-05  6:11 ` Marcel Holtmann
2019-11-05 13:37   ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.