* [PATCH] fix race when building ada-lex.c
@ 2018-04-28 21:13 John Reiser
2018-04-29 15:58 ` Simon Marchi
2018-05-03 14:40 ` Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c) Ulrich Weigand
0 siblings, 2 replies; 7+ messages in thread
From: John Reiser @ 2018-04-28 21:13 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 384 bytes --]
PR build/22873
Prevent a race when building ada-lex.c, and any target of rules .c:.l or .c:.y.
The target should be written only at the last step, else SIGINT (^C)
can leave an inconsistent state. Being .PRECIOUS makes it even worse.
gdb/ChangeLog:
* gdb/Makefile.in: (.c:.l, .c:.y): Write the target only in the
last step, and do it atomically.
[patch attached]
[-- Attachment #2: 0001-Fix-race-when-building-ada-lex.c.patch --]
[-- Type: text/x-patch, Size: 2174 bytes --]
From 66e71c48037729d3239d2fd30dbb92f31281763b Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Sat, 28 Apr 2018 13:38:56 -0700
Subject: [PATCH] Fix race when building ada-lex.c
PR build/22873
Prevent a race when building ada-lex.c, and any target of rules .c:.l or .c:.y.
The target should be written only at the last step, else SIGINT (^C)
can leave an inconsistent state. Being .PRECIOUS makes it even worse.
gdb/ChangeLog:
* gdb/Makefile.in: (.c:.l, .c:.y): Write the target only in the
last step, and do it atomically.
---
gdb/Makefile.in | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 648f66d..be76928 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2483,9 +2483,8 @@ po/$(PACKAGE).pot: force
# Makefile.in, but that was a pretty big annoyance.
%.c: %.y
- rm -f $@ $@.tmp
- $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \
- || (rm -f $@; false)
+ $(SHELL) $(YLWRAP) $< y.tab.c $@.tmp -- $(YACC) $(YFLAGS) \
+ || (rm -f $@.tmp; false)
sed -e '/extern.*malloc/d' \
-e '/extern.*realloc/d' \
-e '/extern.*free/d' \
@@ -2496,13 +2495,13 @@ po/$(PACKAGE).pot: force
-e 's/\([ \t;,(]\)free$$/\1xfree/g' \
-e '/^#line.*y.tab.c/d' \
-e 's/YY_NULL/YY_NULLPTR/g' \
- < $@.tmp > $@
- rm -f $@.tmp
+ < $@.tmp > $@.new && \
+ rm -f $@.tmp && \
+ mv $@.new $@
%.c: %.l
if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
- $(FLEX) -o$@ $< && \
- rm -f $@.new && \
- sed -e '/extern.*malloc/d' \
+ $(FLEX) --stdout $< \
+ | sed -e '/extern.*malloc/d' \
-e '/extern.*realloc/d' \
-e '/extern.*free/d' \
-e '/include.*malloc.h/d' \
@@ -2511,8 +2510,7 @@ po/$(PACKAGE).pot: force
-e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
-e 's/\([ \t;,(]\)free$$/\1xfree/g' \
-e 's/yy_flex_xrealloc/yyxrealloc/g' \
- < $@ > $@.new && \
- rm -f $@ && \
+ > $@.new && \
mv $@.new $@; \
elif [ -f $@ ]; then \
echo "Warning: $*.c older than $*.l and flex not available."; \
--
2.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] fix race when building ada-lex.c
2018-04-28 21:13 [PATCH] fix race when building ada-lex.c John Reiser
@ 2018-04-29 15:58 ` Simon Marchi
2018-05-03 14:40 ` Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c) Ulrich Weigand
1 sibling, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2018-04-29 15:58 UTC (permalink / raw)
To: John Reiser; +Cc: gdb-patches
On 2018-04-28 17:13, John Reiser wrote:
> PR build/22873
> Prevent a race when building ada-lex.c, and any target of rules .c:.l
> or .c:.y.
> The target should be written only at the last step, else SIGINT (^C)
> can leave an inconsistent state. Being .PRECIOUS makes it even worse.
>
> gdb/ChangeLog:
> * gdb/Makefile.in: (.c:.l, .c:.y): Write the target only in the
> last step, and do it atomically.
>
> [patch attached]
Hi John,
Thanks for the patch, it makes sense. I pushed it.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c)
2018-04-28 21:13 [PATCH] fix race when building ada-lex.c John Reiser
2018-04-29 15:58 ` Simon Marchi
@ 2018-05-03 14:40 ` Ulrich Weigand
2018-05-03 14:48 ` Simon Marchi
1 sibling, 1 reply; 7+ messages in thread
From: Ulrich Weigand @ 2018-05-03 14:40 UTC (permalink / raw)
To: John Reiser; +Cc: gdb-patches
John Reiser wrote:
> gdb/ChangeLog:
> * gdb/Makefile.in: (.c:.l, .c:.y): Write the target only in the
> last step, and do it atomically.
> + $(FLEX) --stdout $< \
This causes a build failure on my RHEL 5 based Cell/B.E. dailybuild,
since flex 2.5.4 does not yet support the long option --stdout.
Is there any reason not to use the equivalent short option -t instead?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c)
2018-05-03 14:40 ` Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c) Ulrich Weigand
@ 2018-05-03 14:48 ` Simon Marchi
2018-05-03 15:08 ` Ulrich Weigand
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2018-05-03 14:48 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: jreiser, gdb-patches
On 2018-05-03 10:37, Ulrich Weigand wrote:
> John Reiser wrote:
>
>> gdb/ChangeLog:
>> * gdb/Makefile.in: (.c:.l, .c:.y): Write the target only in
>> the
>> last step, and do it atomically.
>
>> + $(FLEX) --stdout $< \
>
> This causes a build failure on my RHEL 5 based Cell/B.E. dailybuild,
> since flex 2.5.4 does not yet support the long option --stdout.
>
> Is there any reason not to use the equivalent short option -t instead?
>
> Bye,
> Ulrich
Huh, I also wondered whether --stdout was a widely available option. I
found it was added by this commit in flex:
https://github.com/westes/flex/commit/16fe6f3
and since it is 16-17 years old, I didn't raise a flag. But we can
certainly use -t. Can you confirm it works as intended on that system?
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c)
2018-05-03 14:48 ` Simon Marchi
@ 2018-05-03 15:08 ` Ulrich Weigand
2018-05-03 21:35 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Weigand @ 2018-05-03 15:08 UTC (permalink / raw)
To: Simon Marchi; +Cc: jreiser, gdb-patches
Simon Marchi wrote:
> Huh, I also wondered whether --stdout was a widely available option. I
> found it was added by this commit in flex:
>
> https://github.com/westes/flex/commit/16fe6f3
>
> and since it is 16-17 years old, I didn't raise a flag. But we can
> certainly use -t. Can you confirm it works as intended on that system?
Yes, -t works as intended.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c)
2018-05-03 15:08 ` Ulrich Weigand
@ 2018-05-03 21:35 ` Simon Marchi
2018-05-04 9:07 ` Ulrich Weigand
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2018-05-03 21:35 UTC (permalink / raw)
To: Ulrich Weigand, Simon Marchi; +Cc: jreiser, gdb-patches
On 2018-05-03 11:08 AM, Ulrich Weigand wrote:
> Simon Marchi wrote:
>
>> Huh, I also wondered whether --stdout was a widely available option. I
>> found it was added by this commit in flex:
>>
>> https://github.com/westes/flex/commit/16fe6f3
>>
>> and since it is 16-17 years old, I didn't raise a flag. But we can
>> certainly use -t. Can you confirm it works as intended on that system?
>
> Yes, -t works as intended.
Thanks, I pushed this change.
From 4ea17de8f1985273215b515d48fbd59b2ced3cd1 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Thu, 3 May 2018 17:29:14 -0400
Subject: [PATCH] Use flex's -t option instead of --stdout
As reported in
https://sourceware.org/ml/gdb-patches/2018-05/msg00042.html
some old versions of flex (2.5.4) don't support the --stdout switch.
Use -t, which is an alias.
gdb/ChangeLog:
* Makefile.in (%.c: %.l): Use -t instead of --stdout.
---
gdb/ChangeLog | 4 ++++
gdb/Makefile.in | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1825c2c..1a44240 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-05-03 Simon Marchi <simon.marchi@ericsson.com>
+
+ * Makefile.in (%.c: %.l): Use -t instead of --stdout.
+
2018-05-03 Pedro Alves <palves@redhat.com>
* s390-linux-nat.c
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index be76928..87d74a7 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2500,7 +2500,7 @@ po/$(PACKAGE).pot: force
mv $@.new $@
%.c: %.l
if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
- $(FLEX) --stdout $< \
+ $(FLEX) -t $< \
| sed -e '/extern.*malloc/d' \
-e '/extern.*realloc/d' \
-e '/extern.*free/d' \
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c)
2018-05-03 21:35 ` Simon Marchi
@ 2018-05-04 9:07 ` Ulrich Weigand
0 siblings, 0 replies; 7+ messages in thread
From: Ulrich Weigand @ 2018-05-04 9:07 UTC (permalink / raw)
To: Simon Marchi; +Cc: Simon Marchi, jreiser, gdb-patches
Simon Marchi wrote:
> On 2018-05-03 11:08 AM, Ulrich Weigand wrote:
> > Simon Marchi wrote:
> >
> >> Huh, I also wondered whether --stdout was a widely available option. I
> >> found it was added by this commit in flex:
> >>
> >> https://github.com/westes/flex/commit/16fe6f3
> >>
> >> and since it is 16-17 years old, I didn't raise a flag. But we can
> >> certainly use -t. Can you confirm it works as intended on that system?
> >
> > Yes, -t works as intended.
>
> Thanks, I pushed this change.
Thanks, Simon!
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-04 9:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-28 21:13 [PATCH] fix race when building ada-lex.c John Reiser
2018-04-29 15:58 ` Simon Marchi
2018-05-03 14:40 ` Build failure with flex 2.5.4 (Re: [PATCH] fix race when building ada-lex.c) Ulrich Weigand
2018-05-03 14:48 ` Simon Marchi
2018-05-03 15:08 ` Ulrich Weigand
2018-05-03 21:35 ` Simon Marchi
2018-05-04 9:07 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).