On 2/22/19 10:54 AM, Matthias Schmitt wrote:
> I doubt that you will be able to compile mod_perl 1.x with newer compilers 
> and operating systems.

Hold my beer :).

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"

$ which httpd
/home/mschout/perl5/perlbrew/perls/perl-5.10.1-apache-1.3/bin/httpd

$ httpd -v
Server version: Apache/1.3.41 (Unix)
Server built:   Feb 24 2019 16:43:18

And, it passes the Apache::AuthCookie test suite (provided you install
Apache::Test and Test::More@0.94).  It identifies in the log as:
[notice] Apache/1.3.41 (Unix) mod_perl/1.32-dev configured

I'm actually somewhat suprised that it compiled.

Its *possible* :).  But given how long 1.3 has been EOL'd, I *STRONGLY*
discourage anyone from using it.  At a minimum update to Apache 2.2,
which, although also EOL'd at this point, at least got security updates
within the past year or so.  You really need to migrate to 2.4.

That being said, you can build it if you apply the attached patches, as
part of the perlbrew+mod_perl setup I made for testing various versions
of apache and mod_perl over the years.  For the curious, the process I
used here was:

$ perlbrew install -Accflags=-fPIC -v --noman --notest -j9 \
  --as perl-5.10.1-apache-1.3 5.10.1

I used 5.10 in order to avoid dealing with any incompatibilities with
newer perls against apache 1.3.

$ perlbrew use perl-5.10.1-apache-1.3
$ cpanm -q --notest LWP::UserAgent

Then extract apache and mod_perl dists (I'm using apache 1.3.41,
mod_perl 1.31) and apply the attached patches to apache+mod_perl.

For mod_perl, apply the mod_perl-1.32.patch, which IIRC, I pulled from
the mod_perl svn trunk years ago.

The other two patches need to be applied to apache (apache-getline.patch
and gcc-inline-fix.patch).

I built this way:

$ perl Makefile.PL \
    APACHE_SRC=path/to/apache-src/src \
    DO_HTTPD=1 \
    USE_APACI=1 \
    PREP_HTTPD=1 \
    EVERYTHING=1
$ cd /path/to/apache-src
$ bash ./configure --prefix=$PERLBREW_ROOT/perls/$PERLBREW_PERL \
    --with-layout=Apache \
    --enable-module=all \
    --disable-module=auth_db \
    --disable-module=auth_dbm \
    --enable-shared=max \
    --activate-module=src/modules/perl/libperl.a \
    --disable-shared=perl \
    --disable-rule=EXPAT \
    --disable-rule=WANTHSREGEX
$ cd /path/to/apache-src
$ make install
$ cd /path/to/modperl-src
$ make install

I have a Makefile that does all of this.  I suppose I could publish it
on github or something, but given the age of apache 1.3, it seems
irresponsible to publish it at this point :).

Regards,
Michael Schout
diff --git a/src/support/htdigest.c b/src/support/htdigest.c
index 7afb033..6758d99 100644
--- a/src/support/htdigest.c
+++ b/src/support/htdigest.c
@@ -70,7 +70,7 @@ static void getword(char *word, char *line, char stop)
     while ((line[y++] = line[x++]));
 }
 
