Debian Bug report logs - #612743
php5: PHP is compiled with LFS support, but this can not be detected by extensions

version graph

Package: php5; Maintainer for php5 is (unknown);

Reported by: Derick Rethans <debian@derickrethans.nl>

Date: Thu, 10 Feb 2011 11:33:05 UTC

Severity: minor

Tags: lfs, moreinfo, wontfix

Merged with 402181

Found in version php5/5.2.0-7

Fixed in version 5.5.0~beta1-1

Done: Ondřej Surý <ondrej@sury.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, debian@derickrethans.nl, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Thu, 10 Feb 2011 11:33:08 GMT) (full text, mbox, link).


Acknowledgement sent to Derick Rethans <debian@derickrethans.nl>:
New Bug report received and forwarded. Copy sent to debian@derickrethans.nl, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Thu, 10 Feb 2011 11:33:08 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Derick Rethans <debian@derickrethans.nl>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Thu, 10 Feb 2011 12:29:32 +0100
Package: php5
Severity: normal
Tags: lfs

Hi!

I'm the author of several PHP extensions, and a user asked me to compile a
binary for him.

I've compiled the extension using a stock PHP install, and noticed that
though the extension loaded fine on Debian and Ubuntu, it did not actually
work. The exact same source code compiled on the Debian and Ubuntu systems
worked fine.

I've tracked this down to issues with reading files through PHP's
streams layer. What I strongly suspect here is that Debian's LFS patch changes
the size of the php_stream structure in a subtle way. However, from a compiled
binary I have no way of detecting whether the LFS patch was actually applied.
This makes it close to impossible to reject my extension from being loaded
and/or tell them to use a LFS-compiled version that I obviously can also 
provide. 

If you, as Debian PHP Maintainer, find it necessary to break PHP's default
ABI/API compatibility; could you at least reflect this in the API number so
that your pre-compiled PHP refuses to load an extension compiled with the
standard/a different ABI? You already add +lfs to the extension dir's default,
so it should be easy enough. For example, something like:

--- Zend/zend_build.h.orig	2011-02-10 11:26:12.000000000 +0000
+++ Zend/zend_build.h	2011-02-10 11:27:03.000000000 +0000
@@ -41,6 +41,10 @@
 #endif
 
 /* for private applications */
+#if _FILE_OFFSET_BITS = 64
+#define ZEND_BUILD_EXTRA ",LFS"
+#else
 #define ZEND_BUILD_EXTRA 
+#endif
 
 #endif

cheers,
Derick

-- System Information:
Debian Release: squeeze/sid
  APT prefers maverick-updates
  APT policy: (500, 'maverick-updates'), (500, 'maverick-security'), (500, 'maverick')
Architecture: i386 (i686)

Kernel: Linux 2.6.35-25-virtual (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash




Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Thu, 10 Feb 2011 12:21:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ondřej Surý <ondrej@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Thu, 10 Feb 2011 12:21:03 GMT) (full text, mbox, link).


Message #10 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Ondřej Surý <ondrej@debian.org>
To: Derick Rethans <debian@derickrethans.nl>, 612743@bugs.debian.org
Cc: control <control@bugs.debian.org>
Subject: Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Thu, 10 Feb 2011 13:17:56 +0100
forcemerge 402181 612743
thank you

Hi Derick,

there is no guarantee at all to keep same ABI between different
distributions. That doesn't only apply to LFS, but also to different
shared libraries used, etc.

The only safe way is to compile the extension using the development
files provided by the distribution.

Also the /usr/bin/php5-config script on Debian has an option --phpapi
which prints the version. Also you can provide .deb packages with
correct dependencies. It's just not reasonable to expect that
non-static binary will work across different systems.

O.

