Bug 107438 - [PATCH] workaround a gperf 3.1 bug
Summary: [PATCH] workaround a gperf 3.1 bug
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: fontconfig-bugs
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-31 22:30 UTC by Rafael Kitover
Modified: 2018-08-01 08:16 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
patch to workaround gperf bug (559 bytes, patch)
2018-07-31 22:30 UTC, Rafael Kitover
Details | Splinter Review
fcobjshash.gperf generated on my system (msys2 64bit) (1.75 KB, text/plain)
2018-08-01 05:07 UTC, Rafael Kitover
Details

Description Rafael Kitover 2018-07-31 22:30:56 UTC
Created attachment 140908 [details] [review]
patch to workaround gperf bug

gperf 3.1 has a bug described here that makes the fontconfig build fail:

https://stackoverflow.com/a/7900875/262458

attached is a patch for the makefile which strips blank lines from the .gperf file to workaround the bug.
Comment 1 Akira TAGOH 2018-08-01 04:33:02 UTC
What errors did you see from gperf 3.1?
Comment 2 Rafael Kitover 2018-08-01 04:39:26 UTC
The error is:

"Empty input keyword is not allowed. To recognize an empty input keyword, your code should check for len == 0 before calling the gperf generated lookup function."
Comment 3 Akira TAGOH 2018-08-01 04:50:53 UTC
I can reproduce that error with the sample code on stackoverflow but I can't with ours. can you attach your fcobjshash.gperf which is problematic and you can reproduce this issue?

I may rather suspect that different versions or different variants of sed/awk may introduces it.
Comment 4 Rafael Kitover 2018-08-01 05:07:40 UTC
Created attachment 140909 [details]
fcobjshash.gperf generated on my system (msys2 64bit)

Attached the fcobjshash.gperf file generated on my system which is msys2 64bit on windows 10.
Comment 5 Akira TAGOH 2018-08-01 06:10:09 UTC
$(GREP) '^[^#]' is supposed to drop the empty lines too but seems not on your system. what grep do you use?
Comment 6 Rafael Kitover 2018-08-01 06:20:05 UTC
I have:

sed (GNU sed) 4.4
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1, GNU MP 6.1.2)
grep (GNU grep) 3.1
Comment 7 Akira TAGOH 2018-08-01 06:34:11 UTC
Hmm, okay. weird though. does this work then?

diff --git a/src/Makefile.am b/src/Makefile.am
index 7a35575..7b414df 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -111,10 +111,10 @@ fcobjshash.gperf: Makefile stamp-fcobjshash.gperf
 stamp-fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
        $(AM_V_GEN) $(CPP) -I$(top_srcdir) $(CPPFLAGS) $< | \
        $(SED) 's/^ *//;s/ *, */,/' | \
-       $(GREP) '^[^#]' | \
        awk ' \
                /CUT_OUT_BEGIN/ { no_write=1; next; }; \
                /CUT_OUT_END/ { no_write=0; next; }; \
+               /^$$/||/^#/ { next; }; \
                { if (!no_write) print; next; }; \
        ' - > $@.tmp && \
        mv -f $@.tmp fcobjshash.gperf && touch $@ || ( $(RM) $@.tmp && false )
Comment 8 Rafael Kitover 2018-08-01 07:59:08 UTC
Yup that works perfectly!
Comment 9 Akira TAGOH 2018-08-01 08:16:42 UTC
Fixed in git. thanks


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.