git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Documentation/Makefile: fix interrupted builds of user-manual.xml

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 22, 2010, 01:18 UTC
Message-ID
<20100422011820.GA30355@progeny.tock>

Unlike gcc, asciidoc does not atomically write its output file or delete it when interrupted. If it is interrupted in the middle of writing an XML file, the result will be truncated input for xsltproc.

	XSLTPROC user-manual.html
	user-manual.xml:998: parser error : Premature end of data in t

Take care of this case by writing to a temporary and renaming it when finished.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Based on a true story.
 Documentation/Makefile |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 8a8a395..04f69cf 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -264,7 +264,9 @@ manpage-base-url.xsl: manpage-base-url.xsl.in
 	mv $@+ $@
 
 user-manual.xml: user-manual.txt user-manual.conf
-	$(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book $<
+	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+	$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \
+	mv $@+ $@
 
 technical/api-index.txt: technical/api-index-skel.txt \
 	technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
@@ -278,7 +280,9 @@ XSLT = docbook.xsl
 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 
 user-manual.html: user-manual.xml
-	$(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
+	$(QUIET_XSLTPROC)$(RM) $@+ $@ && \
+	xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
+	mv $@+ $@
 
 git.info: user-manual.texi
 	$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
-- 
1.7.1.rc1
Next: Chris Johnsen
Message 1 of 3 in “Documentation/Makefile: fix interrupted builds of user-manual.xml”
  1. Documentation/Makefile: fix interrupted builds of user-manual.xmlJonathan Nieder, Apr 22, 2010
  2. Chris JohnsenApr 22, 2010
  3. Jonathan NiederApr 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.