On Thu, Feb 10, 2011 at 12:29, Derick Rethans <debian@derickrethans.nl> wrote:
> Package: php5
> Severity: normal
> Tags: lfs
>
> Hi!
>
> I'm the author of several PHP extensions, and a user asked me to compile a
> binary for him.
>
> I've compiled the extension using a stock PHP install, and noticed that
> though the extension loaded fine on Debian and Ubuntu, it did not actually
> work. The exact same source code compiled on the Debian and Ubuntu systems
> worked fine.
>
> I've tracked this down to issues with reading files through PHP's
> streams layer. What I strongly suspect here is that Debian's LFS patch changes
> the size of the php_stream structure in a subtle way. However, from a compiled
> binary I have no way of detecting whether the LFS patch was actually applied.
> This makes it close to impossible to reject my extension from being loaded
> and/or tell them to use a LFS-compiled version that I obviously can also
> provide.
>
> If you, as Debian PHP Maintainer, find it necessary to break PHP's default
> ABI/API compatibility; could you at least reflect this in the API number so
> that your pre-compiled PHP refuses to load an extension compiled with the
> standard/a different ABI? You already add +lfs to the extension dir's default,
> so it should be easy enough. For example, something like:
>
> --- Zend/zend_build.h.orig      2011-02-10 11:26:12.000000000 +0000
> +++ Zend/zend_build.h   2011-02-10 11:27:03.000000000 +0000
> @@ -41,6 +41,10 @@
>  #endif
>
>  /* for private applications */
> +#if _FILE_OFFSET_BITS = 64
> +#define ZEND_BUILD_EXTRA ",LFS"
> +#else
>  #define ZEND_BUILD_EXTRA
> +#endif
>
>  #endif
>
> cheers,
> Derick
>
> -- System Information:
> Debian Release: squeeze/sid
>  APT prefers maverick-updates
>  APT policy: (500, 'maverick-updates'), (500, 'maverick-security'), (500, 'maverick')
> Architecture: i386 (i686)
>
> Kernel: Linux 2.6.35-25-virtual (SMP w/1 CPU core)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
>
>
>
> _______________________________________________
> pkg-php-maint mailing list
> pkg-php-maint@lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-php-maint
>



-- 
Ondřej Surý <ondrej@sury.org>
http://blog.rfc1925.org/




Forcibly Merged 402181 612743. Request was from Ondřej Surý <ondrej@debian.org> to control@bugs.debian.org. (Thu, 10 Feb 2011 12:21:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Thu, 10 Feb 2011 12:33:05 GMT) (full text, mbox, link).


Acknowledgement sent to Derick Rethans <debian@derickrethans.nl>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Thu, 10 Feb 2011 12:33:05 GMT) (full text, mbox, link).


Message #17 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Derick Rethans <debian@derickrethans.nl>
To: Ondřej Surý <ondrej@debian.org>
Cc: Derick Rethans <debian@derickrethans.nl>, 612743@bugs.debian.org, control <control@bugs.debian.org>
Subject: Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Thu, 10 Feb 2011 12:24:00 +0000 (GMT)
[Message part 1 (text/plain, inline)]
Hi,

On Thu, 10 Feb 2011, Ondřej Surý wrote:

> there is no guarantee at all to keep same ABI between different
> distributions. That doesn't only apply to LFS, but also to different
> shared libraries used, etc.
> 
> The only safe way is to compile the extension using the development
> files provided by the distribution.
> 
> Also the /usr/bin/php5-config script on Debian has an option --phpapi
> which prints the version. Also you can provide .deb packages with
> correct dependencies. It's just not reasonable to expect that
> non-static binary will work across different systems.

I know it doesn't; I was asking for making it detectable. Perhaps 
instead of LFS, you could use DEBIAN as "ZEND_BUILD_EXTRA" 
instead then? Or perhaps include flags with that, that show all the 
different Debian flags/options/or perhaps a debian specific version nr 
as well; such as DEBIAN1, DEBIAN2 etc...

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Thu, 10 Feb 2011 12:39:08 GMT) (full text, mbox, link).


Acknowledgement sent to Ondřej Surý <ondrej@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Thu, 10 Feb 2011 12:39:08 GMT) (full text, mbox, link).


Message #22 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Ondřej Surý <ondrej@debian.org>
To: Derick Rethans <debian@derickrethans.nl>
Cc: 612743@bugs.debian.org
Subject: Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Thu, 10 Feb 2011 13:37:31 +0100
> I know it doesn't; I was asking for making it detectable. Perhaps
> instead of LFS, you could use DEBIAN as "ZEND_BUILD_EXTRA"
> instead then? Or perhaps include flags with that, that show all the
> different Debian flags/options/or perhaps a debian specific version nr
> as well; such as DEBIAN1, DEBIAN2 etc...

Seems reasonable to me, but I am not sure if we don't break other
stuff by introducing this. But right now it's a right time to do it,
since the new development cycle has just started.

Ondrej
-- 
Ondřej Surý <ondrej@sury.org>
http://blog.rfc1925.org/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Fri, 18 Mar 2011 15:00:13 GMT) (full text, mbox, link).


Acknowledgement sent to Ondřej Surý <ondrej@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Fri, 18 Mar 2011 15:00:13 GMT) (full text, mbox, link).


Message #27 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Ondřej Surý <ondrej@debian.org>
To: Derick Rethans <debian@derickrethans.nl>
Cc: 612743@bugs.debian.org
Subject: Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Fri, 18 Mar 2011 15:58:53 +0100
Hi Derick,

I have tested your patch, but since this changes the ability to load
existing modules, there's a need to plan a transition and coordinate
it with the release team. It would probably also be good thing to
coordinate this either with other major distributions (so the LFS flag
is same everywhere) or move this logic directly to PHP upstream.

