Bug 74373

Summary: Don't create empty file if gperf fails
Product: WebKit Reporter: Rafael Ávila de Espíndola <rafael.espindola>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: litherum, macpherson, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
fix the gperf invocation
none
fix the gperf invocation none

Description Rafael Ávila de Espíndola 2011-12-12 17:18:53 PST
Currently makeprop.pl, makevalues.pl and make-hash-tools.pl run gperf with:

system("gperf .... > $file") == || die ...

This creates an empty $file if gperf fails, which doesn't play very well with most build systems. This patch changes them to use

system("gperf .... --output-file=$file")
Comment 1 Rafael Ávila de Espíndola 2011-12-12 17:21:15 PST
Created attachment 118919 [details]
fix the gperf invocation
Comment 2 WebKit Review Bot 2011-12-12 17:26:12 PST
Attachment 118919 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Rafael Ávila de Espíndola 2011-12-12 18:01:44 PST
Created attachment 118927 [details]
fix the gperf invocation
Comment 4 WebKit Review Bot 2011-12-15 23:18:20 PST
Comment on attachment 118927 [details]
fix the gperf invocation

Clearing flags on attachment: 118927

Committed r103031: <http://trac.webkit.org/changeset/103031>
Comment 5 WebKit Review Bot 2011-12-15 23:18:24 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Myles C. Maxfield 2012-04-14 12:28:40 PDT
Some systems' version of gperf doesn't have the --output-file flag. Is it possible to detect if the file is empty and delete it instead?
Comment 7 Rafael Ávila de Espíndola 2012-04-15 05:07:48 PDT
(In reply to comment #6)
> Some systems' version of gperf doesn't have the --output-file flag. Is it possible to detect if the file is empty and delete it instead?

That would create a race condition, no? What I think can be done is

gperf > foo.tmp && mv foo.tmp foo
Comment 8 Myles C. Maxfield 2012-04-16 10:43:57 PDT
I'm not sure it matters that much. It's probably reasonable to just say that building WebKit depends on gperf version >= 3.x (instead of 2.7.x, which doesn't have this flag). Because gperf 3.0.1 was released 6 years ago, I think it's reasonable to require people to have the newer version.

To solve this problem, I just upgraded gperf on the machine I was building on.