Last modified: 2014-10-17 10:31:54 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70255, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68255 - [OPS] Jenkins: Package php5-parsekit missing in Trusty
[OPS] Jenkins: Package php5-parsekit missing in Trusty
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Deployment systems (Other open bugs)
wmf-deployment
All All
: Normal major (vote)
: ---
Assigned To: Filippo Giunchedi
:
Depends on:
Blocks: 68256
  Show dependency treegraph
 
Reported: 2014-07-19 02:12 UTC by Krinkle
Modified: 2014-10-17 10:31 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2014-07-19 02:12:46 UTC
Trying to provision a Trusty machine with puppet with the roles for integration slaves fails right due. Among the errors is:


> E: Unable to locate package php5-parsekit
Comment 1 Antoine "hashar" Musso (WMF) 2014-07-19 19:37:36 UTC
I am moving this to deployment component. php5-parsekit is an indirect dependency of scap which lints PHP files:

scap/tasks.py:    cmd = '/usr/bin/php -n -dextension=parsekit.so /usr/local/bin/lint.php'


Parsekit need to be imported from pecl and rebuild on Trusty. The last changelog entry for the Debian package being:


php-parsekit (1.3.0-1~precise1) precise-wikimedia; urgency=low

  * Build for precise.

 -- Faidon Liambotis <faidon@wikimedia.org>  Thu, 11 Oct 2012 13:21:05 +0000



