This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Composer segfault on multiple configurations

On 18/05/2017 08:42, Sky Diver wrote:
I may compile php from cygports

Just in case Sky Diver or anyone else is interested in compiling php from Cygports, here are some simple steps to do so. It's not really difficult and most of the time it takes up is downloading the packages and compiling php. You'll probably want to do the compilation step during a lunch break or something.

If you just want to get a patched php running, just skip to the steps below.

But I'm also putting putting these instructions out here in case anyone wants to do some testing. The php devs asked for confirmation that (a) the bug exists and (b) this patch actually fixes it, before committing the patch.

The devs ask this as they have had problems setting up a dev environment for php. So they are unable recreate this bug or test the patch themselves. This is why I feel any Cygwin-specific patches for php should, for the moment be submitted to Cygwin rather than going to php.

To recreate the bug, create a 4096 bytes php file.
$ for i in $(seq 4096); do echo; done > test.php
Then execute it.
$ php test.php
This should immediately segfault. You can also test it through apache as there are two ways this bug can occur, through the php cli and through the apache php module. That is why the patch is against two different points in the source. By running apache in debug mode, you can see when the segfault occurs.
$ /usr/sbin/apachectl -X


1. Install the php source from cygwin
Install php from the Cygwin installer as normal, except check the Src checkbox as well as the Bin checkbox.

2. cd into the source directory
$ cd /usr/src/php-7.0.19-1.src

3. Copy the attachments over in that directory
- dependencies
- php-7.0.19-page-size.patch
- php-cygport-page-size.patch

5. Install the dependencies
There are 59 packages required to build php with cygport, listed in the attachment "dependencies". You'll probably use the command line for this rather than manually pick out the packages by hand in Cygwin's setup. You can either use setup's command line -P option or apt-cyg.
I used apt-cyg, so for me I run:
$ xargs apt-cyg install < dependencies
It will take a while to download all these packages.

4. Patch the cygport file
$ patch < php-cygport-page-size.patch

6. Prepare the source for compilation
$ cygport php.cygport prep

7. Compile php
$ cygport php.cygport compile
Depending on your cpu, this will take a significant amount of time.

8. Install your compiled php into a staging directory
$ cygport php.cygport install

9. Copy the files over from staging into root
$ rsync -varlI php-7.0.19-1.x86_64/inst/. /

10. Rebase the dlls in cygwin
$ rebase-trigger full
Exit all Cygwin processes, command line and services.
Run Cygwin's setup to actually perform the rebase.

If you rerun "php test.php" you now should get 4096 newlines instead of a segfault.

Should the patch miss php 7.0.20 or whatever the next version of php is for Cygwin, you can rerun the steps and just change the path names in steps 2 and 9. But hopefully the path will be merged in by then.

Attachment: php-7.0.19-page-size.patch
Description: Text document

Attachment: php-cygport-page-size.patch
Description: Text document

Attachment: dependencies
Description: Text document

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]