GNOME Bugzilla – Bug 590694
rng/mallard Makefile calls awk instead of $(AWK)
Last modified: 2009-08-09 03:33:59 UTC
The Makefile.am for gnome-doc-utils/rng/mallard in git HEAD (f1a301ffcfd6a57d49dd8fafb8d710f07e4a51b1) uses awk to transcribe the RNC to RNG, but awk may not be GNU awk on all systems. The configure script picks the correct awk binary, and the Makefile should use the configured path rather than hardcoding the name 'awk'. This produces output like http://build.gnome.org/builders/gnome-doc-utils-opensol-gcc/builds/21/steps/gnome-doc-utils%20build/logs/stdio on platforms where awk is incompatible with GNU awk syntax.
Created attachment 139834 [details] [review] Patch to use $(AWK)
Thanks for pointing this out. I've changed it to use $(GDU_AWK) instead, which is something we already have set up to pass "-W compat" when awk == gawk. Please let me know if you still have problems after this change.
Well... Certainly, your commit does what is suggested on the tin: gawk gets called successfully now. What is odd is that the gawk packages for Solaris - both from Blastwave.org and that shipped by Sun (SUNWgawk) - complain of a syntax error in line 22: manduba: ~/checkout/gnome2/gnome-doc-utils/rng/mallard> gawk -W compat -f ./rnc2rng.awk mallard.rnc Mismatched parentheses on line 22 Happens on i386 and SPARC, and on various versions of OpenSolaris. No idea what is going on here. I can post the output of gawk --lint if you think that would help.
I don't think that's awk complaining about a syntax eror. That error message is coming from the awk script itself (line 47 or 267) and indicates one of two things: Either the .rnc file isn't valid, or the awk script is buggy. Are you building from master?
Sorry, I did realise that. This is building from master (rev 86483bfbde4d8e4c8d1665cdab2590934ffe120b). What is odd is that it is fine on Linux (GNU Awk 3.1.5) and FreeBSD (GNU Awk 3.1.6), but not OpenSolaris (GNU Awk 3.1.5). It is possible, though seems unlikely, that the script is buggy - gawk with --lint certainly complains a lot. If you would like access to one of these machines to see what is going on we can arrange that - ask zanchey or trs80 on irc.gnome.
The error is coming from line 267 in the awk script.
All right, I've fixed the lint errors, but I somehow doubt any of them were causing this problem.
Created attachment 140099 [details] gawk --lint runs from linux and solaris The lint errors are now fixed when the script is run on Debian Linux's gawk 3.1.5, but it still produces some errors when run under Solaris' gawk 3.1.5. I've attached the output from both runs.
All right, there's a run of the same sorts of (benign) substr warnings I fixed earlier, and I can fix those blindly. What concerns me are these lines: gawk: ./rnc2rng.awk:277: (FILENAME=mallard.rnc FNR=22) warning: reference to uninitialized element `paren["0"]' gawk: ./rnc2rng.awk:277: (FILENAME=mallard.rnc FNR=22) warning: reference to uninitialized element `stack[""]' gawk: ./rnc2rng.awk:277: (FILENAME=mallard.rnc FNR=22) warning: subscript of array `stack' is null string gawk: ./rnc2rng.awk:283: (FILENAME=mallard.rnc FNR=22) warning: reference to uninitialized variable `open' That definitely looks like it's related to the problem you mention. For some reason, the stack isn't unrolling correctly, and that's causing the mismatched parentheses error. I wonder if somehow mallard.rnc is different on the Solaris machine. Can you attach it here?
Created attachment 140147 [details] mallard.rnc from Solaris mallard.rnc output on Solaris. Note that this file is processed correctly by the Linux version of gawk, so I'm not sure how much it will help.
One alternative would be the rng2rnc tool at http://gnosis.cx/download/relax/ although that requires Python (probably not that big a deal?)
I need to keep the build dependencies down, so an external tool is kind of a no-go. If libxml2 had rnc support, that would make my life simpler. I'm not terribly excited about using a half-baked awk script for this. But it doesn't need to be a general-purpose tool. It just needs to get the mallard rng correct. OK, so the rnc file is processed fine on my Linux system as well. It is actually different than the one that gets built here. Things just seem to get processed in a different order. Disagreements over whether mal_block_list.page comes before or after mal_block_listing.page, stuff like that. But it doesn't cause any actual problems. I think I am going to need to do this myself on Solaris. I'll download the OpenSolaris ISO and install it in a VM.
It's this bug: http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=1236105 Stick the following on line 230 of rnc2rng.awk: if (line != substr(line, 1)) { print ":" line ":"; print ":" substr(line, 1) ":"; error = 1; exit 1; } substr(line, 1) should be a no-op. You can toy around with printing c. You'll see some pretty strange results. If you unset the LANG environment variable, things actually work correctly.
I've just committed a workaround to Makefile.am. I'm going to close this now since the real bug is elsewhere. I'm marking it FIXED instead of NOTGNOME because the original bug is that we should use $(AWK) (or in our case $(GDU_AWK)) which is absolutely true, and that was addressed. David, thanks for being so responsive on this bug. It helped a lot.
Verifying fixed - see http://build.gnome.org/builders/gnome-doc-utils-opensol-gcc/builds/34/steps/gnome-doc-utils%20build/logs/stdio (build.gnome.org builds were actually succeeding once the original issue was fixed, but I suspect that's because they run non-interactively without a LANG variable.) You're welcome, and thanks for fixing the issues so quickly!