{"thread":{"id":"23559","subject":"[PATCH] Documentation/Makefile: fix interrupted builds of user-manual.xml","startedAt":"2010-04-22T01:18:21Z","lastAt":"2010-04-22T10:24:09Z","messageCount":3,"participants":["Jonathan Nieder","Chris Johnsen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"140088","messageId":"20100422011820.GA30355@progeny.tock","threadId":"23559","inReplyTo":null,"subject":"[PATCH] Documentation/Makefile: fix interrupted builds of user-manual.xml","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-04-22T01:18:21Z","receivedAt":"2010-04-22T01:18:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Unlike gcc, asciidoc does not atomically write its output file or\ndelete it when interrupted.  If it is interrupted in the middle of\nwriting an XML file, the result will be truncated input for xsltproc.\n\n\tXSLTPROC user-manual.html\n\tuser-manual.xml:998: parser error : Premature end of data in t\n\nTake care of this case by writing to a temporary and renaming it when\nfinished.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nBased on a true story.\n\n Documentation/Makefile |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 8a8a395..04f69cf 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -264,7 +264,9 @@ manpage-base-url.xsl: manpage-base-url.xsl.in\n \tmv $@+ $@\n \n user-manual.xml: user-manual.txt user-manual.conf\n-\t$(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book $<\n+\t$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \\\n+\t$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \\\n+\tmv $@+ $@\n \n technical/api-index.txt: technical/api-index-skel.txt \\\n \ttechnical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))\n@@ -278,7 +280,9 @@ XSLT = docbook.xsl\n XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css\n \n user-manual.html: user-manual.xml\n-\t$(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<\n+\t$(QUIET_XSLTPROC)$(RM) $@+ $@ && \\\n+\txsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \\\n+\tmv $@+ $@\n \n git.info: user-manual.texi\n \t$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi\n-- \n1.7.1.rc1\n"},{"id":"140102","messageId":"FA4A6177-AB3E-4C5C-8042-1BFBAE09528B@pobox.com","threadId":"23559","inReplyTo":"20100422011820.GA30355@progeny.tock","subject":"Re: [PATCH] Documentation/Makefile: fix interrupted builds of user-manual.xml","fromName":"Chris Johnsen","fromEmail":"chris_johnsen@pobox.com","sentAt":"2010-04-22T06:13:15Z","receivedAt":"2010-04-22T06:13:15Z","isPatch":true,"sender":{"key":"chris_johnsen@pobox.com","avatar":"https://avatars.githubusercontent.com/u/107071?v=4"},"body":"(Resend, including the all original recipients. Sorry for the dupe,  \nJonathan.)\n\nOn 2010 Apr 21, at 20:18, Jonathan Nieder wrote:\n> Unlike gcc, asciidoc does not atomically write its output file or\n> delete it when interrupted.  If it is interrupted in the middle of\n> writing an XML file, the result will be truncated input for xsltproc.\n>\n> \tXSLTPROC user-manual.html\n> \tuser-manual.xml:998: parser error : Premature end of data in t\n>\n> Take care of this case by writing to a temporary and renaming it when\n> finished.\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Based on a true story.\n>\n\nFor what it is worth, the changes seem reasonable to me. There may be  \na few other places that could use the same treatment, though maybe  \nnot all the other documentation tools suffer to the same degree as  \nasciidoc.\n\n\n> @@ -278,7 +280,9 @@ XSLT = docbook.xsl\n>  XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css\n>\n>  user-manual.html: user-manual.xml\n> -\t$(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<\n> +\t$(QUIET_XSLTPROC)$(RM) $@+ $@ && \\\n> +\txsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \\\n> +\tmv $@+ $@\n>\n>  git.info: user-manual.texi\n>  \t$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi\n>\n\nI suppose it is obvious enough what is going on in this in this  \nsecond hunk, but there is no mention of this change in the commit  \nmessage. Is this hunk due to a similar problem with xsltproc? Or  \nmaybe this is just \"defensive coding\"?\n\n-- \nChris\n"},{"id":"140115","messageId":"20100422102254.GA701@progeny.tock","threadId":"23559","inReplyTo":"FA4A6177-AB3E-4C5C-8042-1BFBAE09528B@pobox.com","subject":"Re: [PATCH] Documentation/Makefile: fix interrupted builds of user-manual.xml","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-04-22T10:24:09Z","receivedAt":"2010-04-22T10:24:09Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Chris Johnsen wrote:\n> On 2010 Apr 21, at 20:18, Jonathan Nieder wrote:\n\n>> user-manual.html: user-manual.xml\n>> -\t$(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<\n>> +\t$(QUIET_XSLTPROC)$(RM) $@+ $@ && \\\n>> +\txsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \\\n>> +\tmv $@+ $@\n>>\n[...]\n> I suppose it is obvious enough what is going on in this in this\n> second hunk, but there is no mention of this change in the commit\n> message. Is this hunk due to a similar problem with xsltproc? Or\n> maybe this is just \"defensive coding\"?\n\nxsltproc indeed has the same problem, as I learned while testing\nthe first hunk.  Thanks for asking.\n\nSorry for the incomplete explanation before.\nJonathan\n"}]}