What do you (and other pkg-php maintainers) think? My guess would be
that best solution would be to move this to upstream, so it's
consistent even for local custom builds with _FILE_OFFSET_BITS == 64.

Regards,
Ondrej

On Thu, Feb 10, 2011 at 13:37, Ondřej Surý <ondrej@debian.org> wrote:
>> I know it doesn't; I was asking for making it detectable. Perhaps
>> instead of LFS, you could use DEBIAN as "ZEND_BUILD_EXTRA"
>> instead then? Or perhaps include flags with that, that show all the
>> different Debian flags/options/or perhaps a debian specific version nr
>> as well; such as DEBIAN1, DEBIAN2 etc...
>
> Seems reasonable to me, but I am not sure if we don't break other
> stuff by introducing this. But right now it's a right time to do it,
> since the new development cycle has just started.
>
> Ondrej
> --
> Ondřej Surý <ondrej@sury.org>
> http://blog.rfc1925.org/
>



-- 
Ondřej Surý <ondrej@sury.org>
http://blog.rfc1925.org/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Fri, 18 Mar 2011 16:21:03 GMT) (full text, mbox, link).


Acknowledgement sent to Derick Rethans <derick@derickrethans.nl>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Fri, 18 Mar 2011 16:21:03 GMT) (full text, mbox, link).


Message #32 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Derick Rethans <derick@derickrethans.nl>
To: Ondřej Surý <ondrej@debian.org>
Cc: PHP Developers Mailing List <internals@lists.php.net>, Derick Rethans <debian@derickrethans.nl>, 612743@bugs.debian.org
Subject: Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Fri, 18 Mar 2011 16:08:15 +0000 (GMT)
[Message part 1 (text/plain, inline)]
On Fri, 18 Mar 2011, Ondřej Surý wrote:

> On Thu, Feb 10, 2011 at 13:37, Ondřej Surý <ondrej@debian.org> wrote:
>
> > On Thu, Feb 10, 2011, Derick wrote:
> >
> >> I know it doesn't; I was asking for making it detectable. Perhaps
> >> instead of LFS, you could use DEBIAN as "ZEND_BUILD_EXTRA"
> >> instead then? Or perhaps include flags with that, that show all the
> >> different Debian flags/options/or perhaps a debian specific version nr
> >> as well; such as DEBIAN1, DEBIAN2 etc...
> >
> > Seems reasonable to me, but I am not sure if we don't break other
> > stuff by introducing this. But right now it's a right time to do it,
> > since the new development cycle has just started.
> 
> I have tested your patch, but since this changes the ability to load
> existing modules, there's a need to plan a transition and coordinate
> it with the release team. It would probably also be good thing to
> coordinate this either with other major distributions (so the LFS flag
> is same everywhere) or move this logic directly to PHP upstream.

Yes, that makes sense.

> What do you (and other pkg-php maintainers) think? My guess would be
> that best solution would be to move this to upstream, so it's
> consistent even for local custom builds with _FILE_OFFSET_BITS == 64.

I think this makes sense to me. Adding LFS to out ZEND_BUILDIN_EXTRA 
stuff alongside with the ZTS and DEBUG flags makes a lot of sense.
I am cc-ing php internals here. As a reference, this is the issue:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612743

regards,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Sat, 28 Jul 2012 20:03:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ferenc Kovacs <tyra3l@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Sat, 28 Jul 2012 20:03:03 GMT) (full text, mbox, link).


Message #37 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Ferenc Kovacs <tyra3l@gmail.com>
To: Derick Rethans <derick@derickrethans.nl>
Cc: Ondřej Surý <ondrej@debian.org>, PHP Developers Mailing List <internals@lists.php.net>, Derick Rethans <debian@derickrethans.nl>, 612743@bugs.debian.org
Subject: Re: [PHP-DEV] Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Sat, 28 Jul 2012 22:02:19 +0200
[Message part 1 (text/plain, inline)]
On Fri, Mar 18, 2011 at 5:08 PM, Derick Rethans <derick@derickrethans.nl>wrote:

