stuartherbert / phix

PHP Invoke: framework-agnostic command-line tool
http://phix-project.org
Other
38 stars 2 forks source link

Phix generates incorrect md5sum hashes when phing pear-package called #2

Open rbairwell opened 12 years ago

rbairwell commented 12 years ago

Summary

I'm seeing a problem where Phing generates incorrect md5 hashes for PEAR files when pear-package is ran. This prevents the PEAR module from "being valid" and blocks non-forced installs.

I'm seeing it on two machines (one Linux Mint [Ubuntu] 11 running PHP 5.3.6, and the other CentOS 5.7 running PHP 5.3.14): however, they are both running the same version of Phing and Phix.

Linux's md5 utility and PHP's md5_file both generate the same md5 hash.

What happens

When I run "phing pear-package" in the project directory of https://bitbucket.org/bairwell/geocoder/ (I must admit, I haven't tested it with any other project), the PEAR package is created with an incorrect MD5 checksums.

What I expect to happen

The md5 checksum are correctly generated

What I did

Download https://bitbucket.org/bairwell/geocoder/ into /var/projects/bairwell-geocoder :

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ phing -buildfile build.xml pear-package
Buildfile: /var/projects/bairwell-geocoder/build.xml
 [property] Loading /var/projects/bairwell-geocoder/build.properties
 [property] Loading /var/projects/bairwell-geocoder/dist/lastBuilt

 > pear-package:

     [echo] Building release directory
   [delete] Deleting directory /var/projects/bairwell-geocoder/.build
    [mkdir] Created dir: /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Created 1 empty directory in /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 12 files to /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Created 3 empty directories in /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 7 files to /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 7 files to /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 1 file to /var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 1 file to /var/projects/bairwell-geocoder/.build
     [echo] Creating /var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz PEAR package
   [delete] Deleting: /var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz
      [tar] Building tar: /var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz
     [echo] Your PEAR package is in /var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz

BUILD FINISHED

Total time: 1.6038 second

Diagnostics

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ md5sum .build/Bairwell_Geocoder-1.0.0/README.md 
221b4c12ab5e90a0ae4e62d43a1822d3  .build/Bairwell_Geocoder-1.0.0/README.md

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ grep README .build/package.xml 
              

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ php -r 'print md5_file(".build/Bairwell_Geocoder-1.0.0/README.md");'
221b4c12ab5e90a0ae4e62d43a1822d3

php -r 'print md5(file_get_contents(".build/Bairwell_Geocoder-1.0.0/README.md"));'
221b4c12ab5e90a0ae4e62d43a1822d3

This causes a warning to be issued when "forcing" the PEAR package to be installed and stops the package from being installed when it isn't forced:

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ sudo pear install -f dist/Bairwell_Geocoder-1.0.0.tgz 
warning : bad md5sum for file /usr/share/php/docs/Bairwell_Geocoder/README.md
install ok: channel://pear.bairwell.com/Bairwell_Geocoder-1.0.0

System Setup: Machine 1

rchiswell@richard-dv7-linux ~ $ uname -a
Linux richard-dv7-linux 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
rchiswell@richard-dv7-linux ~ $ phing -v
Phing 2.4.12
rchiswell@richard-dv7-linux ~ $ php -v
PHP 5.3.6-13ubuntu3.8 with Suhosin-Patch (cli) (built: Jun 13 2012 18:02:19) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
rchiswell@richard-dv7-linux ~ $ phix -v
0.15.0
rchiswell@richard-dv7-linux ~ $ md5sum --v
md5sum (GNU coreutils) 8.5
rchiswell@richard-dv7-linux ~ $ pear version
PEAR Version: 1.9.4
PHP Version: 5.3.6-13ubuntu3.8
Zend Engine Version: 2.3.0
Running on: Linux richard-dv7-linux 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64

System Setup: Machine 2

root@server1 [~]# uname -a
Linux server1.bairwell.com 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
root@server1 [~]# phing -v
Phing 2.4.12
root@server1 [~]# php -v
PHP 5.3.14 (cli) (built: Jul 13 2012 03:26:34) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
root@server1 [~]# phix -v
0.15.0
root@server1 [~]# md5sum --v
md5sum (GNU coreutils) 5.97
root@server1 [~]# pear help version
PEAR Version: 1.9.4
PHP Version: 5.3.14
Zend Engine Version: 2.3.0
Running on: Linux server1.bairwell.com 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64
stuartherbert commented 12 years ago

This was a fun one to track down.

Phix is packaging up the file README.md, but is using the checksum from src/docs/README.md. I need to figure out why it's copying in the wrong file, and then I'll get a fix released.

Best regards,

Stu

On Wed, Jul 18, 2012 at 11:15 AM, Richard Chiswell < reply@reply.github.com

wrote:

Summary

I'm seeing a problem where Phing generates incorrect md5 hashes for PEAR files when pear-package is ran. This prevents the PEAR module from "being valid" and blocks non-forced installs.

I'm seeing it on two machines (one Linux Mint [Ubuntu] 11 running PHP 5.3.6, and the other CentOS 5.7 running PHP 5.3.14): however, they are both running the same version of Phing and Phix.

Linux's md5 utility and PHP's md5_file both generate the same md5 hash.

What happens

When I run "phing pear-package" in the project directory of https://bitbucket.org/bairwell/geocoder/ (I must admit, I haven't tested it with any other project), the PEAR package is created with an incorrect MD5 checksums.

What I expect to happen

The md5 checksum are correctly generated

What I did

Download https://bitbucket.org/bairwell/geocoder/ into /var/projects/bairwell-geocoder :

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ phing
-buildfile build.xml pear-package
Buildfile: /var/projects/bairwell-geocoder/build.xml
 [property] Loading /var/projects/bairwell-geocoder/build.properties
 [property] Loading /var/projects/bairwell-geocoder/dist/lastBuilt

 > pear-package:

     [echo] Building release directory
   [delete] Deleting directory /var/projects/bairwell-geocoder/.build
    [mkdir] Created dir:
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Created 1 empty directory in
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 12 files to
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Created 3 empty directories in
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 7 files to
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 7 files to
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 1 file to
/var/projects/bairwell-geocoder/.build/Bairwell_Geocoder-1.0.0
     [copy] Copying 1 file to /var/projects/bairwell-geocoder/.build
     [echo] Creating
/var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz PEAR
package
   [delete] Deleting:
/var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz
      [tar] Building tar:
/var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz
     [echo] Your PEAR package is in
/var/projects/bairwell-geocoder/dist/Bairwell_Geocoder-1.0.0.tgz

BUILD FINISHED

Total time: 1.6038 second

Diagnostics

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ md5sum
.build/Bairwell_Geocoder-1.0.0/README.md
221b4c12ab5e90a0ae4e62d43a1822d3  .build/Bairwell_Geocoder-1.0.0/README.md

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ grep README
.build/package.xml
              

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ php -r
'print md5_file(".build/Bairwell_Geocoder-1.0.0/README.md");'
221b4c12ab5e90a0ae4e62d43a1822d3

php -r 'print
md5(file_get_contents(".build/Bairwell_Geocoder-1.0.0/README.md"));'
221b4c12ab5e90a0ae4e62d43a1822d3

This causes a warning to be issued when "forcing" the PEAR package to be installed and stops the package from being installed when it isn't forced:

rchiswell@richard-dv7-linux /var/projects/bairwell-geocoder $ sudo pear
install -f dist/Bairwell_Geocoder-1.0.0.tgz
warning : bad md5sum for file
/usr/share/php/docs/Bairwell_Geocoder/README.md
install ok: channel://pear.bairwell.com/Bairwell_Geocoder-1.0.0

System Setup: Machine 1

rchiswell@richard-dv7-linux ~ $ uname -a
Linux richard-dv7-linux 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25
UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
rchiswell@richard-dv7-linux ~ $ phing -v
Phing 2.4.12
rchiswell@richard-dv7-linux ~ $ php -v
PHP 5.3.6-13ubuntu3.8 with Suhosin-Patch (cli) (built: Jun 13 2012
18:02:19)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
rchiswell@richard-dv7-linux ~ $ phix -v
0.15.0
rchiswell@richard-dv7-linux ~ $ md5sum --v
md5sum (GNU coreutils) 8.5
rchiswell@richard-dv7-linux ~ $ pear version
PEAR Version: 1.9.4
PHP Version: 5.3.6-13ubuntu3.8
Zend Engine Version: 2.3.0
Running on: Linux richard-dv7-linux 3.0.0-12-generic #20-Ubuntu SMP Fri
Oct 7 14:56:25 UTC 2011 x86_64

System Setup: Machine 2

root@server1 [~]# uname -a
Linux server1.bairwell.com 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25
EST 2011 x86_64 x86_64 x86_64 GNU/Linux
root@server1 [~]# phing -v
Phing 2.4.12
root@server1 [~]# php -v
PHP 5.3.14 (cli) (built: Jul 13 2012 03:26:34)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
root@server1 [~]# phix -v
0.15.0
root@server1 [~]# md5sum --v
md5sum (GNU coreutils) 5.97
root@server1 [~]# pear help version
PEAR Version: 1.9.4
PHP Version: 5.3.14
Zend Engine Version: 2.3.0
Running on: Linux server1.bairwell.com 2.6.18-194.32.1.el5 #1 SMP Wed Jan
5 17:52:25 EST 2011 x86_64

Reply to this email directly or view it on GitHub: https://github.com/stuartherbert/phix/issues/2

Stuart Herbert

e: stuart@stuartherbert.com t: +44 7966 284577 w: http://www.stuartherbert.com/ b: http://blog.stuartherbert.com/