Bug 191471 - [patch] www/mod_perl2 does not build against apache24
Summary: [patch] www/mod_perl2 does not build against apache24
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Some People
Assignee: freebsd-apache mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-29 00:34 UTC by kovert
Modified: 2014-09-21 15:47 UTC (History)
6 users (show)

See Also:


Attachments
patch (1.10 KB, patch)
2014-06-29 00:41 UTC, kovert
no flags Details | Diff
for the files directory, required function for pre-hook (459 bytes, text/plain)
2014-06-29 23:52 UTC, kovert
no flags Details
output of a make test against perl 5.18 (16.40 KB, text/plain)
2014-06-29 23:53 UTC, kovert
no flags Details
output of a make test against perl 5.20 (16.37 KB, text/plain)
2014-06-29 23:54 UTC, kovert
no flags Details
patch current upstream mod_perl r1602105 (7.31 KB, patch)
2014-08-03 15:10 UTC, Olli Hauer
no flags Details | Diff
patch current upstream mod_perl r1602105 v02 (7.84 KB, patch)
2014-08-06 21:28 UTC, Olli Hauer
no flags Details | Diff
mod_perl2-2.0.8-r1618150_apache24.diff (7.99 KB, patch)
2014-08-17 15:50 UTC, Olli Hauer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kovert 2014-06-29 00:34:29 UTC
The port acknowledges this, but www/mod_perl2 does not build against
	apache 2.4  Sadly, the maintainers have not released a new version
	that supports it, but there are numerous patches out there.   I've
	made one work.

How-To-Repeat:
install www/apache24
	try to build www/mod_perl2

Fix:
minor tweaks to the Makefile, see attached

	thanks,
	-Todd
Comment 1 kovert 2014-06-29 00:41:10 UTC
Created attachment 144236 [details]
patch
Comment 2 Olli Hauer freebsd_committer 2014-06-29 17:23:44 UTC
Can you post the summary output from `make test' together with your OS and perl (version and OPTIONS)?
Comment 3 kovert 2014-06-29 23:51:24 UTC
The version of the patch I included before failed with make test starting up httpd with an assert because of a function call that was missing from the pre-hook. I've included a second patch that can be dropped in files/ and should build <=2.4 (I did not test on anything other than 2.4).    Interestingly, I surveyed a few other OS's that had patched this and they also did not pass the perl test.  It looks like the function call in the pre-hook was added for mod_perl specifically (see http://comments.gmane.org/gmane.comp.apache.devel/44263 ).

Once that was fixed, httpd still did not start in a make test and it fails because the test regiment's httpd.conf is not compatible with apache 2.4.  I did not spend enough time with the test regiment to figure out how to fix this, particularly in a way that is friendly to all versions of apache, but I did test it against mod_perl code I already had and the port does work.  If you'll accept the patches, you may want to consider putting them inside a define to indicate that they are experimental or some such because make test does not pass although I suspect this is overkill.

I've attached (or am about to) the make test output against perl 5.18 and perl 5.20.  The system information is below.  I don't have the obj files for the 5.18 instance anymore.

thanks,
-Todd

#############################################################################

perl 5.20:
[saidin#5 ~] uname -a
FreeBSD saidin.omniscient.com 10.0-STABLE FreeBSD 10.0-STABLE #3 r264686: Sun Apr 20 02:01:59 EDT 2014     kovert@saidin.omniscient.com:/usr/obj/usr/src/sys/GENERIC  amd64
[saidin#6 ~] more /var/db/ports/lang_perl5.20/options
# This file is auto-generated by 'make config'.
# Options for perl5-5.20.0_3
_OPTIONS_READ=perl5-5.20.0_3
_FILE_COMPLETE_OPTIONS_LIST=DEBUG GDBM MULTIPLICITY PERL_64BITINT PTHREAD SITECUSTOMIZE THREADS PERL_MALLOC
OPTIONS_FILE_UNSET+=DEBUG
OPTIONS_FILE_UNSET+=GDBM
OPTIONS_FILE_SET+=MULTIPLICITY
OPTIONS_FILE_SET+=PERL_64BITINT
OPTIONS_FILE_SET+=PTHREAD
OPTIONS_FILE_UNSET+=SITECUSTOMIZE
OPTIONS_FILE_SET+=THREADS
OPTIONS_FILE_UNSET+=PERL_MALLOC
[saidin#7 ~] pkg info perl5
perl5-5.20.0_3
Name           : perl5
Version        : 5.20.0_3
Installed on   : Tue Jun 10 10:26:10 EDT 2014
Origin         : lang/perl5.20
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : perl5 lang devel
Licenses       : GPLv1 or ART10
Maintainer     : perl@FreeBSD.org
WWW            : http://www.perl.org/
Comment        : Practical Extraction and Report Language
Options        :
	DEBUG          : off
	GDBM           : off
	MULTIPLICITY   : on
	PERL_64BITINT  : on
	PERL_MALLOC    : off
	PTHREAD        : on
	SITECUSTOMIZE  : off
	THREADS        : on
Shared Libs required:
	libperl.so
Annotations    :
	cpe            : cpe:/a:perl:perl:5.20.0::~~~freebsd~~
Flat size      : 47.8MiB
Description    :
Perl is a language that combines some of the features of C, sed, awk and
shell.  See the manual page for more hype.  There are also many books
published by O'Reilly & Assoc.  See pod/perlbook.pod for more
information.

WWW: http://www.perl.org/

#############################################################################

[malbec#66 ~] uname -a
FreeBSD malbec.omniscient.com 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260799: Fri Jan 17 05:59:32 UTC 2014     root@zinfandel.omniscient.com:/usr/obj/usr/src/sys/GENERIC  amd64
[malbec#67 ~] perl info perl5
Can't open perl script "info": No such file or directory
[malbec#68 ~] uname -a
FreeBSD malbec.omniscient.com 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260799: Fri Jan 17 05:59:32 UTC 2014     root@zinfandel.omniscient.com:/usr/obj/usr/src/sys/GENERIC  amd64
[malbec#69 ~] pkg info perl5
perl5-5.18.2_2
Name           : perl5
Version        : 5.18.2_2
Installed on   : Tue May 13 01:19:08 UTC 2014
Origin         : lang/perl5.18
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : perl5 lang devel
Licenses       : GPLv1 or ART10
Maintainer     : perl@FreeBSD.org
WWW            : http://www.perl.org/
Comment        : Practical Extraction and Report Language
Options        :
	DEBUG          : off
	GDBM           : off
	MULTIPLICITY   : off
	PERL_64BITINT  : on
	PERL_MALLOC    : off
	PTHREAD        : on
	SITECUSTOMIZE  : off
	THREADS        : on
	USE_PERL       : on
Shared Libs required:
	libperl.so
Flat size      : 48.2MiB
Description    :
Perl is a language that combines some of the features of C, sed, awk and
shell.  See the manual page for more hype.  There are also many books
published by O'Reilly & Assoc.  See pod/perlbook.pod for more
information.

WWW: http://www.perl.org/
Comment 4 kovert 2014-06-29 23:52:56 UTC
Created attachment 144279 [details]
for the files directory, required function for pre-hook
Comment 5 kovert 2014-06-29 23:53:36 UTC
Created attachment 144280 [details]
output of a make test against perl 5.18
Comment 6 kovert 2014-06-29 23:54:08 UTC
Created attachment 144281 [details]
output of a make test against perl 5.20
Comment 7 John Marino freebsd_committer 2014-07-22 15:07:07 UTC
Olli, are you going to update mod_perl2 to work with apache24?
Comment 8 Rene Ladan freebsd_committer 2014-07-28 18:34:42 UTC
+1 ;)

If you use poudriere with an empty repository and default settings it manages to prefer apache 2.4 over apache 2.2 (probably because 'make run-depends-list' says so) which leads to mod_perl2 being ignored.

So it looks like USE_APACHE=22 is somehow broken.
Comment 9 Rene Ladan freebsd_committer 2014-07-28 18:48:09 UTC
Ok, USE_APACHE=22 works when you set APACHE_PORT=www/apache22 in /etc/make.conf
Comment 10 John Marino freebsd_committer 2014-07-28 19:06:09 UTC
(In reply to Rene Ladan from comment #9)
> Ok, USE_APACHE=22 works when you set APACHE_PORT=www/apache22 in
> /etc/make.conf

Sure, but as you said Apache 2.4 is the default, and the broken mod_perl2 port (with respect to Apache 2.4) knocks out something like 32 ports.  At a minimum these:

devel/pushmi
mail/p5-qpsmtpd
net-mgmt/netdisco
net-mgmt/netdot
net-mgmt/ocsinventory-ng
net/p5-Apache2-SOAP
www/foswiki-ModPerlEngineContrib
www/otrs
www/p5-Apache-AuthCookie
www/p5-Apache-AuthTicket
www/p5-Apache-Clean2
www/p5-Apache-DB
www/p5-Apache-DBI
www/p5-Apache-Gallery
www/p5-Apache-MP3
www/p5-Apache-ParseFormData
www/p5-Apache-Profiler
www/p5-Apache2-SiteControl
www/p5-CGI-Application-Plugin-Apache
www/p5-MasonX-WebApp
www/p5-Maypole
www/p5-RT-Authen-ExternalAuth
www/p5-RT-Extension-LDAPImport
www/p5-RT-Extension-MandatoryOnTransition
www/p5-RT-Extension-SLA
www/p5-RTx-Calendar
www/p5-Text-MultiMarkdown-ApacheHandler
www/rt38
www/rt40
www/rt42

mod_perl2 for Apache 2.4 really needs to be fixed ASAP.
Comment 11 Olli Hauer freebsd_committer 2014-07-28 20:14:44 UTC
Comparing 2.0.8 with http://svn.apache.org/repos/asf/perl/modperl/trunk the changes are to much for a simple patch.

I'm concerned most of the applications in the list will not work as expected with the (simple) patch.

Anyway If the patch goes in it should really warn users that it is totally unsupported and only experimental.
Comment 12 Michelle Sullivan 2014-07-28 22:08:32 UTC
Adding my $0.02 - as this breaks a lot of things and that setting USE_APACHE=22 doesn't work (DEFAULT_VERSIONS+=apache=2.2 does work though) I personally think 2.4 should not be the default....  I am a heavy RT user... I am also a Bugzilla user and all versions of Bugzilla will fail if you use mod_perl2 instead of FASTCGI (so there's another 3 ports dependent.)

The full list (according to freshports "for run" (only) default options):


devel/otrs*
mail/p5-qpsmtpd
net/p5-Apache2-SOAP
net-mgmt/netdisco
www/blogsum
www/foswiki-ModPerlEngineContrib
www/otrs
www/p5-Apache-AuthCookie
- net-mgmt/netdot
- www/p5-Apache2-SiteControl
www/p5-Apache-AuthTicket
www/p5-Apache-Clean2
www/p5-Apache-DB
www/p5-Apache-DBI
- devel/otrs*
- net-mgmt/netdisco
- net-mgmt/ocsinventory-ng
- www/otrs
- www/rt38
- www/rt40
- www/rt42
-- www/p5-RT-Authen-ExternalAuth
-- www/p5-RT-Extension-LDAPImport
-- www/p5-RT-Extension-MandatoryOnTransition
-- www/p5-RT-Extension-SLA
-- www/p5-RTx-Calendar
www/p5-Apache-GopherHandler*
www/p5-Apache-MP3
www/p5-Apache-ParseFormData
www/p5-Apache-Profiler
www/p5-Apache2-Scoreboard*
www/p5-MasonX-WebApp
www/p5-Text-MultiMarkdown-ApacheHandler
www/p5-libapreq2
- net-mgmt/netdisco
- net-mgmt/netdot
- www/foswiki-ModPerlEngineContrib
- www/p5-Apache-Gallery
- www/p5-Apache2-SiteControl
- www/p5-Bundle-Sledge*
-- www/p5-Sledge
--- www/p5-Sledge-Plugin-CacheContent*
--- www/p5-Sledge-Plugin-Download*
--- www/p5-Sledge-Plugin-Dumper*
--- www/p5-Sledge-Plugin-HTML2HDML*
--- www/p5-Sledge-Plugin-Log*
--- www/p5-Sledge-Plugin-NoCache*
--- www/p5-Sledge-Plugin-SaveUpload*
--- www/p5-Sledge-Plugin-ScratchPad*
--- www/p5-Sledge-Plugin-SessionAutoCleanup*
--- www/p5-Sledge-Plugin-XSLT*
--- www/p5-Sledge-SessionManager-CookieStore*
--- www/p5-Sledge-Template-Expr*
- www/p5-CGI-Application-Plugin-Apache
- www/rt38
- www/rt40
- www/rt42
-- www/p5-RT-Authen-ExternalAuth
-- www/p5-RT-Extension-LDAPImport
-- www/p5-RT-Extension-MandatoryOnTransition
-- www/p5-RT-Extension-SLA
-- www/p5-RTx-Calendar

* - deleted ports are only shown under the This port is required by section.

Of course non default like Bugzilla are not shown... Doesn't seem to be a way to  get FreshPorts to show what ports have mod_perl2 as an option - because its going to break a whole lot more (not to mention everything I write (not "portable" stuff) is all written for mod_perl2 and all my servers (where possible) run FreeBSD ... and I have my boss itching for an excuse for me to move to CentOS...
Comment 13 papowell 2014-08-03 00:43:26 UTC
With respect to your patches,  I went to the SVN respository 
http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24/

downloaded this version and discovered that the patch-pre-hook already appears to be applied:


The second patch, mp24-apache24.patch is interesting.

+.if ${APACHE_VERSION} > 22
+       ${REINPLACE_CMD} -e "s,remote_addr,client_addr,g" \
+               -e "s,remote_ip,client_ip,g" \
+               -e "s/'loglevel'/'log.level'/g" \
+               ${WRKSRC}/xs/maps/apache2_structures.map
+       ${REINPLACE_CMD} -e "s,remote_addr,client_addr,g" \
+               -e "s,remote_ip,client_ip,g" \
+               -e "s/'loglevel'/'log.level'/g" \
+               ${WRKSRC}/xs/tables/current/Apache2/StructureTable.pm
+.endif

This is changing the remote_addr to client_addr, remote_ip to client_ip,
and loglevel to log.level.  I am afraid I am not a Perl/XS wizard,
so I am having a bit of a problem deciding if this is needed or has
already been done in the CSV download.  There already seem to be some client_addr, client_ip symbols in those files.  Where does the log.level come in?

Question: what changes in the API (yeah I looked at http://httpd.apache.org/docs/current/developer/new_api_2_4.html, they sure did not spare the hot sauce on this one) required these changes?
Comment 14 Olli Hauer freebsd_committer 2014-08-03 15:10:47 UTC
Created attachment 145304 [details]
patch current upstream mod_perl r1602105

I shaped a patch for current upstream mod_perl r1602105.

`make test' on FreeBSD-10 (amd64) where OK, please test at own risk with a real application.

In case someone wants to test a real application against apache22 then this can be done by 
 replacing ".if ${APACHE_VERSION} > 22" with ".if ${APACHE_VERSION} >= 22"

Please report bugs upstream and also here, as soon upstream has fixes we can include them in the port.
Comment 15 John Marino freebsd_committer 2014-08-05 16:02:39 UTC
well, it builds ok, but I haven't tested how well it functions.
Comment 16 Kurt Jaeger freebsd_committer 2014-08-05 16:03:19 UTC
(In reply to John Marino from comment #15)
> well, it builds ok, but I haven't tested how well it functions.

I plan a test setup in the next few days.
Comment 17 Olli Hauer freebsd_committer 2014-08-06 21:28:12 UTC
Created attachment 145427 [details]
patch current upstream mod_perl r1602105 v02

Updated patch for www/mod_perl2
- fix pkg-plist if build against apache22
Comment 18 Olli Hauer freebsd_committer 2014-08-17 15:50:26 UTC
Created attachment 145925 [details]
mod_perl2-2.0.8-r1618150_apache24.diff

I've updated the patch to reflect the last changes from upstream.
The changes are in the testsuite, for better detecting of the apache version.

The full patch against the port can be grabbed from the bugzilla or from here.
http://people.freebsd.org/~ohauer/diffs/apache/mod_perl2-2.0.8-r1618150_apache24.diff

Anyway are there already some results from the requester by running the patch with real workload?
Comment 19 commit-hook freebsd_committer 2014-09-07 14:16:04 UTC
A commit references this bug:

Author: ohauer
Date: Sun Sep  7 14:15:19 UTC 2014
New revision: 367548
URL: http://svnweb.freebsd.org/changeset/ports/367548

Log:
  - apply patches for apache24 shaped from upstream r1602105 (2.0.9-dev)

  The patches are automatically applied if build against apache24.

  Interested apache22 users can change the follwing line in the Makefile
   from: .if ${APACHE_VERSION} > 22
   to:   .if ${APACHE_VERSION} >= 22

  Changelog (*NIX related):
  =item 2.0.9-dev

  Make sure modperl_interp_select uses r->server rather than the passed s
  parameter to find the interpreter pool to pull an interpreter from. This
  fixes an issue with vhosts with a separate interpreter pool and runtime
  dir-config merges that used to pull the interpreter from the wrong pool.
  [Torsten Foertsch]

  PerlInterpScope is now more advisory. Using $(c|r)->pnotes will bind
  the current interpreter to that object for it's lifetime.
  $(c|r)->pnotes_kill() can be used to prematurely drop pnotes and
  remove this binding. [Torsten Foertsch]

  Now correctly invokes PerlCleanupHandlers, even if they are the only
  handler type configured for that request [Torsten Foertsch]

  For threaded MPMs, change interpreter managment to a new, reference-counted
  allocation model. [Torsten Foertsch]

  Expose modperl_interp_pool_t via ModPerl::InterpPool, modperl_tipool_t
  via ModPerl::TiPool and modperl_tipool_config_t via ModPerl::TiPoolConfig
  [Torsten Foertsch]

  Expose modperl_interp_t via ModPerl::Interpreter [Torsten Foertsch]

  Fix t/compat/apache_file.t on Windows. Apache::File->tmpfile() wants TMPDIR
  or TEMP from the environment, or else defaults to /tmp. The latter is no
  good on Windows, so make sure the environment variables are passed through.
  (TEMP should be set to something suitable on Windows.) [Steve Hay]

  Fix t/api/err_headers_out.t with HTTP::Headers > 6.00. [Rolando
  <rolosworld@gmail.com>]

  PR:		191471

Changes:
  head/www/mod_perl2/Makefile
  head/www/mod_perl2/distinfo
  head/www/mod_perl2/files/pkg-message.in
  head/www/mod_perl2/pkg-plist
Comment 20 Olli Hauer freebsd_committer 2014-09-07 14:23:32 UTC
I've committed the last patch against upstream r1618150.

Thanks to all requesters for the useful feedback or should I say the lack of?
Comment 21 papowell 2014-09-09 19:16:28 UTC
Thanks!  I was using your patches as of 7 Aug 2014,  and it seems to be working fine for me.   I will try the latest and see what the result is.  Sorry for no feedback.
Comment 22 papowell 2014-09-16 14:46:46 UTC
I have tested this for a week now on several systems and it appears to work with my very small selection of test cases on FreeBSD 9.3 amd64.
Comment 23 kovert 2014-09-21 04:28:10 UTC
Once built, it seems to work fine on FreeBSD 10 STABLE/amd64 against:

apache24-2.4.10_1              Version 2.4.x of Apache web server
perl5-5.20.0_3                 Practical Extraction and Report Language

I did notice that when building it, Mk/bsd.apache.mk around line 281 has:

.if exists(${HTTPD})
_APACHE_VERSION!=       ${HTTPD} -V | ${SED} -ne 's/^Server version: Apache\/\([
0-9]\)\.\([0-9]*\).*/\1\2/p'
.elif defined(APACHE_PORT)
_APACHE_VERSION!=       ${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0
-9]*\).*,\1,p'
.endif

On a machine that would normally have mod_perl installed but does not because I am rebuilding it, httpd fails to run due to configuration syntax errors and thus the build fails.

A quick test shows that httpd -v will work regardless of if the server will start, where -V requires it, so I would suggest switching to -v.  Please let me know if that should be in another bugzilla ticket.

-Todd
Comment 24 Olli Hauer freebsd_committer 2014-09-21 15:40:51 UTC
Hi Todd,

thanks for the note, I will commit your fix!

-- 
olli
Comment 25 commit-hook freebsd_committer 2014-09-21 15:47:55 UTC
A commit references this bug:

Author: ohauer
Date: Sun Sep 21 15:47:09 UTC 2014
New revision: 368775
URL: http://svnweb.freebsd.org/changeset/ports/368775

Log:
  - change check for httpd version s/-V/-v/

    -V also checks for config issues in httpd.conf, this can break a build
    in case there are config issues during rebuilds on a live system.
    -v prints the required info without check

  with hat apache@

  PR:		191471
  Submitted by:	Todd <kovert_at_omniscient.com>

Changes:
  head/Mk/bsd.apache.mk