Page MenuHomePhabricator

parallel-lint reports lint errors on line -1
Closed, DeclinedPublic

Description

it is not helpful to get line -1 as the cause.

https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wigo3/+/454530/1
https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-hhvm-docker/12127/console

12:22:33 PHP 5.6.99 | HHVM 3.18.6-dev | 10 parallel jobs
12:22:34 .....X...                                                    9/9 (100 %)
12:22:34 
12:22:34 
12:22:34 Checked 9 files in 1.7 seconds
12:22:34 Syntax error found in 1 file
12:22:34 
12:22:34 ------------------------------------------------------------
12:22:34 Parse error: ./checkbox.phpUnexpected T_FUNCTION in ./checkbox.php on line -1
12:22:34 Script parallel-lint . --exclude vendor --exclude node_modules handling the test event returned with error code 1
12:22:34 Traceback (most recent call last):
12:22:34   File "/usr/local/bin/quibble", line 9, in <module>
12:22:34     load_entry_point('quibble==0.0.0', 'console_scripts', 'quibble')()
12:22:34   File "/usr/local/lib/python3.4/dist-packages/quibble/cmd.py", line 487, in main
12:22:34     cmd.execute()
12:22:34   File "/usr/local/lib/python3.4/dist-packages/quibble/cmd.py", line 382, in execute
12:22:34     composer=run_composer, npm=run_npm)
12:22:34   File "/usr/local/lib/python3.4/dist-packages/quibble/test.py", line 77, in run_extskin
12:22:34     subprocess.check_call(cmd, cwd=directory, env=os.environ)
12:22:34   File "/usr/lib/python3.4/subprocess.py", line 561, in check_call
12:22:34     raise CalledProcessError(retcode, cmd)

Local run looks good:

------------------------------------------------------------
Parse error: .\checkbox.php:18
    16| }
    17|
  > 18| function checkboxesrender($input, $args, $parser)
    19| {
    20|   $voteid = $args['poll'];
Unexpected 'function' (T_FUNCTION) in .\checkbox.php on line 18

Event Timeline

That's bizarre. What PHP version are you using locally? I wonder if this is an HHVM issue.

I am not using hhvm. I am using php for windows

# php -v
PHP 7.2.7 (cli) (built: Jun 19 2018 23:43:47) ( ZTS MSVC15 (Visual C++ 2017) x86
 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Funnily on my local machine (without the Docker container), that seems to work fine under HHVM:

$ apt-cache policy hhvm
hhvm:
  Installed: 3.18.5+dfsg-1+wmf8+deb9u1
  Candidate: 3.24.7+dfsg-2+b2
  Version table:
     3.24.7+dfsg-2+b2 100
        100 http://ftp.fr.debian.org/debian testing/main amd64 Packages
 *** 3.18.5+dfsg-1+wmf8+deb9u1 100
        100 http://apt.wikimedia.org/wikimedia stretch-wikimedia/main amd64 Packages
        100 /var/lib/dpkg/status
$ composer test
> parallel-lint . --exclude vendor --exclude node_modules
PHP 5.6.99 | HHVM 3.18.6-dev | 10 parallel jobs
..X......                                                    9/9 (100 %)


Checked 9 files in 0.8 seconds
Syntax error found in 1 file

------------------------------------------------------------
Parse error: ./checkbox.php:18
    16| }
    17| 
  > 18| function checkboxesrender($input, $args, $parser)
    19| {
    20|   $voteid = $args['poll'];
Unexpected T_FUNCTION in ./checkbox.php on line 18

Decline for now since I have never been able to find a way to reproduce it.

There's an upstream bug report by @Krinkle: https://github.com/JakubOnderka/PHP-Parallel-Lint/issues/136.

I tried locally and I also cannot reproduce, but it keeps happening in CI. FTR, a recent example, from https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/531452/ PS3 is https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-hhvm-docker/66597/console:

> parallel-lint . --exclude node_modules --exclude vendor
PHP 5.6.99 | HHVM 3.18.6-dev | 10 parallel jobs
.............X....X......................................... 60/60 (100 %)


Checked 60 files in 1.5 seconds
Syntax error found in 2 files

------------------------------------------------------------
Parse error: ./includes/parser/AbuseFilterTokenizer.phpUnexpected T_DOUBLE_COLON, expecting ')' in ./includes/parser/AbuseFilterTokenizer.php on line -1
------------------------------------------------------------
Parse error: ./includes/parser/AbuseFilterCachingParser.phpUnexpected T_DOUBLE_COLON, expecting ')' in ./includes/parser/AbuseFilterCachingParser.php on line -1
Script parallel-lint . --exclude node_modules --exclude vendor handling the test event returned with error code 1
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.5/dist-packages/quibble/util.py", line 39, in task_wrapper
    ret = func(*func_args)
  File "/usr/local/lib/python3.5/dist-packages/quibble/commands.py", line 220, in run_extskin_composer
    subprocess.check_call(cmd, cwd=self.directory)
  File "/usr/lib/python3.5/subprocess.py", line 271, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['composer', '--ansi', 'test']' returned non-zero exit status 1
"""

Reopening since that still happening and we have a recent reproduction case.

git fetch "https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter" refs/changes/52/531452/3

I would guess hhvm reports the message slightly differently than Zend and thus parallel lint is not able to find the line number. :(

I am assuming that was an issue with HHVM versus Zend somehow. We no more have HHVM so this bug is no more relevant to us.