-static int getline(char *s, int n, FILE *f)
+static int _getline(char *s, int n, FILE *f)
 {
     register int i = 0;
 
@@ -157,7 +157,7 @@ static void copy_file(FILE *target, FILE *source)
 {
     static char line[MAX_STRING_LEN];
 
-    while (!(getline(line, MAX_STRING_LEN, source))) {  
+    while (!(_getline(line, MAX_STRING_LEN, source))) {  
 	putline(target, line);
     }
 }
@@ -215,7 +215,7 @@ int main(int argc, char *argv[])
     ap_cpystrn(realm, argv[2], sizeof(realm));
 
     found = 0;
-    while (!(getline(line, MAX_STRING_LEN, f))) {
+    while (!(_getline(line, MAX_STRING_LEN, f))) {
 	if (found || (line[0] == '#') || (!line[0])) {
 	    putline(tfp, line);
 	    continue;
diff --git a/src/support/htpasswd.c b/src/support/htpasswd.c
index d3ce569..5f0565e 100644
--- a/src/support/htpasswd.c
+++ b/src/support/htpasswd.c
@@ -97,7 +97,7 @@ static char *tname_buf = NULL;
  * Get a line of input from the user, not including any terminating
  * newline.
  */
-static int getline(char *s, int n, FILE *f)
+static int _getline(char *s, int n, FILE *f)
 {
     register int i = 0;
 
@@ -546,7 +546,7 @@ int main(int argc, char *argv[])
 	char scratch[MAX_STRING_LEN];
 
 	fpw = fopen(pwfilename, "r");
-	while (! (getline(line, sizeof(line), fpw))) {
+	while (! (_getline(line, sizeof(line), fpw))) {
 	    char *colon;
 
 	    if ((line[0] == '#') || (line[0] == '\0')) {
diff --git a/src/support/logresolve.c b/src/support/logresolve.c
index be92165..110dd7c 100644
--- a/src/support/logresolve.c
+++ b/src/support/logresolve.c
@@ -70,7 +70,7 @@
 #endif /* !MPE && !WIN32*/
 
 static void cgethost(struct in_addr ipnum, char *string, int check);
-static int getline(char *s, int n);
+static int _getline(char *s, int n);
 static void stats(FILE *output);
 
 
@@ -277,7 +277,7 @@ static void stats (FILE *output)
  * gets a line from stdin
  */
 
-static int getline (char *s, int n)
+static int _getline (char *s, int n)
 {
     char *cp;
 
@@ -325,7 +325,7 @@ int main (int argc, char *argv[])
     for (i = 0; i < MAX_ERR + 2; i++)
 	errors[i] = 0;
 
-    while (getline(line, MAXLINE)) {
+    while (_getline(line, MAXLINE)) {
 	if (line[0] == '\0')
 	    continue;
 	entries++;
diff -uNr apache_1.3.41.orig/src/os/unix/os.h apache_1.3.41/src/os/unix/os.h
--- apache_1.3.41.orig/src/os/unix/os.h	2006-07-12 03:16:05.000000000 -0500
+++ apache_1.3.41/src/os/unix/os.h	2016-07-06 08:27:21.394527656 -0500
@@ -33,7 +33,11 @@
 /* Compiler supports inline, so include the inlineable functions as
  * part of the header
  */
+#ifdef __GNUC_STDC_INLINE__ 
+#define INLINE extern ap_inline __attribute__((gnu_inline)) 
+#else 
 #define INLINE extern ap_inline
+#endif
 
 INLINE int ap_os_is_path_absolute(const char *file);
 
diff --git a/Changes b/Changes
index 6e76445..1db2875 100644
--- a/Changes
+++ b/Changes
@@ -8,6 +8,25 @@ all changes without author attribution are by Doug MacEachern
 
 =over 3
 
+=item 1.32-dev
+
+Fix breakage caused by removal of PL_uid et al from perl 5.16.0. Patch from
+RT 79977.
+[Andreas Koenig <andreas.koenig.7os6v...@franz.ak.mind.de>]
+
+Post RT 64999 typo spot in CvGV macro
+[Salvador Ortiz Garcia <s...@msg.com.mx>]
+
+RT 64999, perl 5.14 compatibility, GvCV and GvGP lvalue changes in perl core
+[Todd Wade <sendw...@hotmail.com>]
+
+RT 40918, fix issue with sigils in perl binary path
+[Slaven Rezic <sre...@cpan.org>]
+
+Work around a gcc optimization specific bug which
+cuased seg faults on FreeBSD 7.x during mod_perl startup.
+[Tim Zingelman <zingel...@fnal.gov>]
+
 =item 1.31 May 11, 2009
 
 Fix static APACI build on Mac OS X. [Gozer]
diff --git a/Makefile.PL b/Makefile.PL
index 90e7526..6078465 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -786,7 +786,7 @@ if ($APACHE_SRC or $USE_APXS) {
     setup_for_static() unless $USE_APXS;
 
     iedit "$APACHE_SRC/modules/perl/Makefile",
-        "s!^PERL\\s*=.*!PERL=$Config{'perlpath'}!" unless $USE_APACI or $USE_APXS;
+        "BEGIN { require Config; Config->import } s!^PERL\\s*=.*!PERL=\$Config{'perlpath'}!" unless $USE_APACI or $USE_APXS;
 
     for (@callback_hooks) {
         ($k,$v) = ($_,$callback_hooks{$_});
diff --git a/RELEASE b/RELEASE
index 62cc776..765affe 100644
--- a/RELEASE
+++ b/RELEASE
@@ -14,7 +14,7 @@ Instructions for mod_perl 1.x Release Manager
       http://people.apache.org/~geoff/gpghowto.html
 
     Copy the KEYS file into place:
-    % scp KEYS perl.apache.org:/www/www.apache.org/dist/perl/KEYS
+    % scp KEYS people.apache.org:/www/www.apache.org/dist/perl/KEYS
 
     If this is your first release, ask someone with APML karma on PAUSE 
     to verify you have the appropriate permissions.  Likely someone on 
@@ -30,7 +30,7 @@ Instructions for mod_perl 1.x Release Manager
        make sure you give the correct permissions to them.
 
 1. 'make dist' - to make sure nothing is missing from the manifest,
-   etc. Now test this generated package mod_perl-1.31-dev.tar.gz (not
+   etc. Now test this generated package mod_perl-1.32-dev.tar.gz (not
    the current build) with as many
    configurations as possible on as many platforms as possible,
    unpacking the package each time afresh.  
@@ -51,7 +51,7 @@ Instructions for mod_perl 1.x Release Manager
    to the modperl/dev list (may be longer to give most people a chance
    to catch up). no need to tag this package
 
-   Subject: [RELEASE CANDIDATE]: mod_perl-1.31 RC\d+
+   Subject: [RELEASE CANDIDATE]: mod_perl-1.32 RC\d+
 
 2a. if problems are detected during stage 2, repeat stages 1 and 2.
 
@@ -78,34 +78,34 @@ Instructions for mod_perl 1.x Release Manager
 
   f. test the final package again at least once
 
-4. Release the package and update links (e.g. mod_perl-1.31.tar.gz)
+4. Release the package and update links (e.g. mod_perl-1.32.tar.gz)
 
-  a. upload to perl.apache.org:/www/perl.apache.org/dist/
+  a. upload to people.apache.org:/www/perl.apache.org/dist/
 
-    %  scp mod_perl-1.31.tar.gz perl.apache.org:/www/perl.apache.org/dist/
+    %  scp mod_perl-1.32.tar.gz people.apache.org:/www/perl.apache.org/dist/
 
-  b. ssh to perl.apache.org, unpack the package, update symlinks to the
+  b. ssh to people.apache.org, unpack the package, update symlinks to the
      tar ball and unpacked distro:
 
-    % ssh perl.apache.org
+    % ssh people.apache.org
     % cd /www/perl.apache.org/dist/
-    % ln -sf mod_perl-1.31.tar.gz mod_perl-1.1-current.tar.gz
-    % tar -xzvf mod_perl-1.31.tar.gz
-    % rm /www/perl.apache.org/dist/mod_perl-1.1-current
-    % ln -sf  mod_perl-1.31 mod_perl-1.1-current
+    % ln -sf mod_perl-1.32.tar.gz mod_perl-1.2-current.tar.gz
+    % tar -xzvf mod_perl-1.32.tar.gz
+    % rm /www/perl.apache.org/dist/mod_perl-1.2-current
+    % ln -sf  mod_perl-1.32 mod_perl-1.2-current
 
   c. archive older releases (keep current + one prior release)
 
-    % mv /www/perl.apache.org/dist/mod_perl-1.29.tar.gz \
+    % mv /www/perl.apache.org/dist/mod_perl-1.30.tar.gz \
          /www/perl.apache.org/dist/old
-    % mv /www/perl.apache.org/dist/mod_perl-1.30.tar.gz.asc \
+    % mv /www/perl.apache.org/dist/mod_perl-1.31.tar.gz.asc \
          /www/perl.apache.org/dist/old
-    % rm -rf /www/perl.apache.org/dist/mod_perl-1.29
+    % rm -rf /www/perl.apache.org/dist/mod_perl-1.30
 
   d. update the version and release date
      modperl-docs/src/download/index_top.html and commit. It'll be
      automatically updated within 6 hours. Alternatively you can do a
-     manual update by logging into perl.apache.org and running:
+     manual update by logging into people.apache.org and running:
 
     % /home/perlwww/apache.org/modperl-docs/bin/site_build
 
@@ -123,27 +123,27 @@ Instructions for mod_perl 1.x Release Manager
 
   a. sign your local copy of the tarball:
 
-    % gpg --detach-sign --armor mod_perl-1.31.tar.gz
+    % gpg --detach-sign --armor mod_perl-1.32.tar.gz
 
-    % pgps -b --armor mod_perl-1.31.tar.gz
+    % pgps -b --armor mod_perl-1.32.tar.gz
 
-  b. upload the generated sig file to perl.apache.org:
+  b. upload the generated sig file to people.apache.org:
 
-    % scp mod_perl-1.31.tar.gz.asc perl.apache.org:/www/perl.apache.org/dist/
-    % ssh perl.apache.org
+    % scp mod_perl-1.32.tar.gz.asc people.apache.org:/www/perl.apache.org/dist/
+    % ssh people.apache.org
     % cd /www/perl.apache.org/dist/
-    % chmod 0664 mod_perl-1.31.tar.gz.asc
-    % ln -sf mod_perl-1.31.tar.gz.asc mod_perl-1.1-current.tar.gz.asc
+    % chmod 0664 mod_perl-1.32.tar.gz.asc
+    % ln -sf mod_perl-1.32.tar.gz.asc mod_perl-1.2-current.tar.gz.asc
 
   c. ask one of the other developers to double check the signature file
      and tarball: download both files and verify the signature:
 
-    http://perl.apache.org/dist/mod_perl-1.31.tar.gz.asc
-    http://perl.apache.org/dist/mod_perl-1.31.tar.gz
+    http://perl.apache.org/dist/mod_perl-1.32.tar.gz.asc
+    http://perl.apache.org/dist/mod_perl-1.32.tar.gz
 
-    % gpg --verify mod_perl-1.31.tar.gz.asc
+    % gpg --verify mod_perl-1.32.tar.gz.asc
 
-    % pgpv mod_perl-1.31.tar.gz.asc
+    % pgpv mod_perl-1.32.tar.gz.asc
 
   d. make sure that the files you just created are group rw so
      all the dist admins can make changes:
@@ -157,10 +157,10 @@ Instructions for mod_perl 1.x Release Manager
   a. unpack the package, update symlinks to the tarball and unpacked distro:
 
    % cd /www/www.apache.org/dist/perl/
-   % cp /www/perl.apache.org/dist/mod_perl-1.31.tar.gz* .
-   % tar -xzvf mod_perl-1.31.tar.gz
-   % mv mod_perl-1.29.tar.gz* /www/archive.apache.org/dist/perl/
-   % rm -rf mod_perl-1.29
+   % cp /www/perl.apache.org/dist/mod_perl-1.32.tar.gz* .
+   % tar -xzvf mod_perl-1.32.tar.gz
+   % mv mod_perl-1.30.tar.gz* /www/archive.apache.org/dist/perl/
+   % rm -rf mod_perl-1.30
 
   b. make sure that the files you just created are group rw so
 
@@ -173,11 +173,11 @@ Instructions for mod_perl 1.x Release Manager
 
   a. post ... to the modperl, announce lists
   Note, to post to announce@, you must be sending from an apache.org address.
-  Subject: [ANNOUNCE] mod_perl 1.31 
+  Subject: [ANNOUNCE] mod_perl 1.32 
      include 
   - link at perl.apache.org:
-    http://apache.org/dist/perl/mod_perl-1.31.tar.gz
-    http://apache.org/dist/perl/mod_perl-1.31.tar.gz.asc (pgp sig)
+    http://apache.org/dist/perl/mod_perl-1.32.tar.gz
+    http://apache.org/dist/perl/mod_perl-1.32.tar.gz.asc (pgp sig)
   - MD5 sig (as it comes from CPAN upload announce).
   - the latest Changes
 
@@ -188,7 +188,7 @@ Instructions for mod_perl 1.x Release Manager
   b. edit ./Changes:
      - start a new item with incremented version + '-dev'
 
-  =item 1.32-dev
+  =item 1.33-dev
 
   c. add a release entry in STATUS
 
@@ -199,7 +199,7 @@ Instructions for mod_perl 1.x Release Manager
 
   e. commit the changed files
 
-     % svn ci -m "start 1.32-dev cycle" Changes lib/mod_perl.pm \
+     % svn ci -m "start 1.33-dev cycle" Changes lib/mod_perl.pm \
        STATUS RELEASE
 
 10. Old Versions
diff --git a/STATUS b/STATUS
index 2a1a861..ba2dd17 100644
--- a/STATUS
+++ b/STATUS
@@ -3,6 +3,7 @@ mod_perl 1.3 STATUS:
 
 
 Release:
+       1.31: Released May 11, 2009.
        1.30: Released March 29, 2007.
        1.29: Released Oct 7, 2003.
        1.28: Released July 2, 2003.
diff --git a/Symbol/Symbol.xs b/Symbol/Symbol.xs
index a5b5624..833b923 100644
--- a/Symbol/Symbol.xs
+++ b/Symbol/Symbol.xs
@@ -2,6 +2,10 @@
 #include "perl.h"
 #include "XSUB.h"
 
+#ifndef CvGV_set
+# define CvGV_set(cv, val) (CvGV(cv) = val)
+#endif
+
 #ifdef PERL_OBJECT
 #define sv_name(svp) svp
 #define undef(ref) 
@@ -30,7 +34,7 @@ static void undef(SV *ref)
 	    has_proto = TRUE;
 
 	cv_undef(cv);
-	CvGV(cv) = gv;   /* let user-undef'd sub keep its identity */
+        CvGV_set(cv, gv); /* let user-undef'd sub keep its identity */
         if(has_proto) 
             SvPOK_on(cv); /* otherwise we get `Prototype mismatch:' */
 
diff --git a/lib/mod_perl.pm b/lib/mod_perl.pm
index ee4b820..0cae5c0 100644
--- a/lib/mod_perl.pm
+++ b/lib/mod_perl.pm
@@ -4,7 +4,7 @@ use strict;
 use DynaLoader ();
 
 BEGIN {
-    $mod_perl::VERSION = "1.31";
+    $mod_perl::VERSION = "1.32";
 }
 
 sub boot {
diff --git a/src/modules/perl/Constants.xs b/src/modules/perl/Constants.xs
index 96b052f..c77e5b6 100644
--- a/src/modules/perl/Constants.xs
+++ b/src/modules/perl/Constants.xs
@@ -20,7 +20,7 @@ static void export_cv(SV *pclass, SV *caller, char *sub)
 	    SvPVX(caller), sub, SvPVX(pclass), sub);
 #endif
     gv = gv_fetchpv(form("%_::%s", caller, sub), TRUE, SVt_PVCV);
-    GvCV(gv) = perl_get_cv(form("%_::%s", pclass, sub), TRUE);
+    GvCV_set(gv, perl_get_cv(form("%_::%s", pclass, sub), TRUE));
     GvIMPORTED_CV_on(gv);
 }
 
diff --git a/src/modules/perl/Log.xs b/src/modules/perl/Log.xs
index 9574c86..0686b54 100644
--- a/src/modules/perl/Log.xs
+++ b/src/modules/perl/Log.xs
@@ -10,7 +10,7 @@
 static void perl_cv_alias(char *to, char *from)
 {
     GV *gp = gv_fetchpv(to, TRUE, SVt_PVCV);
-    GvCV(gp) = perl_get_cv(from, TRUE);
+    GvCV_set(gp, perl_get_cv(from, TRUE));
 }
 
 static void ApacheLog(int level, SV *sv, SV *msg)
diff --git a/src/modules/perl/mod_perl.c b/src/modules/perl/mod_perl.c
index 47276d7..28cd13b 100644
--- a/src/modules/perl/mod_perl.c
+++ b/src/modules/perl/mod_perl.c
@@ -593,9 +593,15 @@ static void mod_perl_xs_init(pTHX)
 #endif
 }
 
+/*
+ * XXX: temp_argv is required to work around a bug in gcc
+ *      present in at least FreeBSD 7.x which causes
+ *      sefaults during mod_perl startup.
+ */
 void perl_startup (server_rec *s, pool *p)
 {
     char *argv[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+    char **temp_argv = argv;
     char **entries, *dstr;
     int status, i, argc=1;
     dPSRV(s);
@@ -679,7 +685,7 @@ void perl_startup (server_rec *s, pool *p)
     MP_TRACE_g(fprintf(stderr, "..."));
 
 #ifdef PERL_SYS_INIT
-    PERL_SYS_INIT(&argc,(char***)&argv);
+    PERL_SYS_INIT(&argc,(char***)&temp_argv);
 #endif
 
 #ifndef perl_init_i18nl10n
@@ -785,8 +791,8 @@ void perl_startup (server_rec *s, pool *p)
     /* *CORE::GLOBAL::exit = \&Apache::exit */
     if(gv_stashpv("CORE::GLOBAL", FALSE)) {
 	GV *exitgp = gv_fetchpv("CORE::GLOBAL::exit", TRUE, SVt_PVCV);
-	GvCV(exitgp) = perl_get_cv("Apache::exit", TRUE);
-	GvIMPORTED_CV_on(exitgp);
+	GvCV_set(exitgp, perl_get_cv("Apache::exit", TRUE));
+ 	GvIMPORTED_CV_on(exitgp);
     }
 
     ENTER_SAFE(s,p);
diff --git a/src/modules/perl/mod_perl.h b/src/modules/perl/mod_perl.h
index f62f532..935dd05 100644
--- a/src/modules/perl/mod_perl.h
+++ b/src/modules/perl/mod_perl.h
@@ -1026,6 +1026,14 @@ else { \
 #define PERL_HEADER_PARSER_CREATE(s)
 #endif
 
+#ifndef GvCV_set
+#define GvCV_set(gv, cv) (GvCV(gv) = (cv))
+#endif
+
+#ifndef CvGV_set
+#define CvGV_set(cv, gv) (CvGV(cv) = (gv))
+#endif
+
 typedef struct {
     array_header *PerlPassEnv;
     array_header *PerlRequire;
diff --git a/src/modules/perl/perl_config.c b/src/modules/perl/perl_config.c
index a579ae4..702b0c5 100644
--- a/src/modules/perl/perl_config.c
+++ b/src/modules/perl/perl_config.c
@@ -1720,7 +1720,7 @@ void perl_clear_symtab(HV *symtab)
 	if((cv = GvCV((GV*)val)) && (GvSTASH((GV*)val) == GvSTASH(CvGV(cv)))) {
             GV *gv = CvGV(cv);
             cv_undef(cv);
-            CvGV(cv) = gv;
+            CvGV_set(cv, gv);
             GvCVGEN(gv) = 1; /* invalidate method cache */
         }
     }
diff --git a/src/modules/perl/perl_util.c b/src/modules/perl/perl_util.c
index 4b2e665..1903f2d 100644
--- a/src/modules/perl/perl_util.c
+++ b/src/modules/perl/perl_util.c
@@ -670,6 +670,7 @@ void mod_perl_init_ids(void)  /* $$, $>, $), etc */
     if(set_ids++) return;
     sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32)getpid());
 #ifndef WIN32
+#if (PERL_REVISION == 5) && (PERL_VERSION <= 15)
     uid  = (int)getuid(); 
     euid = (int)geteuid(); 
     gid  = (int)getgid(); 
@@ -678,6 +679,7 @@ void mod_perl_init_ids(void)  /* $$, $>, $), etc */
 		     "perl_init_ids: uid=%d, euid=%d, gid=%d, egid=%d\n",
 		     uid, euid, gid, egid));
 #endif
+#endif
 }
 
 int perl_eval_ok(server_rec *s)

Reply via email to