Skip to content
This repository has been archived by the owner on Aug 10, 2019. It is now read-only.

php5.3 patch broken? #34

Closed
vulturm opened this issue May 15, 2013 · 9 comments
Closed

php5.3 patch broken? #34

vulturm opened this issue May 15, 2013 · 9 comments

Comments

@vulturm
Copy link

vulturm commented May 15, 2013

Hi,

I'm trying to compile from source php and I'm using some of your patches against official downloaded php source code

for example, hardening patch:

php-5.3.25]# patch -p1 -i ../a.patch
patching file Zend/Makefile.am
patching file Zend/zend.c
patching file Zend/zend.h
patching file Zend/zend_alloc.c
patching file Zend/zend_alloc.h
patching file Zend/zend_alloc_canary.c
patching file Zend/zend_canary.c
patching file Zend/zend_compile.c
patching file Zend/zend_compile.h
patching file Zend/zend_constants.c
patching file Zend/zend_errors.h
patching file Zend/zend_hash.c
patching file Zend/zend_llist.c
patching file Zend/zend_operators.c
patching file Zend/zend_variables.c
patching file configure
patching file configure.in
Hunk #2 succeeded at 1407 (offset 3 lines).
patching file ext/standard/dl.c
patching file ext/standard/info.c
patching file ext/standard/syslog.c
patching file main/fopen_wrappers.c
patching file main/main.c
patching file main/php.h
patching file main/php_config.h.in
patching file main/php_logos.c
patching file main/snprintf.c
patching file main/spprintf.c
patching file main/suhosin_globals.h
patching file main/suhosin_logo.h
patching file main/suhosin_patch.c
patching file main/suhosin_patch.h
patching file main/suhosin_patch.m4
patching file sapi/apache/mod_php5.c
patching file sapi/apache2filter/sapi_apache2.c
patching file sapi/apache2handler/sapi_apache2.c
patching file sapi/apache_hooks/mod_php5.c
patching file sapi/cgi/cgi_main.c
patching file sapi/cli/php_cli.c
patching file sapi/litespeed/lsapi_main.c
patching file sapi/milter/php_milter.c
patching file win32/build/config.w32
patching file win32/build/config.w32.h.in
patching file Zend/Zend.dsp
Hunk #1 FAILED at 247.
1 out of 1 hunk FAILED -- saving rejects to file Zend/Zend.dsp.rej
patching file Zend/ZendTS.dsp
Hunk #1 FAILED at 277.
1 out of 1 hunk FAILED -- saving rejects to file Zend/ZendTS.dsp.rej

When I'm trying to compile,
./configure && make
I get the following error:
php-5.3.25/ext/standard/info.c: In function 'php_print_info':
php-5.3.25/ext/standard/info.c:890: error: expected ')' before 'SUHOSIN_LOGO_GUID'
php-5.3.25/ext/standard/info.c:894: error: 'SUHOSIN_PATCH_VERSION' undeclared (first use in this function)
php-5.3.25/ext/standard/info.c:894: error: (Each undeclared identifier is reported only once
php-5.3.25/ext/standard/info.c:894: error: for each function it appears in.)

Am I doing something wrong when applying the patch ?

Thank you in advance,
Cheers.

@gplessis
Copy link
Owner

This is caused by mixed charsets in the patch. You can circumvent the problem by moving the to Zend.dsp/ZendTS.dsp chunks in a separate file.

@vulturm
Copy link
Author

vulturm commented May 15, 2013

Hello,

Thank for your prompt answer!

I've tried following cases:
A) moving the Zend.dsp/ZendTS.dsp chunks in a separate file, not patching the coresponding chunks then compile
B) patching the coresponding chunks then compile
php-5.3.25]# patch -p1 -i ../2.patch
patching file Zend/Zend.dsp
Hunk #1 FAILED at 247.
1 out of 1 hunk FAILED -- saving rejects to file Zend/Zend.dsp.rej
patching file Zend/ZendTS.dsp
Hunk #1 FAILED at 277.
1 out of 1 hunk FAILED -- saving rejects to file Zend/ZendTS.dsp.rej

C) modifying the files manually according to the patches, then compile.

In each cases -> same problem occurs.
Any other suggestions are appreciated.

Thanks.

@gplessis
Copy link
Owner

In fact, the problem occurs at each new release. Here is my method :

  1. I split the patch in two chunks (dsp & non-dsp)
  2. I apply the non-dsp patch
  3. I edit the two dsp files manually to apply the second patch
  4. I refresh the dsp patch
  5. I merge the two patches and apply them to vanilla source

Skipping the fifth step and keeping the patch in two parts should work for future releases.

@vulturm
Copy link
Author

vulturm commented May 15, 2013

  1. I splitted the patch in two chunks (dsp & non-dsp)
  2. I applied the non-dsp patch
  3. I've modified dsp files.
  4. I've created a patch from the entire source using diff -Naur php-5.3.25-orig/ php-5.3.25-Test > patch.test
    .............
    5.Then, I apply the newly created patch on a fresh downloaded source, everything goes fine,
    php-5.3.25]# patch -p1 -i ../patch.test
    ..
  5. after all that, - > compiling, then same error occurs.

any other suggestions ?

@gplessis
Copy link
Owner

Did you apply the 3 patches before suhosin as listed in debian/patches/series ?

@vulturm
Copy link
Author

vulturm commented May 15, 2013

Well, no.. but it shouldn't make any difference. Suhosin is the only patch I'm applying since php 5.3.11.

Last tested version which the patch worked is 5.3.21 (I haven't upgraded php since then).

@vulturm
Copy link
Author

vulturm commented Jun 11, 2013

Hello,
I'm encountering the same problem with php 5.3.26.

/php-5.3.26-mod/ext/standard/info.c: In function 'php_print_info':
/php-5.3.26-mod/ext/standard/info.c:890: error: expected ')' before 'SUHOSIN_LOGO_GUID'
/php-5.3.26-mod/ext/standard/info.c:894: error: 'SUHOSIN_PATCH_VERSION' undeclared (first use in this function)
/php-5.3.26-mod/ext/standard/info.c:894: error: (Each undeclared identifier is reported only once
/php-5.3.26-mod/ext/standard/info.c:894: error: for each function it appears in.)

I applied the patch and modified Zend/Zend.dsp and Zend/ZendTS.dsp manually.

Any suggestion/idea why the patch wouldn't work ?

Have you tested the patch and it compiled fine with the latest sourcecode ?

Thank you in advance,
Mike.

@Fedcomp
Copy link

Fedcomp commented Oct 1, 2015

fails at 5.3.9 as well.

@gplessis
Copy link
Owner

gplessis commented Oct 1, 2015

PHP 5.3 is not maintained anymore, I won't fix this issue. If you really want to use PHP 5.3 and build it by yourself, you could try to comment the suhosin-related line(s) in debian/patches/series and launch the packaging process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants