Bug 187240 - update-webkitgtk-flatpak fails if running with python2
Summary: update-webkitgtk-flatpak fails if running with python2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-01 21:11 PDT by Fujii Hironori
Modified: 2018-07-03 20:15 PDT (History)
5 users (show)

See Also:


Attachments
Request Error (1.20 KB, text/html)
2018-07-01 21:13 PDT, Fujii Hironori
no flags Details
Patch (1.90 KB, patch)
2018-07-03 03:15 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (12.80 MB, application/zip)
2018-07-03 07:21 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2018-07-01 21:11:03 PDT
update-webkitgtk-flatpak fails if running with python2

> $ ./Tools/Scripts/update-webkitgtk-flatpak
> Can't load file /tmp/tmpSabstY: Key file contains line “<HTML><HEAD>” which is not a key-value pair, group, or comment
> Traceback (most recent call last):
>   File "./Tools/Scripts/update-webkitgtk-flatpak", line 28, in <module>
>     WebkitFlatpak.load_from_args(["--gtk", "--update"] + sys.argv[1:]).run()
>   File "./Tools/flatpak/flatpakutils.py", line 693, in run
>     if not self.clean_args():
>   File "./Tools/flatpak/flatpakutils.py", line 586, in clean_args
>     repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo"))
>   File "./Tools/flatpak/flatpakutils.py", line 342, in add
>     comment="Adding repo %s" % repo.name)
>   File "./Tools/flatpak/flatpakutils.py", line 235, in flatpak
>     return subprocess.check_output(command).decode("utf-8")
>   File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
>     raise CalledProcessError(retcode, cmd, output=output)
> subprocess.CalledProcessError: Command '['flatpak', 'remote-add', '--user', 'flathub', '--from', '/tmp/tmpSabstY', '--if-not-exists']' returned non-zero exit status 1

Request Error happens to retrieve
"https://dl.flathub.org/repo/flathub.flatpakrepo".
I attached the content of /tmp/tmpSabstY.

Python3 can retrieve the content.
Comment 1 Fujii Hironori 2018-07-01 21:13:02 PDT
Created attachment 344071 [details]
Request Error
Comment 2 Fujii Hironori 2018-07-02 01:07:34 PDT
I tested with listening http://localhost:10003 .
urllib.urlretrieve sends an invalid request.

Python 2.7 urllib.urlretrieve

> GET http://localhost:10003 HTTP/1.0
> Host: localhost:10003
> User-Agent: Python-urllib/1.17
> Accept: */*

Python 3 urllib.request.urlretrieve

> GET / HTTP/1.1
> Accept-Encoding: identity
> Host: localhost:10003
> User-Agent: Python-urllib/3.6
> Connection: close

Python 2.7 urllib2.urlopen

> GET / HTTP/1.1
> Accept-Encoding: identity
> Host: localhost:10003
> Connection: close
> User-Agent: Python-urllib/2.7
Comment 3 Michael Catanzaro 2018-07-02 07:45:24 PDT
IMO we should change this script to always use python3 and move on. Scripts not used by Apple do not need to be compatible with python2.
Comment 4 Adrian Perez 2018-07-02 09:17:41 PDT
(In reply to Michael Catanzaro from comment #3)
> IMO we should change this script to always use python3 and move on. Scripts
> not used by Apple do not need to be compatible with python2.

I agree that this is a perfectly valid solution in this case.
Comment 5 Fujii Hironori 2018-07-03 02:35:58 PDT
Umm, run-webdriver-tests also emits the error message:

> $ ./Tools/Scripts/run-webdriver-tests
> Can't load file /tmp/tmpgWqSc3: Key file contains line “<HTML><HEAD>” which is not a key-value pair, group, or comment
> Traceback (most recent call last):
>   File "./Tools/Scripts/run-webdriver-tests", line 73, in <module>
>     flatpakutils.run_in_sandbox_if_available(sys.argv)
>   File "./Tools/flatpak/flatpakutils.py", line 818, in run_in_sandbox_if_available
>     if not flatpak_runner.clean_args():
>   File "./Tools/flatpak/flatpakutils.py", line 586, in clean_args
>     repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo"))
>   File "./Tools/flatpak/flatpakutils.py", line 342, in add
>     comment="Adding repo %s" % repo.name)
>   File "./Tools/flatpak/flatpakutils.py", line 235, in flatpak
>     return subprocess.check_output(command).decode("utf-8")
>   File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
>     raise CalledProcessError(retcode, cmd, output=output)
> subprocess.CalledProcessError: Command '['flatpak', 'remote-add', '--user', 'flathub', '--from', '/tmp/tmpgWqSc3', '--if-not-exists']' returned non-zero exit status 1
Comment 6 Fujii Hironori 2018-07-03 02:38:05 PDT
(In reply to Fujii Hironori from comment #5)
> Umm, run-webdriver-tests also emits the error message:

May bad. this is no problem. This script seems only for GTK and WPE ports.
Comment 7 Fujii Hironori 2018-07-03 02:40:16 PDT
Umm, run-webkit-tests also emits the error message:

> $ ./Tools/Scripts/run-webkit-tests
> Can't load file /tmp/tmpmf7yMP: Key file contains line “<HTML><HEAD>” which is not a key-value pair, group, or comment
> Traceback (most recent call last):
>   File "./Tools/Scripts/run-webkit-tests", line 39, in <module>
>     flatpakutils.run_in_sandbox_if_available(sys.argv)
>   File "./Tools/flatpak/flatpakutils.py", line 818, in run_in_sandbox_if_available
>     if not flatpak_runner.clean_args():
>   File "./Tools/flatpak/flatpakutils.py", line 586, in clean_args
>     repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo"))
>   File "./Tools/flatpak/flatpakutils.py", line 342, in add
>     comment="Adding repo %s" % repo.name)
>   File "./Tools/flatpak/flatpakutils.py", line 235, in flatpak
>     return subprocess.check_output(command).decode("utf-8")
>   File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
>     raise CalledProcessError(retcode, cmd, output=output)
> subprocess.CalledProcessError: Command '['flatpak', 'remote-add', '--user', 'flathub', '--from', '/tmp/tmpmf7yMP', '--if-not-exists']' returned non-zero exit status 1
Comment 8 Fujii Hironori 2018-07-03 03:15:11 PDT
Created attachment 344174 [details]
Patch
Comment 9 EWS Watchlist 2018-07-03 07:20:48 PDT
Comment on attachment 344174 [details]
Patch

Attachment 344174 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8423836

New failing tests:
http/tests/security/contentSecurityPolicy/video-with-https-url-allowed-by-csp-media-src-star.html
http/tests/security/canvas-remote-read-remote-video-redirect.html
http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html
Comment 10 EWS Watchlist 2018-07-03 07:21:00 PDT
Created attachment 344185 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 11 Fujii Hironori 2018-07-03 20:15:01 PDT
Comment on attachment 344174 [details]
Patch

Clearing flags on attachment: 344174

Committed r233494: <https://trac.webkit.org/changeset/233494>
Comment 12 Fujii Hironori 2018-07-03 20:15:04 PDT
All reviewed patches have been landed.  Closing bug.