WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
181040
Replace hard-coded path in shebangs with #!/usr/bin/env
https://bugs.webkit.org/show_bug.cgi?id=181040
Summary
Replace hard-coded path in shebangs with #!/usr/bin/env
Ting-Wei Lan
Reported
2017-12-20 09:27:48 PST
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 ...
Attachments
Patch
(151.73 KB, patch)
2017-12-20 10:32 PST
,
Ting-Wei Lan
no flags
Details
Formatted Diff
Diff
Patch
(104.90 KB, patch)
2018-01-03 07:14 PST
,
Ting-Wei Lan
no flags
Details
Formatted Diff
Diff
Patch
(104.83 KB, patch)
2018-01-03 20:13 PST
,
Ting-Wei Lan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ting-Wei Lan
Comment 1
2017-12-20 10:32:51 PST
Created
attachment 329930
[details]
Patch
Alex Christensen
Comment 2
2018-01-02 11:33:23 PST
The changes you made to ANGLE or libwebrtc files should be put in the upstream projects. And those scripts are not actually used in the WebKit build.
Ting-Wei Lan
Comment 3
2018-01-03 07:08:52 PST
(In reply to Alex Christensen from
comment #2
)
> The changes you made to ANGLE or libwebrtc files should be put in the > upstream projects. And those scripts are not actually used in the WebKit > build.
Do you think it is better to remove changes made to third-party projects from the patch? Yes, scripts in third-party projects don't affect the build so they are not required.
Ting-Wei Lan
Comment 4
2018-01-03 07:14:55 PST
Created
attachment 330383
[details]
Patch
WebKit Commit Bot
Comment 5
2018-01-03 12:32:05 PST
Comment on
attachment 330383
[details]
Patch Rejecting
attachment 330383
[details]
from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 330383, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in Source/WebCore/PAL/ChangeLog is not at the top of the file. Full output:
http://webkit-queues.webkit.org/results/5917681
Ting-Wei Lan
Comment 6
2018-01-03 20:13:51 PST
Created
attachment 330437
[details]
Patch
WebKit Commit Bot
Comment 7
2018-01-03 23:18:23 PST
Comment on
attachment 330437
[details]
Patch Clearing flags on attachment: 330437 Committed
r226395
: <
https://trac.webkit.org/changeset/226395
>
WebKit Commit Bot
Comment 8
2018-01-03 23:18:25 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2018-01-03 23:19:22 PST
<
rdar://problem/36292050
>
Matt Lewis
Comment 10
2018-01-04 14:01:05 PST
This commit broke the webkit pearl tests on all platforms.
https://build.webkit.org/builders/Apple%20High%20Sierra%20Release%20WK2%20(Tests)/builds/2037
https://build.webkit.org/builders/Apple%20High%20Sierra%20Release%20WK2%20(Tests)/builds/2037/steps/webkitperl-test/logs/stdio
Jonathan Bedard
Comment 11
2018-01-04 14:46:01 PST
There were some hard-coded line number in test-webkitperl test expectations. Fixing in <
https://bugs.webkit.org/show_bug.cgi?id=181307
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug