From: John Reiser <jreiser@bitwagon.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] fix race when building ada-lex.c
Date: Sat, 28 Apr 2018 21:13:00 -0000 [thread overview]
Message-ID: <6612c052-f77e-8650-bdbc-d985f1f10f85@bitwagon.com> (raw)
[-- 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
next reply other threads:[~2018-04-28 21:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-28 21:13 John Reiser [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6612c052-f77e-8650-bdbc-d985f1f10f85@bitwagon.com \
--to=jreiser@bitwagon.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox