Bug 162256

Summary: Use 'use lib $FindBin::Bin' to append Perl module include path
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, ap, cdumez, cgarcia, commit-queue, dbates, ddkilzer, lforschler, rniwa, sam, simon.fraser, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=162054
Attachments:
Description Flags
Patch
none
Patch none

Description Fujii Hironori 2016-09-19 23:10:34 PDT
We need to use '-I' switch to explicitly append Perl module include path to invoke some Perl scripts such like following:

> COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}

This can be solved by using 'use lib'. 

> use lib $FindBin::Bin

Documentation: http://perldoc.perl.org/lib.html

Some scripts already do this. For example, build-webkit do that.

  https://trac.webkit.org/browser/trunk/Tools/Scripts/build-webkit?rev=204444#L41

I'd like to change following script files:

  Source/WebCore/bindings/scripts/generate-bindings.pl
  Source/WebCore/bindings/scripts/preprocess-idls.pl
  Source/WebCore/css/makegrammar.pl
  Source/WebCore/css/makeprop.pl
  Source/WebCore/css/makevalues.pl
  Source/WebCore/dom/make_dom_exceptions.pl
  Source/WebCore/dom/make_event_factory.pl
  Source/WebCore/dom/make_names.pl
  Source/WebCore/page/make_settings.pl
Comment 1 Carlos Garcia Campos 2016-09-19 23:20:15 PDT
We need this because in some systems, like Debian, perl is configured to no longer include '.' in @INC by default for security reasons, see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-1238
Comment 2 Fujii Hironori 2016-09-20 00:04:37 PDT
(In reply to comment #1)
> We need this because in some systems, like Debian, perl is configured to no
> longer include '.' in @INC by default for security reasons, see
> https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-1238

I'm just to change how to append include paths in this bug.
There aren't differences in security perspective.

One should not execute WebKit's build scripts in an untrusted directory.
Comment 3 Fujii Hironori 2016-09-20 00:33:06 PDT
Created attachment 289333 [details]
Patch
Comment 4 Fujii Hironori 2016-09-22 21:16:02 PDT
Created attachment 289659 [details]
Patch
Comment 5 Fujii Hironori 2016-09-28 19:48:42 PDT
This is a simple patch. Is there any problem in this patch to review, Reviewers?
Comment 6 WebKit Commit Bot 2016-10-07 00:59:00 PDT
Comment on attachment 289659 [details]
Patch

Clearing flags on attachment: 289659

Committed r206904: <http://trac.webkit.org/changeset/206904>
Comment 7 WebKit Commit Bot 2016-10-07 00:59:06 PDT
All reviewed patches have been landed.  Closing bug.