> On Fri, 18 Mar 2011, Ondřej Surý wrote:
>
> > On Thu, Feb 10, 2011 at 13:37, Ondřej Surý <ondrej@debian.org> wrote:
> >
> > > On Thu, Feb 10, 2011, Derick wrote:
> > >
> > >> I know it doesn't; I was asking for making it detectable. Perhaps
> > >> instead of LFS, you could use DEBIAN as "ZEND_BUILD_EXTRA"
> > >> instead then? Or perhaps include flags with that, that show all the
> > >> different Debian flags/options/or perhaps a debian specific version nr
> > >> as well; such as DEBIAN1, DEBIAN2 etc...
> > >
> > > Seems reasonable to me, but I am not sure if we don't break other
> > > stuff by introducing this. But right now it's a right time to do it,
> > > since the new development cycle has just started.
> >
> > I have tested your patch, but since this changes the ability to load
> > existing modules, there's a need to plan a transition and coordinate
> > it with the release team. It would probably also be good thing to
> > coordinate this either with other major distributions (so the LFS flag
> > is same everywhere) or move this logic directly to PHP upstream.
>
> Yes, that makes sense.
>
> > What do you (and other pkg-php maintainers) think? My guess would be
> > that best solution would be to move this to upstream, so it's
> > consistent even for local custom builds with _FILE_OFFSET_BITS == 64.
>
> I think this makes sense to me. Adding LFS to out ZEND_BUILDIN_EXTRA
> stuff alongside with the ZTS and DEBUG flags makes a lot of sense.
> I am cc-ing php internals here. As a reference, this is the issue:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612743
>
> regards,
> Derick
>
> --
> http://derickrethans.nl | http://xdebug.org
> Like Xdebug? Consider a donation: http://xdebug.org/donate.php
> twitter: @derickr and @xdebug
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>

is this still something that we want to pursue?

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#612743; Package php5. (Mon, 06 Aug 2012 10:54:09 GMT) (full text, mbox, link).


Acknowledgement sent to Derick Rethans <derick@php.net>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Mon, 06 Aug 2012 10:54:09 GMT) (full text, mbox, link).


Message #42 received at 612743@bugs.debian.org (full text, mbox, reply):

From: Derick Rethans <derick@php.net>
To: Ferenc Kovacs <tyra3l@gmail.com>
Cc: Ondřej Surý <ondrej@debian.org>, PHP Developers Mailing List <internals@lists.php.net>, Derick Rethans <debian@derickrethans.nl>, 612743@bugs.debian.org
Subject: Re: [PHP-DEV] Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions
Date: Mon, 6 Aug 2012 11:43:33 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Sat, 28 Jul 2012, Ferenc Kovacs wrote:

> On Fri, Mar 18, 2011 at 5:08 PM, Derick Rethans <derick@derickrethans.nl>wrote:
> 
> > On Fri, 18 Mar 2011, Ondřej Surý wrote:
> >
> > > On Thu, Feb 10, 2011 at 13:37, Ondřej Surý <ondrej@debian.org> wrote:
> > >
> > > > On Thu, Feb 10, 2011, Derick wrote:
> > > >
> > > >> I know it doesn't; I was asking for making it detectable. Perhaps
> > > >> instead of LFS, you could use DEBIAN as "ZEND_BUILD_EXTRA"
> > > >> instead then? Or perhaps include flags with that, that show all the
> > > >> different Debian flags/options/or perhaps a debian specific version nr
> > > >> as well; such as DEBIAN1, DEBIAN2 etc...
> > > >
> > > > Seems reasonable to me, but I am not sure if we don't break other
> > > > stuff by introducing this. But right now it's a right time to do it,
> > > > since the new development cycle has just started.
> > >
> > > I have tested your patch, but since this changes the ability to load
> > > existing modules, there's a need to plan a transition and coordinate
> > > it with the release team. It would probably also be good thing to
> > > coordinate this either with other major distributions (so the LFS flag
> > > is same everywhere) or move this logic directly to PHP upstream.
> >
> > Yes, that makes sense.
> >
> > > What do you (and other pkg-php maintainers) think? My guess would be
> > > that best solution would be to move this to upstream, so it's
> > > consistent even for local custom builds with _FILE_OFFSET_BITS == 64.
> >
> > I think this makes sense to me. Adding LFS to out ZEND_BUILDIN_EXTRA
> > stuff alongside with the ZTS and DEBUG flags makes a lot of sense.
> > I am cc-ing php internals here. As a reference, this is the issue:
> > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612743
> 
> is this still something that we want to pursue?

Yes I think so!

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

Message #43 received at 402181-done@bugs.debian.org (full text, mbox, reply):

From: Ondřej Surý <ondrej@sury.org>
To: 402181-done@bugs.debian.org
Subject: Zend Optimizer+ now part of php 5.5
Date: Thu, 28 Mar 2013 18:17:50 +0100
[Message part 1 (text/plain, inline)]
Version: 5.5.0~beta1-1

Zend Optimizer+ is now a part of php 5.5beta1 available from experimental.

O.
-- 
Ondřej Surý <ondrej@sury.org>
[Message part 2 (text/html, inline)]

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 02 Aug 2013 07:30:52 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 00:43:34 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.