Page MenuHomeFreeBSD

doc/share: tighten up error checking for .ps.eps and set .DELETE_ON_ERROR
ClosedPublic

Authored by mandree on Apr 24 2020, 7:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 7:31 AM
Unknown Object (File)
Dec 15 2023, 11:52 AM
Unknown Object (File)
Nov 23 2023, 5:59 AM
Unknown Object (File)
Nov 12 2023, 3:14 AM
Unknown Object (File)
Nov 10 2023, 7:05 PM
Unknown Object (File)
Nov 10 2023, 3:19 AM
Unknown Object (File)
Oct 9 2023, 6:03 PM
Unknown Object (File)
Oct 9 2023, 1:59 AM

Details

Summary

Greetings,

in the analysis of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234126, I found that the whole doc/ build will

  1. not properly detect if the .ps.eps suffix-transformation rule's commands fail with blank page!! and leave a useless .eps file behind
  2. also on the same conversion run, the eps to png rules will break on that .eps file, but emit pnmtopng: bad magic number 0x2d67 - not a PPM, PGM, PBM, or PAM file and leave a zero-sized .png file behind.

So running make ; make will succeed for book/handbook, but leave a 0-sized share/images/books/handbook/advanced-networking/net-routing.png file.

The attached patch, in an attempt to fail early and consistently,

  • adds extra checks to see that ${PS2EPS} in particular from the .ps.eps rule isn't emitting output on the "wrong channel" which I assume is an error message such as "blank page!" when the paper size is mismatched. The thing is that ps2epsi.ps script itself will complain, but gs runs it to completion, so the exit status doesn't give us a clue about the failure.
  • sets .DELETE_ON_ERROR for the easy cases (in share/mk/doc.images.mk and share/pgpkeys/Makefile) that make a lot of use of >${.TARGET} redirections that are prone to leaving broken files behind

Further discussion and failed attempts at fixing:

  • Chaining the commands with && doesn't help prevent the "false success" of a failed rule, I've tried that, we really need to watch for unexpected output.
  • I am aware that the latter sensitizes the .ps.eps rule to future ps2epsi.ps or the gs changes, in that the assumption "output outside the intended channel means error" could create a false negative, but that's then easier to spot

Diff Detail

Repository
rD FreeBSD doc repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Test result, for me on 12.1 amd with docproj and requisite ports from head/ built this week, with doc/r54072 and Dima's patch, all languages with blank environment pass a build from /usr/doc.

What is the purpose of pgpkeys/Makefile change?
I thought the .PHONY targets were enough to prevent broken useless files.

The remaining, I mean changes on doc.images.mk, seems correct to me.

@blackend .PHONY serves a different purpose. The pgpkeyring: keyring.xml rule can leave a garbage pgpkeyring behind if ${XSLTPROC} fails (f. i. out of disk space), and then on a later Makefile run, this corrupted pgpkeyring file will be picked up by the pgpkeyring.txt: .PHONY rule (where the 2nd command line (@${MAKE}...) would pick it up) and lead to a broken pgpkeyring.txt.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 29 2020, 8:31 AM
This revision was automatically updated to reflect the committed changes.