[Webkit-unassigned] [Bug 181040] New: Replace hard-coded path in shebangs with #!/usr/bin/env

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 20 09:27:48 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=181040

            Bug ID: 181040
           Summary: Replace hard-coded path in shebangs with
                    #!/usr/bin/env
           Product: WebKit
           Version: WebKit Local Build
          Hardware: All
                OS: Other
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Platform
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: lantw44 at gmail.com

There are hundreds of files in WebKit source tree using hard-coded paths in shebangs, such as #!/bin/bash, #!/usr/bin/perl, #!/usr/bin/python. When they are executed on systems that don't install these programs in /bin or /usr/bin, they will cause 'no such file or directory' error which is annoying and sometimes not easy to find the cause.

For example, WebKit cannot be built on FreeBSD because of the hard-coded '#!/usr/bin/perl -w' in 'Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl':

[5/901] Generating ../../inspector-resources.stamp
FAILED: inspector-resources.stamp
cd /home/lantw44/gnome/build/webkitgtk-2.19.3/Source/WebKit && cp /home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/WebInspectorUI/UserInterface/Protocol/InspectorBackendCommands.js /home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/ForwardingHeaders/JavaScriptCore/Scripts && /usr/local/bin/cmake -E env DERIVED_SOURCES_DIR=/home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/WebInspectorUI SRCROOT=/home/lantw44/gnome/source/webkitgtk-2.19.3/Source/WebInspectorUI JAVASCRIPTCORE_PRIVATE_HEADERS_DIR=/home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/ForwardingHeaders/JavaScriptCore/Scripts TARGET_BUILD_DIR=/home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/webkit2gtk/InspectorResources UNLOCALIZED_RESOURCES_FOLDER_PATH=WebInspectorUI COMBINE_INSPECTOR_RESOURCES=YES COMBINE_TEST_RESOURCES=NO /home/lantw44/gnome/source/webkitgtk-2.19.3/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl && mkdir -p /home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/webkit2gtk/InspectorResources/WebInspectorUI/Localizations/en.lproj && cp /home/lantw44/gnome/source/webkitgtk-2.19.3/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js /home/lantw44/gnome/build/webkitgtk-2.19.3/DerivedSources/webkit2gtk/InspectorResources/WebInspectorUI/Localizations/en.lproj/localizedStrings.js && touch /home/lantw44/gnome/build/webkitgtk-2.19.3/inspector-resources.stamp
No such file or directory

'Tools/Scripts/update-webkit' also has this problem, so I have to run 'perl ./Tools/Scripts/update-webkit' instead of './Tools/Scripts/update-webkit' on FreeBSD. However, manually prepending the name of the interpreter to the command line doesn't always work because some scripts are executed by scripts.

I am going to upload a patch which replaces all hard-coded shebangs in 'Sources' and 'Tools' directories with '#!/usr/bin/env'. The replacement is done in the following ways:

1. '#!/usr/bin/python2.4' are simply removed because all files including them cannot be run as scripts.
2. '#!/usr/bin/python' are replaced by '#!/usr/bin/env python'.
3. '#!/usr/bin/ruby' are replaced by '#!/usr/bin/env ruby'.
4. '#!/usr/bin/perl' are replaced by '#!/usr/bin/env perl'.
5. '#!/usr/bin/perl -w' are replaced by '#!/usr/bin/env perl' and 'use warnings;'.
6. '#!/bin/bash' are replaced by '#!/usr/bin/env bash'.

I am not sure whether it is possible for this kind of big patch to be accepted ...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171220/2dd4d965/attachment.html>


More information about the webkit-unassigned mailing list