After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 590694 - rng/mallard Makefile calls awk instead of $(AWK)
rng/mallard Makefile calls awk instead of $(AWK)
Status: VERIFIED FIXED
Product: gnome-doc-utils
Classification: Deprecated
Component: build utils
CVS HEAD
Other opensolaris
: Normal normal
: ---
Assigned To: gnome-doc-utils maintainers
gnome-doc-utils maintainers
Depends on:
Blocks:
 
 
Reported: 2009-08-04 02:40 UTC by David Adam
Modified: 2009-08-09 03:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to use $(AWK) (923 bytes, patch)
2009-08-04 02:44 UTC, David Adam
none Details | Review
gawk --lint runs from linux and solaris (5.72 KB, text/plain)
2009-08-07 10:37 UTC, David Adam
  Details
mallard.rnc from Solaris (11.38 KB, text/plain)
2009-08-07 18:58 UTC, David Adam
  Details

Description David Adam 2009-08-04 02:40:40 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.
Comment 1 David Adam 2009-08-04 02:44:57 UTC
Created attachment 139834 [details] [review]
Patch to use $(AWK)
Comment 2 Shaun McCance 2009-08-04 03:40:38 UTC
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.
Comment 3 David Adam 2009-08-06 11:11:51 UTC
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.
Comment 4 Shaun McCance 2009-08-06 14:14:40 UTC
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?
Comment 5 David Adam 2009-08-06 14:23:42 UTC
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.
Comment 6 David Adam 2009-08-06 14:26:44 UTC
The error is coming from line 267 in the awk script.
Comment 7 Shaun McCance 2009-08-06 16:11:37 UTC
All right, I've fixed the lint errors, but I somehow doubt any of them were causing this problem.
Comment 8 David Adam 2009-08-07 10:37:43 UTC
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.
Comment 9 Shaun McCance 2009-08-07 14:34:58 UTC
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?
Comment 10 David Adam 2009-08-07 18:58:13 UTC
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.
Comment 11 David Adam 2009-08-07 18:59:20 UTC
One alternative would be the rng2rnc tool at http://gnosis.cx/download/relax/ although that requires Python (probably not that big a deal?)
Comment 12 Shaun McCance 2009-08-07 19:18:07 UTC
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.
Comment 13 Shaun McCance 2009-08-07 23:07:13 UTC
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.
Comment 14 Shaun McCance 2009-08-08 16:09:08 UTC
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.
Comment 15 David Adam 2009-08-09 03:33:59 UTC
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!