Timo, simply fill a RT to ask parsekit to be rebuild on Trusty and the resulting package uploaded to apt.wikimedia.org :)
Comment 2 Bryan Davis 2014-07-19 19:44:10 UTC
We should really find a better way to lint than using a PECL package that hasn't had a release since 2009-10-17. The version we have installed on 12.04 hosts core dumps if you ask it to parse a PHP file that defines a trait.
Comment 4 Antoine "hashar" Musso (WMF) 2014-07-21 11:18:05 UTC
(In reply to Bryan Davis from comment #2)
> We should really find a better way to lint than using a PECL package that
> hasn't had a release since 2009-10-17. The version we have installed on
> 12.04 hosts core dumps if you ask it to parse a PHP file that defines a
> trait.

That is unfortunate :-(  The whole point of parsekit / lint.php is to avoid PHP startup   overhead when one attempts to invoke php -l on each php/inc file.  If PHP came with a recursive lint or a function to lint a file, that would let us drop parsekit entirely.
Comment 5 Andrew Bogott 2014-07-29 00:24:53 UTC
I duplicated the php5-parsekit version in our repo on Trusty.  There are a million other deps that won't fall so easily though.
Comment 6 Alexandros Kosiaris 2014-08-04 15:45:11 UTC
Having looked at this too I see that php5-parsekit may very well be non compilable on trusty. I just tried and got pages upon pages of errors. The first few are:

/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c: In function 'php_parsekit_parse_node':
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:81:66: error: 'union <anonymous>' has no member named 'var'
   add_assoc_long(return_value, "var", node->u.var);
                                                                  ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:82:92: error: 'union <anonymous>' has no member named 'var'
   add_assoc_stringl(return_value, "varname", op_array->vars[node->u.var].name, op_array->vars[node->u.var].name_len, 1);
                                                                                            ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:82:126: error: 'union <anonymous>' has no member named 'var'
   add_assoc_stringl(return_value, "varname", op_array->vars[node->u.var].name, op_array->vars[node->u.var].name_len, 1);
                                                                                                                              ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:88:77: error: 'union <anonymous>' has no member named 'var'
   snprintf(sop, (sizeof(void *) * 2) + 1, "%X", (unsigned int)node->u.var); 
                                                                             ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:92:67: error: 'union <anonymous>' has no member named 'var'
    add_assoc_long(return_value, "var", node->u.var / sizeof(temp_variable));
                                                                   ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:117:36: error: 'union <anonymous>' has no member named 'var'
      ((unsigned int)((char*)node->u.var - (char*)op_array->opcodes))/sizeof(zend_op));
                                    ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:126:75: error: 'union <anonymous>' has no member named 'EA'
    add_assoc_long(return_value, "EA.type", node->u.EA.type);
                                                                           ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c: In function 'php_parsekit_parse_op':
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:143:66: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  add_assoc_long(return_value, "address", (unsigned int)(&(op->opcode)));
                                                                  ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:152:3: warning: passing argument 3 of 'php_parsekit_parse_node' from incompatible pointer type [enabled by default]
   php_parsekit_parse_node(result, op_array, &(op->result), flags & PHP_PARSEKIT_RESULT_USED, options TSRMLS_CC);
   ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:66:13: note: expected 'struct znode *' but argument is of type 'union znode_op *'
 static void php_parsekit_parse_node(zval *return_value, zend_op_array *op_array, znode *node, long flags, long options TSRMLS_DC)
             ^
/tmp/buildd/php-parsekit-1.3.0/parsekit-1.3.0/parsekit.c:161:3: warning: passing argument 3 of 'php_parsekit_parse_node' from incompatible pointer type [enabled by default]
   php_parsekit_parse_node(op1, op_array, &(op->op1), flags & PHP_PARSEKIT_OP1_USED, options TSRMLS_CC);
   ^


Ideas ?
Comment 7 Filippo Giunchedi 2014-08-06 14:50:35 UTC
runkit as a replacement perhaps? looks like it hasn't been released but the git isn't old:
http://git.php.net/?p=pecl/php/runkit.git;a=summary

http://php.net/manual/en/function.runkit-lint.php
Comment 8 Filippo Giunchedi 2014-08-06 15:10:49 UTC
15:52  <^d> runkit is *scary times*
15:55  <^d> "The runkit extension provides means to modify constants, user-defined functions, and 
            user-defined classes. It also provides for custom superglobal variables and embeddable 
            sub-interpreters via sandboxing."
15:55  <^d> So much scary!
15:57  <^d> godog: I'd want some kind of check for it in either jenkins or scap to keep people from 
            adding it to their code.
16:06  <godog> ^d: mind if I quote you on the bug? if it is a jenkins check then I think we're fine with 
               (parallel?) php -l

so slightly off-topic for this bug but I think it is interesting discussion anyway, moving linting from scap and onto jenkins (i.e. no "real time" requirements) would make php -l feasible I think, thoughts?
Comment 9 Bryan Davis 2014-08-06 16:38:23 UTC
The nice thing about deploy time linting is that it works for live hacks (yeah they are not supposed to happen, but...), security patches (not put in gerrit until minutes before public disclosure) and things that were +2 verified bypassing Jenkins for whatever reason.
Comment 10 Antoine "hashar" Musso (WMF) 2014-08-06 19:48:58 UTC
We could go with runkit, just have to make sure it is not loaded by default (i.e. not in a PHP .ini file.  Then we could have our lint.php script to load it via -d.
Comment 11 Bryan Davis 2014-08-06 22:30:27 UTC
We could try out something like https://github.com/JakubOnderka/PHP-Parallel-Lint where N php procs are run in parallel to speed up the lint time. During a full scap run, we only lint the wmf-config and multiversion directories and trust that the php codebase has been linted already. sync-file doesn't lint at all and sync-dir lints the contents of the directory being synced. We could run some manual tests on tin to see if running some multiple php procs in parallel gives reasonable performance. The current parsekit lint is very fast, but adding even a few seconds to a large sync is not like to make a significant difference in operational wall-clock time.
Comment 12 Antoine "hashar" Musso (WMF) 2014-08-07 07:12:17 UTC
xargs can runs tasks in parallel.  I tried on tin with a warmed up disk cache against a wmf branch and 4 parallel process:

time (find /a/common/php-1.24wmf16 -name '*.php' -or -name '*.inc' -or -name '*.phtml' |xargs -n1 -P 4 -exec php -l)

real	0m57.913s
user	2m9.552s
sys	1m22.673s


Compared to:

time lint /a/common/php-1.24wmf16

real	0m5.389s
user	0m5.088s
sys	0m0.272s
Comment 13 Filippo Giunchedi 2014-08-08 16:03:26 UTC
though linting wmf-config and multiversion is significantly less files, yielding ~500ms, I think that's acceptable

filippo@mw1018:~$ time (find /usr/local/apache/common/wmf-config/ /usr/local/apache/common/multiversion/ -name '*.php' -or -name '*.inc' -or -name '*.phtml' |xargs -n1 -P 4 -exec php -l >/dev/null)

real	0m0.524s
user	0m1.116s
sys	0m0.716s
Comment 14 Filippo Giunchedi 2014-08-20 12:20:23 UTC
thoughts on going ahead with linting wmf-config and multiversion with parallel php as I suggested above?
Comment 15 Bryan Davis 2014-08-20 14:50:48 UTC
(In reply to Filippo Giunchedi from comment #14)
> thoughts on going ahead with linting wmf-config and multiversion with
> parallel php as I suggested above?

Let's make a patch to scap and try it. I think that it should work fine and hardly be noticeable. It definitely won't impact the wall clock time of a full scap as much as bringing codfw online will. :)
Comment 16 Gerrit Notification Bot 2014-09-16 16:27:10 UTC
Change 160668 had a related patch set uploaded by BryanDavis:
Check php syntax with parallel `php -l`

https://gerrit.wikimedia.org/r/160668
Comment 17 Gerrit Notification Bot 2014-09-16 16:34:37 UTC
Change 160668 merged by jenkins-bot:
Check php syntax with parallel `php -l`

https://gerrit.wikimedia.org/r/160668
Comment 18 Bryan Davis 2014-09-16 16:45:51 UTC
$ scap --verbose 'No code change scap to test scap internal update'
16:45:09 Started scap: No code change scap to test scap internal update
16:45:09 Running command: `find '/srv/mediawiki-staging/wmf-config' '/srv/mediawiki-staging/multiversion' -name '*.php' -or -name '*.inc' -or -name '*.phtml' | xargs -n1 -P6 -exec php -l >/dev/null`
16:45:09 Copying to tin.eqiad.wmnet from tin.eqiad.wmnet
16:45:09 Running rsync command: `sudo -u mwdeploy -n -- /usr/bin/rsync --archive --delete-delay --delay-updates --compress --delete --exclude=**/.svn/lock --exclude=**/.git/objects --exclude=**/.git/**/objects --exclude=**/cache/l10n/*.cdb --no-perms tin.eqiad.wmnet::common /srv/mediawiki`
....
Comment 19 Bryan Davis 2014-09-16 16:47:29 UTC
Maybe closed too soon? Have we removed the dependency on php5-parsekit from puppet?
Comment 20 Filippo Giunchedi 2014-09-16 17:04:18 UTC
proposed fix in puppet to remove lint

 https://gerrit.wikimedia.org/r/160691
Comment 21 Antoine "hashar" Musso (WMF) 2014-09-16 21:12:33 UTC
The Jenkins job that lint PHP files reused parsekit / phplint.php so I have to adjust the jobs to xargs | php -l as well.  Once done we can safely close this bug and forget about php_parsekit entirely.
Comment 22 Gerrit Notification Bot 2014-09-29 08:34:35 UTC
Change 161748 had a related patch set uploaded by Hashar:
contint: Package 'php5-parsekit' is absent on Trusty, don't require it

https://gerrit.wikimedia.org/r/161748
Comment 23 Antoine "hashar" Musso (WMF) 2014-09-29 19:54:28 UTC
The JJB macro phplint already uses "xargs -n1 -t php -l"

And on gallium:

 $ fgrep -i parsekit /var/lib/jenkins/jobs/*/config.xml
 $

 $ fgrep -Ri parsekit /srv/deployment/integration/slave-scripts
 $

So it is all good for contint.
Comment 24 Gerrit Notification Bot 2014-10-06 17:24:26 UTC
Change 160691 had a related patch set uploaded by Krinkle:
use scap's embedded linking, remove lint script

https://gerrit.wikimedia.org/r/160691
Comment 25 Gerrit Notification Bot 2014-10-07 06:57:32 UTC
Change 161748 abandoned by Krinkle:
contint: Package 'php5-parsekit' is absent on Trusty, don't require it

Reason:
Obsolete with I44d33af1ce85.

https://gerrit.wikimedia.org/r/161748
Comment 26 Gerrit Notification Bot 2014-10-07 08:56:09 UTC
Change 160691 merged by Filippo Giunchedi:
use scap's embedded linking, remove lint script

https://gerrit.wikimedia.org/r/160691
Comment 27 Antoine "hashar" Musso (WMF) 2014-10-17 10:31:54 UTC
We have removed dependencies upon php5-parsekit which was solely used for linting PHP files.

Instead both scap and the CI script uses something like:

 xargs -n1 | php -l



Thank you to everyone that have been involved!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links