Only .llong should be used for relocatable expressions - mod_perl 2.0.4 on AIX5.3 64bit

2010-12-22 Thread Stas, Kamil
hello, I am facing the following problem with compiling mod_perl 2.0.4 on 
AIX5.3 64bit

the problem I got this error after make:
Assembler:
/tmp//ccA7B415.s: line 8: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 9: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 10: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 11: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 12: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 13: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 14: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 15: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 16: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 17: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 30: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 62: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 103: Only .llong should be used for relocatable 
expressions.
/tmp//ccA7B415.s: line 171: Only .llong should be used for relocatable 
expressions.
collect2: gcc returned 1 exit status
make: The error code from the last command is 1.

When I faced these errors before just export CC=gcc -maix64 was enough to fix 
it

When compiling I use following env:
OBJECT_MODE=64
CC=gcc -maix64
export PATH,LDFLAGS,CPPFLAGS,LIBPATH

Can someone explain what Only .llong should be used for relocatable 
expressions. Should mean? What .llong are?

Thanx in advance.



mod_perl-2.0.4 for Apache httpd-2.2.17 on Solaris10 64bit - ld: wrong ELF class: ELFCLASS64 - CC=gcc -m64

2010-12-08 Thread Stas, Kamil
Hello,

I am trying to compile mod_perl-2.0.4 for Apache httpd-2.2.17 on Solaris10 
SunOS 5.10 Generic_141414-10 sun4v sparc SUNW,SPARC-Enterprise-T5120

I am facing ld: wrong ELF class: ELFCLASS64 problem.
Everyting was compiled in m -64 mode, generated .so 64bit, with export CC=gcc 
-m64

When compiling mod_perl it looks its trying to compile in 32bit mode, dont 
understand why.
How to forse it to compile in 64bit mode? Till now gcc -m64 was good to use, 
with exported LD_LIBRARY_PATH and PATH for sparcv9
CFLAGS=-L/usr/sfw/lib/sparcv9 -R/usr/sfw/lib/sparcv9
Perl Version: perl-5.12.2

Can you advise, please?

No error log under t/logs/error_log


ld: fatal: file 
/pkg/products/httpd_test/httpd/httpd-2.2.17a/apr-util//lib/libaprutil-1.so: 
wrong ELF class: ELFCLASS64
ld: fatal: file 
/pkg/products/httpd_test/httpd/httpd-2.2.17a/apr-util//lib/libexpat.so: wrong 
ELF class: ELFCLASS64
ld: fatal: file 
/pkg/products/httpd_test/httpd/httpd-2.2.17a/apr/lib/libapr-1.so: wrong ELF 
class: ELFCLASS64
ld: fatal: File processing errors. No output written to 
../../../blib/arch/auto/APR/APR.so
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target 
`../../../blib/arch/auto/APR/APR.so'
Current working directory 
/home/admin/kstas/httpd/modules/mod_perl/mod_perl-2.0.4/xs/APR/APR
*** Error code 1
The following command caused the error:
cd APR  make -f Makefile all LIBPERL_A=libperl.a LINKTYPE=dynamic 
OPTIMIZE=-fPIC PREFIX=/pkg/products/perl/perl-5.12.2 PASTHRU_INC=
make: Fatal error: Command failed for target `subdirs'
Current working directory 
/home/admin/kstas/httpd/modules/mod_perl/mod_perl-2.0.4/xs/APR
*** Error code 1
The following command caused the error:
cd APR  make -f Makefile all LIBPERL_A=libperl.a LINKTYPE=dynamic 
OPTIMIZE=-fPIC PREFIX=/pkg/products/perl/perl-5.12.2 PASTHRU_INC=
make: Fatal error: Command failed for target `subdirs'
Current working directory 
/home/admin/kstas/httpd/modules/mod_perl/mod_perl-2.0.4/xs
*** Error code 1
The following command caused the error:
cd xs  make -f Makefile all LIBPERL_A=libperl.a LINKTYPE=dynamic 
OPTIMIZE=-fPIC PREFIX=/pkg/products/perl/perl-5.12.2 PASTHRU_DEFINE= 
PASTHRU_INC= PERL=/pkg/products/perl/perl-5.12.2/bin/perl 
DEFINE=-DMP_HAVE_APR_LIBS
make: Fatal error: Command failed for target `subdirs'



svn commit: r690793 - /perl/modperl/branches/1.x/mod_perl.pod

2008-08-31 Thread stas
Author: stas
Date: Sun Aug 31 15:06:42 2008
New Revision: 690793

URL: http://svn.apache.org/viewvc?rev=690793view=rev
Log:
Indicate that http://perl.apache.org/faq/ is no more and merged into the docs
Reported by: Lars Noodén [EMAIL PROTECTED]

Modified:
perl/modperl/branches/1.x/mod_perl.pod

Modified: perl/modperl/branches/1.x/mod_perl.pod
URL: 
http://svn.apache.org/viewvc/perl/modperl/branches/1.x/mod_perl.pod?rev=690793r1=690792r2=690793view=diff
==
--- perl/modperl/branches/1.x/mod_perl.pod (original)
+++ perl/modperl/branches/1.x/mod_perl.pod Sun Aug 31 15:06:42 2008
@@ -36,8 +36,9 @@
 
 =head1 FAQ
 
-The mod_perl FAQ is maintained by Frank Cringle
-Elt[EMAIL PROTECTED]gt: http://perl.apache.org/faq/
+The mod_perl FAQ that used to be maintained by Frank Cringle
+Elt[EMAIL PROTECTED]gt, had been merged into the mod_perl
+documentation that can be found http://perl.apache.org/docs/
 
 =head1 Apache/Perl API
 




Re: Apache::TestMB quitting too early

2007-10-11 Thread Stas Bekman

Michael Peters wrote:

I'm using Apache::TestMB to test a distribution of mine. I haven't done much
work on it lately, but I've recently re-installed everything on a new machine
and needed to do some work on it today.

So I make sure httpd, httpd-devel and mod_perl are all installed as well as
Apache::Test (which passed it's test suite). But now when I run my test suite I
get prompted by this:

  Skip the test suite? [No]

If I accept the default or type No it just quits without any message as to
why. If I type in Yes then it exits with this message:

  [  error] Skipping the test suite execution, while returning success status

Any ideas why it's not running any tests when it should be?


Most likely it can't find your httpd, take a look at skip_test_suite in 
Apache/TestRun.pm. What was the output printed before the Skip ... above


--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
http://stason.org/photos/gallery/ http://healingcloud.com
http://chestofbooks.com/  http://modperlbook.org/
  http://modperl2book.org



Re: The mod_perl2 User's Guide book is out

2007-09-11 Thread Stas Bekman

Stas Bekman wrote:

Hi everybody,

Jim Brandt, Allison Randal and I are happy to announce that the first 
book about mod_perl2: The mod_perl2 User's Guide has been published 
and available for purchase. See the book's site: 
http://modperl2book.org/ for details.


50% of this book's proceeds will go The Perl Foundation 
[http://www.perlfoundation.org/].


It's time for someone to submit some mod_perl-related grant proposals to 
the perl foundation!


Please help us spread the word using your favorite social bookmarks 
service: digg, reddit, del.icio.us, etc.. Feel free to post the links 
here for others to vote for to avoid splits. Here is a quick way to 
access many of those services at once:
http://socialposter.com/generator.php?c=alltip=linksurl=http%3A%2F%2Fmodperl2book.org%2Ftitle=mod_perl2%20User's%20Guidetext= 


I see people started voting for it, here are some direct links to save 
you time. One of them is the interview with Jim Brandt, conducted by 
Andy Lester!


http://www.digg.com/programming/mod_perl_2_User_s_Guide_published_An_interview_with_co_author_Jim_Brandt
http://digg.com/programming/mod_perl2_User_s_Guide
http://reddit.com/info/2oa5k/comments
http://www.netscape.com/viewstory/2007/09/11/mod-perl2-users-guide/?url=http%3A%2F%2Fmodperl2book.org%2Fframe=true
http://www.stumbleupon.com/url/modperl2book.org/

Thanks!

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
http://stason.org/photos/gallery/ http://healingcloud.com
http://chestofbooks.com/  http://modperlbook.org/
  http://modperl2book.org



The mod_perl2 User's Guide book is out

2007-09-10 Thread Stas Bekman

Hi everybody,

Jim Brandt, Allison Randal and I are happy to announce that the first 
book about mod_perl2: The mod_perl2 User's Guide has been published 
and available for purchase. See the book's site: 
http://modperl2book.org/ for details.


50% of this book's proceeds will go The Perl Foundation 
[http://www.perlfoundation.org/].


Please help us spread the word using your favorite social bookmarks 
service: digg, reddit, del.icio.us, etc.. Feel free to post the links 
here for others to vote for to avoid splits. Here is a quick way to 
access many of those services at once:

http://socialposter.com/generator.php?c=alltip=linksurl=http%3A%2F%2Fmodperl2book.org%2Ftitle=mod_perl2%20User's%20Guidetext=

Thank you and enjoy the book!

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
http://stason.org/photos/gallery/ http://healingcloud.com
http://chestofbooks.com/  http://modperlbook.org/
  http://modperl2book.org



Re: Fw: Re: mod_perl closes apache's stdin and/or stdout

2007-04-03 Thread Stas Bekman

Stephane Chazelas wrote:

On Mon, Apr 02, 2007 at 03:52:50PM -0700, Stas Bekman wrote:

Stephane, you are correct in your observations that original STDIN and
STDOUT filehandles are not preserved when perlio CGI mode is used.

This is because how Perl works. Consider the following perl program, run from 
the command line (not mod_perl!):



Hi Stas, that's not what I think happens though.

I suspected as well that the responsible code was in
src/modules/perl/modperl_io.c

And it does IIUC:

open STDIN_SAVED, STDIN or die Can't dup STDIN: $!;
close STDIN;
open STDIN, :apache

and same for STDOUT.

And it should work, except that the second open, which should
resolve to a dup2 or dup system call doesn't seem to do anything
file-descriptor-wise. It rather looks like is assignes the STDIN
perl handle to the Socket, so that STDIN no longer has the fd 0
(as demonstrated by my test of executing a lsof command within a
CGI script), but something more like 16, which was returned by
the accept() of the incoming HTTP connection.


That's correct, Stephane. The :Apache perlio layer does not use a 
socket. It uses $r instead, which is already interfacing an existing 
non-STD socket. That's why the :Apache perlio layer doesn't take over 
the just released fd.


There is a problem with using a socket with :Apache perlio layer. If we 
do so Perl will attempt to use that socket. I suppose it's still 
possible to work around that, you are more than welcome to change the 
:Apache perlio layer to dup(2). It can be found in 
modperl_io_apache.[ch] files. modperl_io.c invokes it via open 
:Apache. You can find the documentation of perlio layers in the 
perliol manpage.



 handle_save = gv_fetchpv(Perl_form(aTHX_
Apache2::RequestIO::_GEN_%ld,

[...]

+/* now grab the just released fd, normally 0 */
+handle_save_fd = gv_fetchpv(GENX2, TRUE, SVt_PVIO);
+
+/* open my $oldout, =0 or die Can't save STDIN's fd: $!; */
+status = do_open(handle_save_fd, /dev/null, 10, FALSE,
+ O_RDONLY, 0, Nullfp);

[...]

You don't want that IMO, you want the fd 0 and 1 to point to the
socket so that the CGI has both its stdin and stdout pointing to
the socket, because that's how unmodified CGI scripts do.

system(echo foo);

Should output foo\n to the page returned by the CGI. and echo
foo does a write(1, foo\n, 4);

I must confess I tried to follow in the perl code what that
do_open9 call that was supposed to dup the socket into
stdin/stdout was doing but didn't get very far. I tried to
replace those perl functions to real close() and dup()s but it
didn't help either.


Yes, do_openn (do_open9 is just a wrapper) is hairy. I spent hours 
deciphering it. I hope the above explanation makes the issue with lack 
of dup() clear.


--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
The Practical mod_perl book http://modperlbook.org/
http://stason.org/photos/gallery/ http://healingcloud.com



Re: Fw: Re: mod_perl closes apache's stdin and/or stdout

2007-04-02 Thread Stas Bekman
(handle, TRUE);
+
+/* now grab the just released fd, normally 0 */
+handle_save_fd = gv_fetchpv(GENX2, TRUE, SVt_PVIO);
+
+/* open my $oldout, =0 or die Can't save STDIN's fd: $!; */
+status = do_open(handle_save_fd, /dev/null, 10, FALSE,
+ O_RDONLY, 0, Nullfp);
+if (status == 0) {
+Perl_croak(aTHX_ Failed to save STDIN's fd: % SVf,
+   get_sv(!, TRUE));
+}
+
+fprintf(stderr, saved STDIN fd: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle_save_fd;
+
 }

 sv_setref_pv(sv, Apache2::RequestRec, (void*)r);
@@ -142,6 +163,9 @@
 }

 MP_TRACE_o(MP_FUNC, end\n);
+
+fprintf(stderr, STDIN dupped: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle;

 return handle_save;
 }
@@ -152,8 +176,12 @@
 dHANDLE(STDOUT);
 int status;
 GV *handle_save = (GV*)Nullsv;
+GV *handle_save_fd = (GV*)Nullsv;
 SV *sv = sv_newmortal();

+fprintf(stderr, STDOUT orig: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle;
+
 MP_TRACE_o(MP_FUNC, start);

 /* if STDOUT is open, dup it, to be restored at the end of response */
@@ -175,6 +203,21 @@
  * have file descriptors, so STDOUT must be closed before it can
  * be reopened */
 do_close(handle, TRUE);
+
+
+/* now grab the just released fd, normally 0 */
+handle_save_fd = gv_fetchpv(GENX4, TRUE, SVt_PVIO);
+
+/* open my $oldout, =0 or die Can't save STDIN's fd: $!; */
+status = do_open(handle_save_fd, /dev/null, 10, FALSE,
+ O_RDONLY, 0, Nullfp);
+if (status == 0) {
+Perl_croak(aTHX_ Failed to save STDOUT's fd: % SVf,
+   get_sv(!, TRUE));
+}
+
+fprintf(stderr, saved STDOUT fd: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle_save_fd;
 }

 sv_setref_pv(sv, Apache2::RequestRec, (void*)r);
@@ -190,14 +233,17 @@
  * overridden? */
 IoFLUSH_off(handle); /* STDOUT's $|=0 */

+fprintf(stderr, STDOUT dupped: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle;
+
 return handle_save;
-
 }

 MP_INLINE void modperl_io_perlio_restore_stdin(pTHX_ GV *handle)
 {
 GV *handle_orig = gv_fetchpv(STDIN, FALSE, SVt_PVIO);
-
+GV *handle_save_fd = gv_fetchpv(GENX2, TRUE, SVt_PVIO);
+
 MP_TRACE_o(MP_FUNC, start);

 /* close the overriding filehandle */
@@ -212,6 +258,8 @@

 MP_TRACE_o(MP_FUNC, restoring STDIN);

+do_close(handle_save_fd, FALSE);
+
 if (do_open9(handle_orig, , 2, FALSE,
  O_RDONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
 err = get_sv(!, TRUE);
@@ -226,13 +274,16 @@
 }
 }

+fprintf(stderr, STDIN restored: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle_orig;
+
 MP_TRACE_o(MP_FUNC, end\n);
 }

 MP_INLINE void modperl_io_perlio_restore_stdout(pTHX_ GV *handle)
 {
 GV *handle_orig = gv_fetchpv(STDOUT, FALSE, SVt_PVIO);
-
+GV *handle_save_fd = gv_fetchpv(GENX4, TRUE, SVt_PVIO);
 MP_TRACE_o(MP_FUNC, start);

 /* since closing unflushed STDOUT may trigger a subrequest
@@ -259,6 +310,8 @@

 MP_TRACE_o(MP_FUNC, restoring STDOUT);

+do_close(handle_save_fd, FALSE);
+
 if (do_open9(handle_orig, , 2, FALSE,
  O_WRONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
 err = get_sv(!, TRUE);
@@ -273,5 +326,8 @@
 }
 }

+fprintf(stderr, STDOUT restored: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle_orig;
+
 MP_TRACE_o(MP_FUNC, end\n);
 }

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
The Practical mod_perl book http://modperlbook.org/
http://stason.org/photos/gallery/ http://healingcloud.com

Index: src/modules/perl/modperl_io.c
===
--- src/modules/perl/modperl_io.c   (revision 524915)
+++ src/modules/perl/modperl_io.c   (working copy)
@@ -108,14 +108,20 @@
 {
 dHANDLE(STDIN);
 int status;
-GV *handle_save = (GV*)Nullsv;
+GV *handle_save= (GV*)Nullsv;
+GV *handle_save_fd = (GV*)Nullsv;
+
 SV *sv = sv_newmortal();
 
+fprintf(stderr, STDIN orig: %d\n,
+(int)PerlIO_fileno(IoIFP(GvIOn(handle;
+
 MP_TRACE_o(MP_FUNC, start);
 
 /* if STDIN is open, dup it, to be restored at the end of response */
 if (handle  SvTYPE(handle) == SVt_PVGV 
 IoTYPE(GvIO(handle)) != IoTYPE_CLOSED) {
+
 handle_save = gv_fetchpv(Perl_form(aTHX_
Apache2::RequestIO::_GEN_%ld,
(long)PL_gensym++),
@@ -132,6 +138,21 @@
  * have file descriptors, so STDIN must be closed before

Re: Fw: Re: mod_perl closes apache's stdin and/or stdout

2007-04-02 Thread Stas Bekman

William A. Rowe, Jr. wrote:

Stas Bekman wrote:

But which file to open as a place holder? In this example I use
/dev/null and it works as you wish. AFAIK, windows doesn't have
/dev/null, unless you run on cygwin.


Of course, it does, but it has the classic MS-DOS name of NUL
present in the context of any directory (so \dev\nul works if you
have a dev directory.)


I guess this can be ifdef'ed then.

Bill, so /dev/null and NUL should cover all grounds Apache runs on, or 
are there other odd cases? And if so do you have a better idea for a 
file to open that will work everywhere? [also notice that it has to be 
rw - and if not, we need two files then, one for  and another for , 
otherwise open will fail.


Thanks Bill

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
The Practical mod_perl book http://modperlbook.org/
http://stason.org/photos/gallery/ http://healingcloud.com



Re: Fw: Re: mod_perl closes apache's stdin and/or stdout

2007-04-02 Thread Stas Bekman

William A. Rowe, Jr. wrote:

Stas Bekman wrote:

William A. Rowe, Jr. wrote:

Stas Bekman wrote:

But which file to open as a place holder? In this example I use
/dev/null and it works as you wish. AFAIK, windows doesn't have
/dev/null, unless you run on cygwin.

Of course, it does, but it has the classic MS-DOS name of NUL
present in the context of any directory (so \dev\nul works if you
have a dev directory.)

I guess this can be ifdef'ed then.

Bill, so /dev/null and NUL should cover all grounds Apache runs on, or
are there other odd cases? And if so do you have a better idea for a
file to open that will work everywhere? [also notice that it has to be
rw - and if not, we need two files then, one for  and another for ,
otherwise open will fail.


AFAIK - [EMAIL PROTECTED] might be an interesting collection of folks to ask.


Hopefully someone here has an equivalent or a better knowledge.

Thanks for your help, Bill

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
http://www.linkedin.com/in/stasbekman http://stasosphere.com/
The Practical mod_perl book http://modperlbook.org/
http://stason.org/photos/gallery/ http://healingcloud.com



svn commit: r503974 - /perl/modperl/trunk/src/modules/perl/modperl_handler.c

2007-02-05 Thread stas
Author: stas
Date: Mon Feb  5 20:14:28 2007
New Revision: 503974

URL: http://svn.apache.org/viewvc?view=revrev=503974
Log:
make the compiler happy (missing the 'default' case in the switch statement)

Modified:
perl/modperl/trunk/src/modules/perl/modperl_handler.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_handler.c
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_handler.c?view=diffrev=503974r1=503973r2=503974
==
--- perl/modperl/trunk/src/modules/perl/modperl_handler.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_handler.c Mon Feb  5 20:14:28 
2007
@@ -514,6 +514,7 @@
 }
 name = apr_pstrcat(p, HvNAME(GvSTASH(gv)), ::, GvNAME(gv), NULL);
 return modperl_handler_new(p, apr_pstrdup(p, name));
+  default:
 break;
 };
 




svn commit: r503976 - in /perl/modperl/trunk: Changes ModPerl-Registry/lib/ModPerl/RegistryCooker.pm

2007-02-05 Thread stas
Author: stas
Date: Mon Feb  5 20:31:48 2007
New Revision: 503976

URL: http://svn.apache.org/viewvc?view=revrev=503976
Log:
fix ModPerl::RegistryCooker::read_script to handle all possible
errors, previously there was a case where Apache2::Const::OK was
returned on an error. 
Contributed by: Eivind Eklund [EMAIL PROTECTED]

Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?view=diffrev=503976r1=503975r2=503976
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Mon Feb  5 20:31:48 2007
@@ -12,6 +12,13 @@
 
 =item 2.0.4-dev
 
+fix ModPerl::RegistryCooker::read_script to handle all possible
+errors, previously there was a case where Apache2::Const::OK was
+returned on an error.  [Eivind Eklund [EMAIL PROTECTED]]
+
+a minor compilation warning resolved in modperl_handler_new_from_sv
+[Stas]
+
 a minor compilation warning resolved in modperl_gtop_size_string
 [Stas]
 

Modified: perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm?view=diffrev=503976r1=503975r2=503976
==
--- perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm (original)
+++ perl/modperl/trunk/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Mon Feb  
5 20:31:48 2007
@@ -546,9 +546,8 @@
 return Apache2::Const::FORBIDDEN if APR::Status::is_EACCES($@);
 return Apache2::Const::NOT_FOUND if APR::Status::is_ENOENT($@);
 }
-else {
-return Apache2::Const::SERVER_ERROR;
-}
+
+return Apache2::Const::SERVER_ERROR;
 }
 
 return Apache2::Const::OK;




svn commit: r483625 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_gtop.c

2006-12-07 Thread stas
Author: stas
Date: Thu Dec  7 11:27:58 2006
New Revision: 483625

URL: http://svn.apache.org/viewvc?view=revrev=483625
Log:
a minor compilation warning resolved in modperl_gtop_size_string


Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/src/modules/perl/modperl_gtop.c

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?view=diffrev=483625r1=483624r2=483625
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Thu Dec  7 11:27:58 2006
@@ -12,6 +12,9 @@
 
 =item 2.0.4-dev
 
+a minor compilation warning resolved in modperl_gtop_size_string
+[Stas]
+
 Prevent direct use of _deprecated_ Apache2::ReadConfig in
 Perl sections with httpd Alias directives from 
 incorrectly generating

Modified: perl/modperl/trunk/src/modules/perl/modperl_gtop.c
URL: 
http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_gtop.c?view=diffrev=483625r1=483624r2=483625
==
--- perl/modperl/trunk/src/modules/perl/modperl_gtop.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_gtop.c Thu Dec  7 11:27:58 2006
@@ -31,7 +31,7 @@
 }
 else if (size  1048576) {
 apr_snprintf(size_string, MP_GTOP_SSS, %dk,
- (size + 512) / 1024);
+ (int)(size + 512) / 1024);
 }
 else if (size  103809024) {
 apr_snprintf(size_string, MP_GTOP_SSS, %.1fM,
@@ -39,7 +39,7 @@
 }
 else {
 apr_snprintf(size_string, MP_GTOP_SSS, %dM,
- (size + 524288) / 1048576);
+ (int)(size + 524288) / 1048576);
 }
 
 return 1;




Re: SubRequest in Handler vs SubRequest in Filter - and Segmentation Fault

2006-07-07 Thread Stas Bekman

Scott Penrose wrote:
[...]

(gdb) bt
#0  0xb7bef73d in modperl_wbucket_flush (wb=0x0, add_flush_bucket=0)
at modperl_filter.c:236
#1  0xb7a7efaf in mpxs_ap_run_sub_req (r=0x84e1708) at  
Apache2__SubRequest.h:25
#2  0xb7a7f55b in XS_Apache2__SubRequest_run (cv=0x8351e78) at  
SubRequest.xs:83

#3  0xb7b30c68 in Perl_pp_entersub () from /usr/lib/libperl.so.1


Scott, please try this patch:

Index: xs/Apache2/SubRequest/Apache2__SubRequest.h
===
--- xs/Apache2/SubRequest/Apache2__SubRequest.h (revision 419996)
+++ xs/Apache2/SubRequest/Apache2__SubRequest.h (working copy)
@@ -20,7 +20,7 @@
  * output before anything already written in the main request
  */

-if (r-main) {
+if (r-main  rcfg-wbucket) {
 modperl_config_req_t *rcfg = modperl_config_req_get(r-main);
 MP_RUN_CROAK(modperl_wbucket_flush(rcfg-wbucket, FALSE),
  Apache2::SubRequest::run);



--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
MailChannels: Reliable Email Delivery http://mailchannels.com
The Practical mod_perl book http://modperlbook.org/
http://www.linkedin.com/in/stasbekman http://perl.apache.org/
http://stason.org/photos/gallery/ [* best photos here *]



Re: SubRequest in Handler vs SubRequest in Filter - and Segmentation Fault

2006-07-05 Thread Stas Bekman

Scott Penrose wrote:

On 05/07/2006, at 5:47, Stas Bekman wrote:

http://perl.apache.org/docs/2.0/user/handlers/ 
filters.html#HTTP_Request_vs__Connection_Filters



OK Some very weird and interesting problems here. I think they are  
bugs, but I am not certain.


Firstly - if you write the code... (straight from the example in the  
POD and URL above)


package MyApache2::FilterRequestFoo;
use base qw(Apache2::Filter);
sub output : FilterRequestHandler {
my ($f, $bb) = @_;
}
1;

You get this:
~/tmp$ perl -c test.pm
Invalid CODE attribute: FilterRequestHandler at test.pm line 4
BEGIN failed--compilation aborted at test.pm line 6.


You can't test mod_perl modules from the command line, Scott. Only running 
under a mod_perl interpreter.



--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
MailChannels: Reliable Email Delivery http://mailchannels.com
The Practical mod_perl book http://modperlbook.org/
http://www.linkedin.com/in/stasbekman http://perl.apache.org/
http://stason.org/photos/gallery/ [* best photos here *]



Re: SubRequest in Handler vs SubRequest in Filter - and Segmentation Fault

2006-07-04 Thread Stas Bekman

Scott Penrose wrote:
Is this a request or a connection filter? It won't work as a  
connection filter (r is not available there).



It is an ouptut filter.


But what output filter? There are two:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#HTTP_Request_vs__Connection_Filters


What's the core's backtrace?



I will generate this tomorrow (don't have access to the machine today).

Thanks

Scott

P.S. I have done a temporary work around which is to have standard  
Handler which provides the first call as a parameter, so it does a  
Subrequest on the first one, then does the expansion (more  
Subrequests). I have found this has not really worked the way I want,  
but it did allow me to move forward on my project a little.


cool

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
MailChannels: Reliable Email Delivery http://mailchannels.com
The Practical mod_perl book http://modperlbook.org/
http://www.linkedin.com/in/stasbekman http://perl.apache.org/
http://stason.org/photos/gallery/ [* best photos here *]



Re: SubRequest in Handler vs SubRequest in Filter - and Segmentation Fault

2006-07-04 Thread Stas Bekman

Scott Penrose wrote:

On 04/07/2006, at 20:53, Scott Penrose wrote:


On 04/07/2006, at 17:30, Stas Bekman wrote:


Scott Penrose wrote:

Is this a request or a connection filter? It won't work as a   
connection filter (r is not available there).


It is an ouptut filter.


But what output filter? There are two:
http://perl.apache.org/docs/2.0/user/handlers/ 
filters.html#HTTP_Request_vs__Connection_Filters



I just read this more carefully...

So mine is what ever the default is (I assume connection) - which is  
obviously suspicious. I will force it to be a FilterRequestHandler  
tomorrow and try again.


The default is Request, not Connection.

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
MailChannels: Reliable Email Delivery http://mailchannels.com
The Practical mod_perl book http://modperlbook.org/
http://www.linkedin.com/in/stasbekman http://perl.apache.org/
http://stason.org/photos/gallery/ [* best photos here *]



Re: SubRequest in Handler vs SubRequest in Filter - and Segmentation Fault

2006-07-02 Thread Stas Bekman

Scott Penrose wrote:

Hey Guys

I wrote a simple Filter which calls a subrequest - and started by  doing 
this very simply along the SSI style lines...


Please note - that although I could do this on the fly rather than  
buffer, the end result for my code requires capture of the content,  so 
just imagine that bit is correct :-)


sub filter {
...
... buffer content into $context-{buffer} ...

if ($f-seen_eos) {

my $buffer = $context-{buffer};

while ((my $i = index($buffer, EXPAND)) = 0) {
$f-print(substr($buffer, 0, $i));
$buffer = substr($buffer, $i + 6);

my $subr = $f-r-lookup_uri(/sub.html);
$subr-run();
}
$f-print($buffer);
}
...
}


The above code always segfaults. Now the first thing that came to  mind 
was that a $subr-run() would output by printing to stderr which  of 
course would not work in the filter. Therefore I changed the code,  
using the Apache2::TrapSubRequest module to...


Is this a request or a connection filter? It won't work as a connection 
filter (r is not available there).


What's the core's backtrace?

--
_
Stas Bekmanmailto:[EMAIL PROTECTED] http://stason.org/
MailChannels: Reliable Email Delivery http://mailchannels.com
The Practical mod_perl book http://modperlbook.org/
http://www.linkedin.com/in/stasbekman http://perl.apache.org/
http://stason.org/photos/gallery/ [* best photos here *]



Re: AppArmor - makes mod_perl/mod_php safer on linux

2006-04-10 Thread Stas Bekman

Clinton Gormley wrote:

On Sun, 2006-04-09 at 13:45 -0400, Jonathan Vanasco wrote:


On Apr 9, 2006, at 5:02 AM, Kevin A. McGrail wrote:



I'm under the impression that this is the same as SELinux
(http://www.nsa.gov/selinux/info/faq.cfm)


SELinux is at the kernel level + a few libraries, and from what i  
read appArmor is just a library



No, appArmor plugs into the kernel via LSM (Linux Security Modules),
which SELinux uses as well. It is really impressive. Have a look at this
demo (272 meg of video!)
ftp://ftp.belnet.be/pub/mirror/FOSDEM/FOSDEM2006-apparmor.avi

It is easy to configure, adds little overhead, and allows you to build
security profiles on the fly.  Also, it adopts the
deny-all/allow-required approach, rather then allow-all,
deny-this-that-and-the-other-thing.

Also, (and I forgot the details) but I'm pretty sure it allows you to
separate permissions for different perl scripts running under mod-perl.


according to the presenter -- it does.


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



FYI: AppArmor - makes mod_perl/mod_php safer on linux

2006-04-07 Thread Stas Bekman
I was just at cansecwest (http://cansecwest.com/) here in Vancouver, and 
went to a talk by Crispin Cowan from Novell. He presented AppArmor which 
confines the application into a restricted mode (which files it can access 
and what it can and cannot do). Unlike jail/chroot AppArmor allows you to 
provide different profiles per script, so it might be very useful to ISPs 
which need to protect one user from another. It works as a linux security 
module (LSM) so there is very little overhead and no need to patch your 
kernel.


I haven't used it myself, but I think some of the mod_perl users can 
benefit from it. I don't know why Novell folks didn't announce it to this 
list.


more info at:
http://www.novell.com/products/apparmor/
http://www.novell.com/documentation/apparmor/
mod_perl is specifically mentioned on page 4 at:
http://www.novell.com/collateral/4821055/4821055.pdf

--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



svn commit: r386498 - in /perl/modperl/trunk: Changes lib/ModPerl/BuildMM.pm xs/APR/APR/Makefile.PL

2006-03-16 Thread stas
Author: stas
Date: Thu Mar 16 16:40:43 2006
New Revision: 386498

URL: http://svn.apache.org/viewcvs?rev=386498view=rev
Log:
Make sure that LIBS and other MakeMaker command line flags are not
ignored by the top level Makefile.PL and xs/APR/APR/Makefile.PL

Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/lib/ModPerl/BuildMM.pm
perl/modperl/trunk/xs/APR/APR/Makefile.PL

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=386498r1=386497r2=386498view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Thu Mar 16 16:40:43 2006
@@ -12,6 +12,9 @@
 
 =item 2.0.3-dev
 
+Make sure that LIBS and other MakeMaker command line flags are not
+ignored by the top level Makefile.PL and xs/APR/APR/Makefile.PL [Stas]
+
 Corrected a typo that would cause the corruption of $), the
 effective group id as Perl sees it [Gozer]
 

Modified: perl/modperl/trunk/lib/ModPerl/BuildMM.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/ModPerl/BuildMM.pm?rev=386498r1=386497r2=386498view=diff
==
--- perl/modperl/trunk/lib/ModPerl/BuildMM.pm (original)
+++ perl/modperl/trunk/lib/ModPerl/BuildMM.pm Thu Mar 16 16:40:43 2006
@@ -75,7 +75,9 @@
 $build ||= build_config();
 ModPerl::MM::my_import(__PACKAGE__);
 
-my $inc = $build-inc;
+my $inc;
+$inc = $args{INC} if $args{INC};
+$inc =   . $build-inc;
 if (my $glue_inc = $build-{MP_XS_GLUE_DIR}) {
 for (split /\s+/, $glue_inc) {
 $inc .=  -I$_;
@@ -84,6 +86,7 @@
 
 my $libs;
 my @libs = ();
+push @libs, $args{LIBS} if $args{LIBS};
 if (Apache2::Build::BUILD_APREXT) {
 # in order to decouple APR/APR::* from mod_perl.so,
 # link these modules against the static MP_APR_LIB lib,
@@ -105,18 +108,33 @@
 }
 $libs = join ' ', @libs;
 
-my $ccflags = $build-perl_ccopts . $build-ap_ccopts;
+my $ccflags;
+$ccflags = $args{CCFLAGS} if $args{CCFLAGS};
+$ccflags =   . $build-perl_ccopts . $build-ap_ccopts;
+
+my $optimize;
+$optimize = $args{OPTIMIZE} if $args{OPTIMIZE};
+$optimize =   . $build-perl_config('optimize');
+
+my $lddlflags;
+$lddlflags = $args{LDDLFLAGS} if $args{LDDLFLAGS};
+$lddlflags =   . $build-perl_config('lddlflags');
+
+my %dynamic_lib;
+%dynamic_lib = %{ $args{dynamic_lib}||{} } if $args{dynamic_lib};
+$dynamic_lib{OTHERLDFLAGS} = $build-otherldflags;
 
 my @opts = (
-INC   = $inc,
-CCFLAGS   = $ccflags,
-OPTIMIZE  = $build-perl_config('optimize'),
-LDDLFLAGS = $build-perl_config('lddlflags'),
-LIBS  = $libs,
-dynamic_lib = { OTHERLDFLAGS = $build-otherldflags },
+INC = $inc,
+CCFLAGS = $ccflags,
+OPTIMIZE= $optimize,
+LDDLFLAGS   = $lddlflags,
+LIBS= $libs,
+dynamic_lib = \%dynamic_lib,
 );
 
 my @typemaps;
+push @typemaps, $args{TYPEMAPS} if $args{TYPEMAPS};
 my $pwd = Cwd::fastcwd();
 for ('xs', $pwd, $pwd/..) {
 my $typemap = $build-file_path($_/typemap);

Modified: perl/modperl/trunk/xs/APR/APR/Makefile.PL
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/APR/Makefile.PL?rev=386498r1=386497r2=386498view=diff
==
--- perl/modperl/trunk/xs/APR/APR/Makefile.PL (original)
+++ perl/modperl/trunk/xs/APR/APR/Makefile.PL Thu Mar 16 16:40:43 2006
@@ -13,12 +13,16 @@
 use constant SOLARIS = $^O eq 'solaris';
 use constant BUILD_APREXT   = Apache2::Build::BUILD_APREXT;
 
-my %args = (
-'NAME' = 'APR',
-'VERSION_FROM' = 'APR.pm',
-);
+my %args;
+
+%args = map { split /=/, $_ } @ARGV;
+
+$args{NAME} = 'APR';
+$args{VERSION_FROM} = 'APR.pm';
 
 my $libs = '';
+$libs = delete $args{LIBS} if $args{LIBS};
+
 my $build = ModPerl::BuildMM::build_config();
 
 my @apru_link_flags = $build-apru_link_flags;
@@ -53,7 +57,9 @@
 
 # -R makes sure that these paths will be used
 $extralddflags =~ s{-L(\S+)}{-L$1 -R$1}g;
-$args{LDDLFLAGS} = $extralddflags .   . $build-perl_config('lddlflags');
+$args{LDDLFLAGS} =  unless exists $args{LDDLFLAGS};
+$args{LDDLFLAGS} = join  , $args{LDDLFLAGS}, $extralddflags,
+$build-perl_config('lddlflags');
 
 # -R are now copied to LDDFLAGS, but leave -L's in LIBS --
 # EU::MM needs it.




svn commit: r381784 - /perl/modperl/trunk/build/svn.remerge

2006-02-28 Thread stas
Author: stas
Date: Tue Feb 28 13:16:27 2006
New Revision: 381784

URL: http://svn.apache.org/viewcvs?rev=381784view=rev
Log:
make the script more portable: sed parts didn't work on Solaris 9, use perl 
instead

Modified:
perl/modperl/trunk/build/svn.remerge

Modified: perl/modperl/trunk/build/svn.remerge
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/build/svn.remerge?rev=381784r1=381783r2=381784view=diff
==
--- perl/modperl/trunk/build/svn.remerge (original)
+++ perl/modperl/trunk/build/svn.remerge Tue Feb 28 13:16:27 2006
@@ -1,14 +1,18 @@
 #!/bin/bash
 # automatic SVN merging
+#
+# when used for the first time, first run:
+#  svn propset merge-point $revision
+# where $revision is the rev number when a branch was made
 
-root=`svn info . | sed -n '/^URL/{s,/branches/.*,,;s/^URL: //;p}'`
+root=`svn info . | perl -007 -ne 'm|URL: (.*?)/branches|s and print $1'`
 trunk=${root}/trunk
 
 # svn 1.2.x supports svn info URL.  Without that, a stupid
 # ls command is needed to find the current revision of the trunk
 #next=`svn info $trunk | sed -n '/^Revision: /{s/.*: //g;p}'`
 
-next=`svn ls --verbose $root | sed -n '/ trunk/{s/^ *//g;s/ .*//g;p}'`
+next=`svn ls --verbose $root | perl -ne 'm|^\s+(\d+).*trunk/$| and print $1'`
 last=`svn propget merge-point .`
 
 echo $0: merging from trunk from r$last to r$next




Re: Syntax issue in Apache/TestConfig.pm TestUtil.pm

2006-02-23 Thread Stas Bekman

William A. Rowe, Jr. wrote:
[...]

$Config{sh}, $Config{perlpath}, and $Config{perl} comes from -this- 
perl, right?


right

#/usr/bin/perl is a hardcode to an arbitrary perl installed at that 
location.


What I'm trying (failing?) to point out is that on BSD and other 
platforms, if
they have a bug, they can munge *PERL*, not ApacheTest, not each and 
every perl
script which creates perl files, with an effective value of 
$Config{startperl}.


What you are missing Bill, is that there is no bug in perl or perl 
installation. It's a shell limitation documented here:


# see: http://en.wikipedia.org/wiki/Shebang
# http://homepages.cwi.nl/~aeb/std/shebang/

Hence the workaround was added.

I don't have a BSD box in front of me; but if ApacheTest used 
$Config{startperl}

rather than all of this other mechanics, then it would be up to BSD folks
to help the entire Perl community by fixing this ONCE with MakeMaker, 
and be
done with it.  By messing with constructing what MakeMaker's done since 
5.0005

we are putting more work on ourselves, no?


I think there are two somewhat unrelated issues that are being discussed 
here -


1) using $Config{startperl} vs $Config{perlpath},

2) the issue with shebang code generation

I think Geoff is thinking that Bill is suggesting to tackle #1, whereas 
Bill is only talking about #2.



Bill, mind to post a patch of what you think should work?


Yes, revert this patch, and replace these lines with = $Config{startperl}.
When I have a clean patch against head I'll post it.  I'll also look at the
state of MakeMaker to see if this issue -was- addressed there.





--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: Syntax issue in Apache/TestConfig.pm TestUtil.pm

2006-02-22 Thread Stas Bekman

Geoffrey Young wrote:


William A. Rowe, Jr. wrote:


Both lib/Apache/TestConfig.pm and lib/Apache/TestUtil.pm twist off their
own shebang lines from $Config{perlpath}, which is wrong.



I think part of this stems from this

  http://www.gossamer-threads.com/lists/modperl/dev/86017


Mike's patch used the original $Config{perlpath}, so no change there.


They should simply pull $Config{startperl} which defines the
shebang/command
on a platform basis.  See startperl= assignment from Config.pm.


You mean using $Config{startperl} instead of the hardcoded #!/usr/bin/perl 
 when the path is too long? I think that value makes no difference. At 
least not according to these resources:


# see: http://en.wikipedia.org/wiki/Shebang
# http://homepages.cwi.nl/~aeb/std/shebang/

If you have better ideas that would be wonderful :)


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: [mp2] make test errors (failed to start server) with mp 2.0.2

2006-02-01 Thread Stas Bekman

Bennett Haselton wrote:
[...]
still waiting for server to warm up: 
... 


the server is down, giving up after 121 secs
[  error] failed to start server! (please examine t/logs/error_log)


[Tue Jan 31 16:32:07 2006] [notice] suEXEC mechanism enabled (wrapper: 
/usr/sbin/suexec)

END in modperl_extra.pl, pid=23711
[Tue Jan 31 16:32:12 2006] [notice] Digest: generating secret for digest 
authentication ...

[...]

Perhaps you hit the insufficient entropy problem?
http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#Server_Hanging_at_the_Startup

I think that this is the case, thanks to your sentence:

This time, make test produced so much output that it went past the 
buffer of my telnet application, but the last output that it gave me was 
this: 


where you've mentioned telnet. Usually when you type at the local 
keyboard you generate the entropy for the random device, when you connect 
from a different machine, there is no physical input to accomplish that.


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



svn commit: r370270 - in /perl/modperl/trunk: Changes t/response/TestApache/daemon.pm xs/Apache2/ServerUtil/Apache2__ServerUtil.h xs/maps/modperl_functions.map

2006-01-18 Thread stas
Author: stas
Date: Wed Jan 18 13:47:36 2006
New Revision: 370270

URL: http://svn.apache.org/viewcvs?rev=370270view=rev
Log:
Add perl API corresponding to User and Group directives in httpd.conf: 
Apache2::ServerUtil-user_id and Apache2::ServerUtil-group_id

Added:
perl/modperl/trunk/t/response/TestApache/daemon.pm   (with props)
Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
perl/modperl/trunk/xs/maps/modperl_functions.map

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=370270r1=370269r2=370270view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed Jan 18 13:47:36 2006
@@ -12,6 +12,10 @@
 
 =item 2.0.3-dev
 
+Add perl API corresponding to User and Group directives in httpd.conf: 
+Apache2::ServerUtil-user_id and Apache2::ServerUtil-group_id
+[Stas]
+
 Apache2::Reload now first unloads all modified modules before
 trying to reload them. This way, inter-module dependencies
 are more likely to be correctly satisfied when reloaded

Added: perl/modperl/trunk/t/response/TestApache/daemon.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestApache/daemon.pm?rev=370270view=auto
==
--- perl/modperl/trunk/t/response/TestApache/daemon.pm (added)
+++ perl/modperl/trunk/t/response/TestApache/daemon.pm Wed Jan 18 13:47:36 2006
@@ -0,0 +1,39 @@
+package TestApache::daemon;
+
+# Apache2::ServerUtil tests
+
+use strict;
+use warnings FATAL = 'all';
+
+use Apache2::ServerUtil ();
+
+use Apache::TestConfig ();
+use Apache::TestUtil;
+use Apache::Test;
+
+use constant WIN32 = Apache::TestConfig::WIN32 || Apache::TestConfig::CYGWIN;
+
+use Apache2::Const -compile = 'OK';
+
+sub handler {
+my $r = shift;
+
+plan $r, tests = 2;
+
+my $user_id = Apache2::ServerUtil-user_id;
+my $user_id_expected = WIN32 ? 0 : $;
+
+ok t_cmp $user_id, $user_id_expected, user id;
+
+my $group_id = Apache2::ServerUtil-group_id;
+my ($group_id_expected) = WIN32 ? 0 : ($( =~ /^(\d+)/);
+
+ok t_cmp $group_id, $group_id_expected, group id;
+
+Apache2::Const::OK;
+}
+
+1;
+
+__END__
+

Propchange: perl/modperl/trunk/t/response/TestApache/daemon.pm
--
svn:eol-style = native

Modified: perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h?rev=370270r1=370269r2=370270view=diff
==
--- perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h (original)
+++ perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h Wed Jan 18 
13:47:36 2006
@@ -13,6 +13,10 @@
  * limitations under the License.
  */
 
+#if !defined(OS2)  !defined(WIN32)  !defined(BEOS)   !defined(NETWARE)
+#include unixd.h
+#endif
+
 #define mpxs_Apache2__ServerUtil_restart_count modperl_restart_count
 
 #define mpxs_Apache2__ServerRec_method_register(s, methname) \
@@ -150,6 +154,14 @@
 modperl_dir_config(aTHX_ NULL, s, key, sv_val)
 
 #define mpxs_Apache2__ServerUtil_server(classname) 
modperl_global_get_server_rec()
+
+#if !defined(OS2)  !defined(WIN32)  !defined(BEOS)   !defined(NETWARE)
+#define mpxs_Apache2__ServerUtil_user_id(classname)  unixd_config.user_id
+#define mpxs_Apache2__ServerUtil_group_id(classname) unixd_config.group_id
+#else
+#define mpxs_Apache2__ServerUtil_user_id(classname)  0
+#define mpxs_Apache2__ServerUtil_group_id(classname) 0
+#endif
 
 static MP_INLINE
 int mpxs_Apache2__ServerRec_is_perl_option_enabled(pTHX_ server_rec *s,

Modified: perl/modperl/trunk/xs/maps/modperl_functions.map
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/modperl_functions.map?rev=370270r1=370269r2=370270view=diff
==
--- perl/modperl/trunk/xs/maps/modperl_functions.map (original)
+++ perl/modperl/trunk/xs/maps/modperl_functions.map Wed Jan 18 13:47:36 2006
@@ -87,6 +87,8 @@
 
 MODULE=Apache2::ServerUtil   PACKAGE=Apache2::ServerUtil
  server_rec *:DEFINE_server | | SV *:classname=Nullsv
+ uid_t:DEFINE_user_id   | | SV *:classname=Nullsv
+ gid_t:DEFINE_group_id  | | SV *:classname=Nullsv
 
 MODULE=Apache2::Connection
  mpxs_Apache2__Connection_client_socket | | c, s=NULL




Re: Bug report: ModPerl 2.0.2 make test Insecure directory under -T

2005-12-23 Thread Stas Bekman

Kent, Mr. John (Contractor) wrote:

Hello Stas,

No, my path does not contain . or .. anywhere.
Here is what I get:

[EMAIL PROTECTED] ~]$ perl -le 'print $ENV{PATH}'
/users/webuser/perl/bin:/users/webuser/apache-ant/bin:users/webuser/netscape:/users/webuser/mysql/bin:/users/webuser/jdev/bin:/users/webuser/tomcat/bin:/users/webuser/jdk/bin:/users/webuser/ImageMagick/bin:/users/webuser/delegates/bin:/users/webuser/delegates/freestyle2/bin:/users/webuser/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/users/webuser/bin

HOWEVER, looking at how complicated the above was I simplified my PATH to

/users/webuser/perl/bin:/users/webuser/ImageMagick/bin:/users/webuser/delegates/bin:/users/webuser/delegates/freestyle2/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/users/webuser/bin

and the tests worked without problem.

Adding back directories revealed the problem was with :users/webuser/netscape
which did not exist.


Ah, good catch! We were taking care of removing . and .., but weren't 
aware that a relative path without . or .. is a problem too:


% perl -Tle '$ENV{PATH} = foo/bar; system(date)'
Insecure directory in $ENV{PATH} while running with -T switch at -e line 1.

I'll patch Apache-Test to handle that case as well.


Sorry for bothering you and the list.
Thank you for your reply which did result in solving the problem.

Happy Holidays!


You too!



--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: Apache2::Status memory usage fails

2005-12-23 Thread Stas Bekman

Francesc Guasch wrote:

Hi. I have a leak somewhere and I'm trying to find it
using Apache2::Status. Individual usage of memory in
the packages and functions doesn't grow, and I'm unable
to use the memory usage of Apache2::Status, so I can
see further.


Francesc, try to bracket your handlers for memory usage using this approach:
http://svn.apache.org/viewcvs.cgi/perl/modperl/trunk/t/lib/TestCommon/MemoryLeak.pm?view=markup

[...]

I get this with Gtop:

  Process 19994
start  100reqs 100reqsmore
shared: 11656   11656   11656
size:   33892   54140   73804
rss:27756   40456   52316


You also need to be aware that shared memory reporting on linux 2.6 kernel 
is invalid. I don't know if it was fixed in the most recent kernel releases.



--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: mp2 Apache won't start under ssh

2005-12-23 Thread Stas Bekman

Helmut Zeilinger wrote:

Hi all,

Apache with mod_perl starts and stops normaly from
a linux console.

Commands:

/usr/sbin/apache2 -k start
/usr/sbin/apache2 -k stop

But when i am logged in in the system by ssh from a remote host  (as root)
the second start/stop-cycle fails = the apache process seems to hang.
The problem does not occure by doing ssh localhost.

The pstree command shows no apache child processes.
I have to kill the hanging apache2 process manually.

An initial (1.) start succeeds, but no further starts are possible.

When i try to do this without mod_perl - by commenting out
..
LoadModule perl_modulemodules/mod_perl.so
..
- everything is normal again.
(I removed  all other Perl related directives from the httpd.conf file.)

The Apache error log file provides no information concerning this
problem.


Sounds like a lack of entropy, since you aren't typing on the local keyboard:
http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#Server_Hanging_at_the_Startup


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: Bug report: ModPerl 2.0.2 make test Insecure directory under -T

2005-12-22 Thread Stas Bekman

Kent, Mr. John (Contractor) wrote:

Here is mybugreport:

-8-- Start Bug Report 8--
1. Problem Description:

  [DESCRIBE THE PROBLEM HERE]

When running make test
Get the following errror
[Thu Dec 22 09:28:15 2005] [info] base server + 27 vhosts ready to run tests
[Thu Dec 22 09:28:16 2005] [error] Insecure directory in $ENV{PATH} while 
running with -T switch at 
/users/webuser/src/mod_perl-2.0.2/Apache-Test/lib/Apache/TestConfig.pm line 
1076.\nCompilation failed in require at 
/users/webuser/src/mod_perl-2.0.2/t/conf/modperl_startup.pl line 
17.\n\t...propagated at 
/users/webuser/src/mod_perl-2.0.2/t/conf/modperl_startup.pl line 18.\nBEGIN 
failed--compilation aborted at 
/users/webuser/src/mod_perl-2.0.2/t/conf/modperl_startup.pl line 
20.\nCompilation failed in require at (eval 2) line 1.\n
[Thu Dec 22 09:28:16 2005] [error] Can't load Perl file: 
/users/webuser/src/mod_perl-2.0.2/t/conf/modperl_startup.pl for server 
localhost.localdomain:8529, exiting...
[  error] 
server has died with status 255 (t/logs/error_log wasn't created, start the server in the debug mode)

sh: line 1: 11737 Terminated  /users/webuser/perl.5.8.7/bin/perl 
/users/webuser/src/mod_perl-2.0.2/t/TEST -bugreport -verbose=0
make: *** [run_tests] Error 143


Check your PATH env var, John.

perl -le 'print $ENV{PATH}'

does it contain .., . or similar?

--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: go crazy with me

2005-12-19 Thread Stas Bekman

JT Smith wrote:
Yup, I've actually already done it that way with both 
Parallel::ForkManager in one instance and Proc::Queue as an alternative. 
I added in event handling with both Event and Event::Lib as seperate 
trials. All those implementations were relatively easy to do. But the 
question becomes, why? If everything else is running in Apache, why 
start a seperate service to run these tasks? And again, I said I want to 
go crazy. Let's not figure out how else we could do that (I already know 
that), but how could we do it using Apache?


Here at mailchannels.com we have first used mp2 to handle the email 
traffic shaping entirely inside mod_perl2, but the nature of our product 
is so different from serving HTTP, it just won't scale (mostly 
memory-wise, but also too many processes). We have now switched to having 
Event::Lib (over libevent) doing all the non-blocking IO and using mp2's 
protocol handler to do blocking IO (like network-bound operations). The 
performance is just amazing, hardly any memory used and we can easily 
handle a thousand concurrent connections on very low-end hardware.


Switching to event based flow was a challenge, since you no longer have 
the normal logic flow. But we have written a few abstraction layers and 
now it's almost easy. We are planning to release our AsyncIO abstraction 
module on CPAN once we have some spare resources.


I highly recommend Event::Lib, at least for its wonderful maintainer: 
Tassilo von Parseval, who's a great perl/C/XS expert and who is resolving 
any problems with Event::Lib almost as soon as we are posting the bug 
reports. I wish more CPAN authors were as responsive as Tassilo is :)


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: go crazy with me

2005-12-19 Thread Stas Bekman

Foo Ji-Haw wrote:

Just went to your company web site and read that you got the White Camel
award. Congrats, both on the award and your new career!


Thanks for the kind words, Foo!


We're talking to the Director of Development here guys... :)


Hehe, don't let titles mislead you :)

BTW, we are always looking for bright people to join our team. So if you 
want to work in a fun team, have challenging projects and like Vancouver, 
BC drop me a note!



Here at mailchannels.com we have first used mp2 to handle the email
traffic shaping entirely inside mod_perl2, but the nature of our product
is so different from serving HTTP, it just won't scale (mostly
memory-wise, but also too many processes). We have now switched to having
Event::Lib (over libevent) doing all the non-blocking IO and using mp2's
protocol handler to do blocking IO (like network-bound operations). The
performance is just amazing, hardly any memory used and we can easily
handle a thousand concurrent connections on very low-end hardware.

Switching to event based flow was a challenge, since you no longer have
the normal logic flow. But we have written a few abstraction layers and
now it's almost easy. We are planning to release our AsyncIO abstraction
module on CPAN once we have some spare resources.

I highly recommend Event::Lib, at least for its wonderful maintainer:
Tassilo von Parseval, who's a great perl/C/XS expert and who is resolving
any problems with Event::Lib almost as soon as we are posting the bug
reports. I wish more CPAN authors were as responsive as Tassilo is :)


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



svn commit: r348394 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_io.c

2005-11-22 Thread stas
Author: stas
Date: Tue Nov 22 23:35:34 2005
New Revision: 348394

URL: http://svn.apache.org/viewcvs?rev=348394view=rev
Log:
Perl_do_open/close fixes to make mod_perl 2.0 compile with
[EMAIL PROTECTED]

Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/src/modules/perl/modperl_io.c

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=348394r1=348393r2=348394view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Tue Nov 22 23:35:34 2005
@@ -12,6 +12,9 @@
 
 =item 2.0.3-dev
 
+Perl_do_open/close fixes to make mod_perl 2.0 compile with
[EMAIL PROTECTED] (5.9.3+) [Stas]
+
 Added Apache2::PerlSections-server, returning the server
 into which the Perl section is defined [Gozer]
 

Modified: perl/modperl/trunk/src/modules/perl/modperl_io.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_io.c?rev=348394r1=348393r2=348394view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_io.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_io.c Tue Nov 22 23:35:34 2005
@@ -121,8 +121,8 @@
  TRUE, SVt_PVIO);
 
 /* open my $oldout, STDIN or die Can't dup STDIN: $!; */
-status = Perl_do_open(aTHX_ handle_save, STDIN, 7, FALSE,
-  O_RDONLY, 0, Nullfp);
+status = do_open(handle_save, STDIN, 7, FALSE,
+ O_RDONLY, 0, Nullfp);
 if (status == 0) {
 Perl_croak(aTHX_ Failed to dup STDIN: % SVf, get_sv(!, TRUE));
 }
@@ -130,12 +130,12 @@
 /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't
  * have file descriptors, so STDIN must be closed before it can
  * be reopened */
-Perl_do_close(aTHX_ handle, TRUE);
+do_close(handle, TRUE);
 }
 
 sv_setref_pv(sv, Apache2::RequestRec, (void*)r);
-status = Perl_do_open9(aTHX_ handle, :Apache2, 9, FALSE, O_RDONLY,
-   0, Nullfp, sv, 1);
+status = do_open9(handle, :Apache2, 9, FALSE, O_RDONLY,
+  0, Nullfp, sv, 1);
 if (status == 0) {
 Perl_croak(aTHX_ Failed to open STDIN: % SVf, get_sv(!, TRUE));
 }
@@ -164,8 +164,8 @@
  TRUE, SVt_PVIO);
 
 /* open my $oldout, STDOUT or die Can't dup STDOUT: $!; */
-status = Perl_do_open(aTHX_ handle_save, STDOUT, 8, FALSE,
-  O_WRONLY, 0, Nullfp);
+status = do_open(handle_save, STDOUT, 8, FALSE,
+ O_WRONLY, 0, Nullfp);
 if (status == 0) {
 Perl_croak(aTHX_ Failed to dup STDOUT: % SVf, get_sv(!, TRUE));
 }
@@ -173,12 +173,12 @@
 /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't
  * have file descriptors, so STDOUT must be closed before it can
  * be reopened */
-Perl_do_close(aTHX_ handle, TRUE);
+do_close(handle, TRUE);
 }
 
 sv_setref_pv(sv, Apache2::RequestRec, (void*)r);
-status = Perl_do_open9(aTHX_ handle, :Apache2, 9, FALSE, O_WRONLY,
-   0, Nullfp, sv, 1);
+status = do_open9(handle, :Apache2, 9, FALSE, O_WRONLY,
+  0, Nullfp, sv, 1);
 if (status == 0) {
 Perl_croak(aTHX_ Failed to open STDOUT: % SVf, get_sv(!, TRUE));
 }
@@ -200,7 +200,7 @@
 MP_TRACE_o(MP_FUNC, start);
 
 /* close the overriding filehandle */
-Perl_do_close(aTHX_ handle_orig, FALSE);
+do_close(handle_orig, FALSE);
 
 /*
  * open STDIN, STDIN_SAVED or die Can't dup STDIN_SAVED: $!;
@@ -211,12 +211,12 @@
 
 MP_TRACE_o(MP_FUNC, restoring STDIN);
 
-if (Perl_do_open9(aTHX_ handle_orig, , 2, FALSE,
-  O_RDONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
+if (do_open9(handle_orig, , 2, FALSE,
+ O_RDONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
 err = get_sv(!, TRUE);
 }
 
-Perl_do_close(aTHX_ handle, FALSE);
+do_close(handle, FALSE);
 (void)hv_delete(gv_stashpv(Apache2::RequestIO, TRUE), 
 GvNAME(handle), GvNAMELEN(handle), G_DISCARD);
 
@@ -247,7 +247,7 @@
 }
 
 /* close the overriding filehandle */
-Perl_do_close(aTHX_ handle_orig, FALSE);
+do_close(handle_orig, FALSE);
 
 /*
  * open STDOUT, STDOUT_SAVED or die Can't dup STDOUT_SAVED: $!;
@@ -258,12 +258,12 @@
 
 MP_TRACE_o(MP_FUNC, restoring STDOUT);
 
-if (Perl_do_open9(aTHX_ handle_orig, , 2, FALSE,
-  O_WRONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
+if (do_open9(handle_orig, , 2, FALSE,
+ O_WRONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
 err = get_sv(!, TRUE

Re: Testing problem

2005-11-13 Thread Stas Bekman

Brenda Washington wrote:
I'm getting this error message when I run a t/TEST.  Does anyone know why I'm getting this error? 




Starting program: /usr/local/apache2/bin/httpd -D ONE_PROCESS -d 
/opt/apache/mod_perl-2.0.1/t -f /opt/apache/mod_perl-2.0.1/t/conf/httpd.conf -D 
APACHE2
[Thu Nov 10 14:29:53 2005] [info] 6 Apache2:: modules loaded
[Thu Nov 10 14:29:53 2005] [info] 0 APR:: modules loaded
[Thu Nov 10 14:29:53 2005] [info] base server + 27 vhosts ready to run tests
[Thu Nov 10 14:30:02 2005] [error] Insecure directory in $ENV{PATH} while 
running with -T switch at 
/opt/apache/mod_perl-2.0.1/Apache-Test/lib/Apache/TestConfig.pm line 
1059.\nCompilation failed in require at 
/opt/apache/mod_perl-2.0.1/t/conf/modperl_startup.pl line 17.\n\t...propagated 
at /opt/apache/mod_perl-2.0.1/t/conf/modperl_startup.pl line 18.\nBEGIN 
failed--compilation aborted at 
/opt/apache/mod_perl-2.0.1/t/conf/modperl_startup.pl line 20.\nCompilation 
failed in require at (eval 2) line 1.\n


Brenda, can you please send the output of:

% perl -le 'print $ENV{PATH}'

most likely you have a . or .. in it, which would explain the problem.

Meanwhile try to explicitly set it:

env PATH=/bin:/usr/bin t/TEST

adjust PATH to include what you need. if you run under bash shell you 
don't need the 'env' part.


--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: TZ variable and mod_perl

2005-10-31 Thread Stas Bekman

Balázs Szabó (dLux) wrote:

Hi,

I am the author of the Class::Date module, which can be found in CPAN,
and i had a complaint about timezone handling in perl.

I tried to debug it, and I have found that mod_perl uses the TZ
environment somehow differently.

What I did in my module is the following:

delete $ENV{TZ};
tzset();
($a, $b) = tzname();

$a should contain the local timezone (according to the documentation of
the tzset manual), although it is UTC always. What I suspect is that
when I delete the TZ variable from the environment, it does not really
delete it.

How I can make sure that this variable is deleted?


http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#C_Libraries_Don_t_See_C__ENV__Entries_Set_by_Perl_Code



--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: [RELEASE CANDIDATE] mod_perl-2.0.2 RC1

2005-10-12 Thread Stas Bekman

Christopher H. Laco wrote:

Stas Bekman wrote:


Philip M. Gollucci wrote:



A release candidate for mod_perl 2.0.2 is now available for testing.

Please grab the candidate from

http://people.apache.org/~pgollucci/mp2/mod_perl-2.0.2-dev.tar.gz



+1, tested with 43 different apaches/perls configs on linux.




Were any of those perl 5.8.4, Apache 2.0.53 under Ubuntu by chance?


Those were only against 2.0.55-dev. I will add 2.0.53 and 2.0.54 to the 
list of tests and run those tonight.


and it's on Mandriva.

--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: [RELEASE CANDIDATE] mod_perl-2.0.2 RC1

2005-10-12 Thread Stas Bekman

Randy Kobes wrote:

On Wed, 12 Oct 2005, Christopher H. Laco wrote:


Philip M. Gollucci wrote:


[ ... ]


The other test is because the executable name doesn't match.
Randy committed Steve's patch for this and this will be in RC2 and 2.0.2
release.
t/directive/perldo.t   161   6.25%  12
# testing : $0
# expected: (?-xism:httpd)
# received: /usr/sbin/apache2
not ok 12



Cool!



Actually, I think the above failure requires a further
patch - the one I committed was to allow for Apache.exe
to be the name of the binary, but apparently for this
one also has to accept apache2 as the name. The
following diff from the current svn should work:

=
Index: t/response/TestDirective/perldo.pm
===
--- t/response/TestDirective/perldo.pm(revision 315047)
+++ t/response/TestDirective/perldo.pm(working copy)
@@ -40,7 +40,7 @@
 ok $TestDirective::perl::line  3;

 ok !t_cmp($0, '-e', '$0');
-ok t_cmp($0, qr/httpd|apache\.exe/i, '$0');
+ok t_cmp($0, qr/httpd|apache\.exe|apache2/i, '$0');

 ok t_cmp($TestDirective::perl::Included, 1, Include);




shouldn't it be:

Index: t/response/TestDirective/perldo.pm
===
--- t/response/TestDirective/perldo.pm  (revision 312991)
+++ t/response/TestDirective/perldo.pm  (working copy)
@@ -40,7 +40,8 @@
 ok $TestDirective::perl::line  3;

 ok !t_cmp($0, '-e', '$0');
-ok t_cmp($0, qr/httpd|apache\.exe/i, '$0');
+my $target = Apache::Test::vars('target');
+ok t_cmp($0, qr/$target/i, '$0');

 ok t_cmp($TestDirective::perl::Included, 1, Include);

target is the name of the httpd executable and it can be changed from the 
command line:


t/TEST -target=http2005d

in which case the hardcoded test will break :)

--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



Re: [RELEASE CANDIDATE] mod_perl-2.0.2 RC1

2005-10-12 Thread Stas Bekman

Stas Bekman wrote:

Christopher H. Laco wrote:


Stas Bekman wrote:


Philip M. Gollucci wrote:



A release candidate for mod_perl 2.0.2 is now available for testing.

Please grab the candidate from

http://people.apache.org/~pgollucci/mp2/mod_perl-2.0.2-dev.tar.gz




+1, tested with 43 different apaches/perls configs on linux.




Were any of those perl 5.8.4, Apache 2.0.53 under Ubuntu by chance?



Those were only against 2.0.55-dev. I will add 2.0.53 and 2.0.54 to the 
list of tests and run those tonight.


I have now run those (2.0.49 - 2.0.54 / prefork|worker) and it's all good.

--
_
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The Practical mod_perl book   http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/



svn commit: r293474 - /perl/modperl/trunk/Makefile.PL

2005-10-03 Thread stas
Author: stas
Date: Mon Oct  3 17:20:13 2005
New Revision: 293474

URL: http://svn.apache.org/viewcvs?rev=293474view=rev
Log:
style

Modified:
perl/modperl/trunk/Makefile.PL

Modified: perl/modperl/trunk/Makefile.PL
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Makefile.PL?rev=293474r1=293473r2=293474view=diff
==
--- perl/modperl/trunk/Makefile.PL (original)
+++ perl/modperl/trunk/Makefile.PL Mon Oct  3 17:20:13 2005
@@ -480,11 +480,11 @@
 
 open my $fh, 'Changes';
 while ($fh) {
-   if (/^=item.*-dev/) {
-   $VERSION .= '-dev';
-   last;
-   }
-   last if /^=item/;
+if (/^=item.*-dev/) {
+$VERSION .= '-dev';
+last;
+}
+last if /^=item/;
 }
 close $fh;
 




svn commit: r293476 - /perl/modperl/trunk/Makefile.PL

2005-10-03 Thread stas
Author: stas
Date: Mon Oct  3 17:30:04 2005
New Revision: 293476

URL: http://svn.apache.org/viewcvs?rev=293476view=rev
Log:
untabify

Modified:
perl/modperl/trunk/Makefile.PL

Modified: perl/modperl/trunk/Makefile.PL
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Makefile.PL?rev=293476r1=293475r2=293476view=diff
==
--- perl/modperl/trunk/Makefile.PL (original)
+++ perl/modperl/trunk/Makefile.PL Mon Oct  3 17:30:04 2005
@@ -89,7 +89,7 @@
 },
 dist  = {
 DIST_DEFAULT = 'mydist',
-   COMPRESS = 'gzip -9f', SUFFIX='gz',
+COMPRESS = 'gzip -9f', SUFFIX='gz',
 },
 );
 
@@ -547,17 +547,17 @@
 
 my $ccflags = $build-perl_config('ccflags');
 for (split /\s+/, $ccflags) {
-   next unless s/^-I//;
-   my $header = $_/ap_mmn.h;
-   if (-e $header) {
-   $build-phat_warn(EOF);
+next unless s/^-I//;
+my $header = $_/ap_mmn.h;
+if (-e $header) {
+$build-phat_warn(EOF);
 Apache headers found in unexpected location: ``$_'', suggestions:
*) Remove via ``rpm -e apache''
*) Remove by hand
*) Complain to your os vendor about their poor layout choice
*) Complain to your sysadmin about their poor layout choice
 EOF
-   }
+}
 }
 
 $build-lib_check('gdbm');




svn commit: r291801 - /perl/modperl/trunk/t/lib/TestCommon/LogDiff.pm

2005-09-26 Thread stas
Author: stas
Date: Mon Sep 26 17:41:42 2005
New Revision: 291801

URL: http://svn.apache.org/viewcvs?rev=291801view=rev
Log:
add strict, fix bug

Modified:
perl/modperl/trunk/t/lib/TestCommon/LogDiff.pm

Modified: perl/modperl/trunk/t/lib/TestCommon/LogDiff.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestCommon/LogDiff.pm?rev=291801r1=291800r2=291801view=diff
==
--- perl/modperl/trunk/t/lib/TestCommon/LogDiff.pm (original)
+++ perl/modperl/trunk/t/lib/TestCommon/LogDiff.pm Mon Sep 26 17:41:42 2005
@@ -1,5 +1,8 @@
 package TestCommon::LogDiff;
 
+use strict;
+use warnings FATAL = 'all';
+
 use POSIX ();
 
 sub new {
@@ -8,7 +11,7 @@
 
 open my $fh, $path or die Can't open $path: $!;
 seek $fh, 0, POSIX::SEEK_END();
-$pos = tell $fh;
+my $pos = tell $fh;
 
 my %self = (
 path = $path,




svn commit: r291058 - /perl/modperl/branches/apache2-rename-unstable/

2005-09-22 Thread stas
Author: stas
Date: Thu Sep 22 19:07:52 2005
New Revision: 291058

URL: http://svn.apache.org/viewcvs?rev=291058view=rev
Log:
Merged successfully to trunk/

Removed:
perl/modperl/branches/apache2-rename-unstable/



svn commit: r290331 - /perl/modperl/trunk/lib/Apache2/PerlSections/Dump.pm

2005-09-19 Thread stas
Author: stas
Date: Mon Sep 19 19:18:54 2005
New Revision: 290331

URL: http://svn.apache.org/viewcvs?rev=290331view=rev
Log:
tidy up

Modified:
perl/modperl/trunk/lib/Apache2/PerlSections/Dump.pm

Modified: perl/modperl/trunk/lib/Apache2/PerlSections/Dump.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/PerlSections/Dump.pm?rev=290331r1=290330r2=290331view=diff
==
--- perl/modperl/trunk/lib/Apache2/PerlSections/Dump.pm (original)
+++ perl/modperl/trunk/lib/Apache2/PerlSections/Dump.pm Mon Sep 19 19:18:54 2005
@@ -61,17 +61,18 @@
 sub dump_hash {
 my ($self, $name, $entry) = @_;
 for my $elem (sort keys %{$entry}) {
-$self-add_config(Data::Dumper-Dump([$entry-{$elem}], 
[\$$name.{'$elem'}])); 
+$self-add_config(Data::Dumper-Dump([$entry-{$elem}],
+ [\$$name.{'$elem'}]));
 }
-
+
 }
 
 sub dump_entry {
 my ($self, $name, $entry) = @_;
-
+
 return if not defined $entry;
 my $type = ref($entry);
-
+
 if ($type eq 'SCALAR') {
 $self-add_config(Data::Dumper-Dump([$$entry],[$name]));
 }
@@ -85,7 +86,7 @@
 
 sub dump_special {
 my ($self, @data) = @_;
-
+
 my @dump = grep { defined } @data;
 return unless @dump;
 




svn commit: r267275 - /perl/modperl/trunk/lib/Apache2/Build.pm

2005-09-02 Thread stas
Author: stas
Date: Fri Sep  2 12:09:13 2005
New Revision: 267275

URL: http://svn.apache.org/viewcvs?rev=267275view=rev
Log:
- remove whitespace
- wrap long lines

Modified:
perl/modperl/trunk/lib/Apache2/Build.pm

Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/Build.pm?rev=267275r1=267274r2=267275view=diff
==
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Fri Sep  2 12:09:13 2005
@@ -310,21 +310,23 @@
 
 my $mplibpath = '';
 my $ldopts = $self-ldopts;
-
+
 if (CYGWIN) {
-# Cygwin's httpd port links its modules into httpd2core.dll, instead 
of httpd.exe.
-# In this case, we have a problem, because libtool doesn't want to 
include
-# static libs (.a) into a dynamic lib (.dll). Workaround this by 
setting
-# mod_perl.a as a linker argument (including all other flags and libs).
+# Cygwin's httpd port links its modules into httpd2core.dll,
+# instead of httpd.exe. In this case, we have a problem,
+# because libtool doesn't want to include static libs (.a)
+# into a dynamic lib (.dll). Workaround this by setting
+# mod_perl.a as a linker argument (including all other flags
+# and libs).
 my $mplib  = $self-{MP_LIBNAME}$Config{lib_ext};
-
-$ldopts = join ' ', 
+
+$ldopts = join ' ',
 '--export-all-symbols',
 $self-{cwd}/src/modules/perl/$mplib,
 $ldopts;
-
+
 $ldopts =~ s/(\S+)/-Wl,$1/g;
-
+
 } else {
 my $mplib  = $self-{MP_LIBNAME}$Config{lib_ext};
 $mplibpath = catfile($self-{cwd}, qw(src modules perl), $mplib);
@@ -334,13 +336,13 @@
 local $ENV{AP_LIBS} = $ldopts;
 local $ENV{MODLIST} = 'perl';
 
-#XXX: -Wall and/or -Werror at httpd configure time breaks things
+# XXX: -Wall and/or -Werror at httpd configure time breaks things
 local $ENV{CFLAGS} = join ' ', grep { ! /\-Wall|\-Werror/ } 
 split /\s+/, $ENV{CFLAGS} || '';
 
 my $cd = qq(cd $self-{MP_AP_PREFIX});
 
-#We need to clean the httpd tree before configuring it
+# We need to clean the httpd tree before configuring it
 if (-f File::Spec-catfile($self-{MP_AP_PREFIX}, 'Makefile')) {
 my $cmd = qq(make clean);
 debug Running $cmd;
@@ -1609,11 +1611,11 @@
 my $apache_corelib_cygwin;
 sub apache_corelib_cygwin {
 return $apache_corelib_cygwin if $apache_corelib_cygwin;
-
+
 my $self = shift;
 my $mp_src = $self-{cwd}/src/modules/perl;
 my $core = 'httpd2core';
-
+
 # There's a problem with user-installed perl on cygwin.
 # MakeMaker doesn't know about the .dll.a libs and warns
 # about missing -lhttpd2core. Fix it by copying
@@ -1629,7 +1631,7 @@
 qx{touch $libpath/lib$core.dll.a  \
 ln -fs $libpath/lib$core.dll.a $mp_src/lib$core.a};
 }
-
+
 $apache_corelib_cygwin = -L$mp_src -l$core;
 }
 




svn commit: r267276 - in /perl/modperl/trunk: Changes lib/Apache2/Build.pm

2005-09-02 Thread stas
Author: stas
Date: Fri Sep  2 12:11:43 2005
New Revision: 267276

URL: http://svn.apache.org/viewcvs?rev=267276view=rev
Log:
On cygwin some dlls might happen to be with identical base addresses
and if you try to load both of them you'll get an error and you'll
have to use the rebase utility to fix them.  this fix should prevent
this. 
Submitted by: Nikolay Ananiev [EMAIL PROTECTED]

Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/lib/Apache2/Build.pm

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=267276r1=267275r2=267276view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Fri Sep  2 12:11:43 2005
@@ -12,6 +12,11 @@
 
 =item 2.0.2-dev
 
+On cygwin some dlls might happen to be with identical base addresses
+and if you try to load both of them you'll get an error and you'll
+have to use the rebase utility to fix them.  this fix should prevent
+this.  [Nikolay Ananiev [EMAIL PROTECTED]]
+
 Fix an undefined warning in DSO builds when not using MP_APXS.
 [Nikolay Ananiev [EMAIL PROTECTED]]
 

Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/Build.pm?rev=267276r1=267275r2=267276view=diff
==
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Fri Sep  2 12:11:43 2005
@@ -322,6 +322,7 @@
 
 $ldopts = join ' ',
 '--export-all-symbols',
+'--enable-auto-image-base',
 $self-{cwd}/src/modules/perl/$mplib,
 $ldopts;
 
@@ -1592,7 +1593,8 @@
$(MODPERL_RM_F) $@
$(MODPERL_CC) -shared -o $@ \
-Wl,--out-implib=$(MODPERL_LIBNAME).dll.a \
-   -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--stack,8388608 \
+   -Wl,--export-all-symbols -Wl,--enable-auto-import \
+   -Wl,--enable-auto-image-base -Wl,--stack,8388608 \
$(MODPERL_PIC_OBJS) \
$(MODPERL_LDDLFLAGS) $(MODPERL_LDOPTS) \
$(MODPERL_AP_LIBS)




svn commit: r264897 - /perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm

2005-08-30 Thread stas
Author: stas
Date: Tue Aug 30 17:01:47 2005
New Revision: 264897

URL: http://svn.apache.org/viewcvs?rev=264897view=rev
Log:
missing constant

Modified:
perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm

Modified: perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm?rev=264897r1=264896r2=264897view=diff
==
--- perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm Tue Aug 30 17:01:47 2005
@@ -9,6 +9,7 @@
 require Chatbot::Eliza;
 
 use Apache2::Const -compile = 'OK';
+use APR::Const -compile = 'SO_NONBLOCK';
 
 use constant BUFF_LEN = 1024;
 




Re: Apache, Mod_Perl Upgrade

2005-08-19 Thread Stas Bekman

Philip M. Gollucci wrote:
[...]

Actually from the README,
*** Prerequisites ***

Apache:
  Dynamic mod_perl (DSO):Apache 2.0.47 - 2.0.54.
  Static mod_perl:   Apache 2.0.51 - 2.0.54.

  Newer Apache versions may work with this version of mod_perl.  If
  not, the svn version likely will, which can be obtained from:

http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution 



2.0.40 IS TOO OLD


though it might work if you are lucky, I forget exactly why we upped the 
minium httpd version for dynamic.


Because of the Apache API changes. 2.0.40 wasn't of a release quality (I 
think it was still beta or something)



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: ModPerl 2.0.1 AIX4.3.3 - Make Test Fails to run

2005-08-17 Thread Stas Bekman

ODELL, TODD E (SWBT) wrote:
[...]

Is there another why to run this to show more detail of what's going on?


try to run the equivalent of strace on AIX and see where it hangs.

One reason could be the lack of entropy:
http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#Server_Hanging_at_the_Startup

but then you say that it runs fine with ModPerl::Registry, so probably 
it's not the case. Most likely it just fails to load some module and hangs 
(strace or the equivalent should tell you exactly what's going on)


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


svn commit: r233275 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_filter.c t/filter/TestFilter/in_str_declined_read.pm t/filter/in_str_declined_read.t

2005-08-17 Thread stas
Author: stas
Date: Wed Aug 17 17:37:06 2005
New Revision: 233275

URL: http://svn.apache.org/viewcvs?rev=233275view=rev
Log:
croak in case a filter returns DECLINED after calling $f-read (as it
is not supposed to happen)

Added:
perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm   (with 
props)
perl/modperl/trunk/t/filter/in_str_declined_read.t   (with props)
Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/src/modules/perl/modperl_filter.c

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=233275r1=233274r2=233275view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed Aug 17 17:37:06 2005
@@ -12,6 +12,9 @@
 
 =item 2.0.2-dev
 
+croak in case a filter returns DECLINED after calling $f-read (as it
+is not supposed to happen) [Stas]
+
 another round of cygwin fixes [Nick *** [EMAIL PROTECTED]]
 
 Multiple fixes to make mod_perl 2.0 work with blead-perl (5.9.3+)

Modified: perl/modperl/trunk/src/modules/perl/modperl_filter.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_filter.c?rev=233275r1=233274r2=233275view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_filter.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_filter.c Wed Aug 17 17:37:06 
2005
@@ -544,6 +544,15 @@
 
 if (filter-mode == MP_INPUT_FILTER_MODE) {
 if (filter-bb_in) {
+if (status == DECLINED) {
+/* make sure the filter doesn't try to make mod_perl
+ * pass the bucket brigade through after it called
+ * $f-read(), since it causes a pre-fetch of the
+ * bb */
+modperl_croak(aTHX_ MODPERL_FILTER_ERROR,
+  a filter calling $f-read 
+  must return OK and not DECLINED);
+}
 /* in the streaming mode filter-bb_in is populated on the
  * first modperl_input_filter_read, so it must be
  * destroyed at the end of the filter invocation

Added: perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm?rev=233275view=auto
==
--- perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm (added)
+++ perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm Wed Aug 17 
17:37:06 2005
@@ -0,0 +1,51 @@
+package TestFilter::in_str_declined_read;
+
+use strict;
+use warnings FATAL = 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use Apache2::RequestRec ();
+use Apache2::RequestIO ();
+
+use Apache2::Filter ();
+
+use TestCommon::Utils ();
+
+use Apache2::Const -compile = qw(OK DECLINED M_POST);
+
+# a filter must not return DECLINED after calling $r-read, since the
+# latter already fetches the bucket brigade in which case it's up to
+# the user to complete reading it and send it out
+# thefore this filter must fail
+sub handler {
+  my $filter = shift;
+
+  # this causes a fetch of bb
+  $filter-read(my $buffer, 10);
+
+  return Apache2::Const::DECLINED;
+}
+
+sub response {
+my $r = shift;
+
+plan $r, tests = 1;
+
+$r-content_type('text/plain');
+
+if ($r-method_number == Apache2::Const::M_POST) {
+# this should fail, because of the failing filter
+eval { TestCommon::Utils::read_post($r) };
+ok $@;
+}
+
+Apache2::Const::OK;
+}
+1;
+__DATA__
+SetHandler modperl
+PerlModule  TestFilter::in_str_declined_read
+PerlResponseHandler TestFilter::in_str_declined_read::response
+

Propchange: perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm
--
svn:eol-style = native

Added: perl/modperl/trunk/t/filter/in_str_declined_read.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/filter/in_str_declined_read.t?rev=233275view=auto
==
--- perl/modperl/trunk/t/filter/in_str_declined_read.t (added)
+++ perl/modperl/trunk/t/filter/in_str_declined_read.t Wed Aug 17 17:37:06 2005
@@ -0,0 +1,11 @@
+use strict;
+use warnings FATAL = 'all';
+
+use Apache::TestRequest 'POST_BODY_ASSERT';;
+
+my $location = '/TestFilter__in_str_declined_read';
+
+my $chunk = 1234567890;
+my $data = $chunk x 2000;
+
+print POST_BODY_ASSERT $location, content = $data;

Propchange: perl/modperl/trunk/t/filter/in_str_declined_read.t
--
svn:eol-style = native




Re: Mod_perl Apache to encapsulate legacy protocol

2005-08-16 Thread Stas Bekman

Tom Schindl wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Is this what you are searching for:
http://perl.apache.org/docs/2.0/user/handlers/protocols.html

There are projects already online which use MP2 to implement their own
protocol e.g. SMTP, ... .


And sometimes you can extend the HTTP if your protocol is somewhat similar 
to it. e.g. send email over HTTP:

http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlHeaderParserHandler

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] make test failure in t/api/access2

2005-08-16 Thread Stas Bekman

Michael G Schwern wrote:

On Mon, Aug 15, 2005 at 05:54:53PM -0700, Stas Bekman wrote:

Where does it go then?  Are you sure you've applied the patch and the warn 
statement is there?



Grepping the source tree the only instance of myip is in 
t/response/TestAPI/access2.pm which I put in there according to your

instructions.

0 windhund /usr/local/src/CPAN/mod_perl-2.0.1$ rgrep 'myip'
./t/response/TestAPI/access2.pm:warn myip: , $r-connection-remote_ip, 
\n;


t/response/TestAPI/access2.pm attached.


Looks fine. Dunno why it doesn't end up in the right place. Do you load 
some module that overrides SIG{__WARN__}?


In any case I've committed the fix I've posted earlier, so you shouldn't 
have this issue anymore.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: mod_perl2 bug report

2005-08-16 Thread Stas Bekman

Philip M. Gollucci wrote:

During the tests i've an error:

/home/asm/apache2054/bin/bin/httpd  -d 
/usr/home/asm/soft/Apache/mod_perl-2.0.1/t -f 
/usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf -D APACHE2 
-D PERL_USEITHREADS

using Apache/2.0.54 (prefork MPM)

waiting 120 seconds for server to start: .Syntax error on line 12 of 
/usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf:
Cannot load 
/usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so 
into server: 
/usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so: 
Undefined symbol apr_os_thread_current

*** /usr/local/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
  Platform:
osname=freebsd, osvers=4.7-release, 
archname=i386-freebsd-thread-multi-64int
uname='freebsd sspserver.dev 4.7-release freebsd 4.7-release #3: 
mon jun 2 17:20:39 msd 2003 [EMAIL PROTECTED]:usrsrcsyscompilesmp i386 '

config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define

useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef



Whats happened here is that your PERL is ithread enabled and thus 
mod_perl thinks it should be too. Unfortunately, the APR library you are 
linking against is not thread enabled (-lpthread or -llibc_r). BTW you 
don't want the latter,  use -lpthread on FreeBSD.  You might need to 
edit your /etc/libmap.conf file (see my previous posts on this)


Well, the diagnostics are not exactly correct, Philip. as the problem has 
little to do with perl having ithreads enabled.


apr_os_thread_current is used only if APR_HAS_THREADS is defined. When 
mod_perl is being built it gets this define from the apr headers, as 
supplied by apxs. The problem happens because mod_perl finds one set of 
headers during the build, but a libapr from a different install gets 
loaded at run time.


But the following solution should work :)

A _VERY_ likely reason as I am a freebsd guy myself, is that you've 
installed Subversion or some other port that installs apr.  That apr is 
not threaded.  The apr-1-config and apu-1-config binaries are in your 
path (/usr/local/bin). This causes the HTTPD build to link against the 
WRONG apr/apr util libraries.  Later when mod_perl2 calls apxs to get 
the path for things, its given the wrong ones causing the error you see.


The easiest solution for me is to temporarily move them out of your PATH 
during compilation or rename them temporarily.


I'm surprised, that you didn't get this during the mod_perl2 compile as 
thats where I usually get it and smack myself.


I'm tempted to add a note to the mp2 build page about this, but don't 
know exactly how to word it.





--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: mod_perl touted in company press release

2005-08-16 Thread Stas Bekman

Perrin Harkins wrote:

http://home.businesswire.com/portal/site/google/index.jsp?
ndmViewId=news_viewnewsId=20050816005237newsLang=en

Increased Performance and Scalability with Mod_Perl: FootPrints 7.0
offers significantly improved performance and speed when a large number
of agents are using the system. Mod_Perl versions are now available for
UNIX(R) and Linux(R) platforms. Microsoft Windows versions will follow
in Q4 2005.


Cool, can we link to that release from somewhere?

also that reminds me that we still haven't done the press release for 2.0 
release (hint, hint :)



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


svn commit: r233075 - /perl/modperl/trunk/t/response/TestAPI/access2.pm

2005-08-16 Thread stas
Author: stas
Date: Tue Aug 16 16:03:56 2005
New Revision: 233075

URL: http://svn.apache.org/viewcvs?rev=233075view=rev
Log:
adjust the test not to rely on @servername@ which for some reason mismatches on 
the 
some setups (making mod_auth fail). so instead use the 'allow from all' test, 
which 
should be still good enough for $r-satisfies test

Modified:
perl/modperl/trunk/t/response/TestAPI/access2.pm

Modified: perl/modperl/trunk/t/response/TestAPI/access2.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/access2.pm?rev=233075r1=233074r2=233075view=diff
==
--- perl/modperl/trunk/t/response/TestAPI/access2.pm (original)
+++ perl/modperl/trunk/t/response/TestAPI/access2.pm Tue Aug 16 16:03:56 2005
@@ -98,9 +98,7 @@
 
 IfModule @ACCESS_MODULE@
 # needed to test $r-satisfies
-Order Deny,Allow
-Deny from all
-Allow from @servername@
+Allow from All
 /IfModule
 AuthType Basic
 AuthName Access




Re: [mp2] make test failure in t/api/access2

2005-08-15 Thread Stas Bekman

Michael G Schwern wrote:

On Fri, Aug 12, 2005 at 09:19:13PM -0700, Stas Bekman wrote:


On Fri, Aug 12, 2005 at 08:47:30PM -0700, Stas Bekman wrote:



e.g. inside a handler t/response/TestAPI/access2.pm



Put it in there and didn't see any extra output in STDERR or error.log.


what test are you running?

t/TEST t/api/access2.t



That test.


Where does it go then?  Are you sure you've applied the patch and the warn 
statement is there?


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [MP2] having trouble obtaining $r

2005-08-11 Thread Stas Bekman



use Apache2::RequestUtil;
my $r = Apache2::RequestUtil-request;

  This produces the following error:

Can't locate object method request via package Apache2::RequestUtil 

[...]

LoadModule perl_module modules/mod_perl.so

PerlModule Apache2::compat

AddHandler cgi-script .cgi
AddHandler perl-script .pl

Alias /auth/ /web/ssldocs/foobar/auth/

Directory /web/ssldocs/foobar/auth 
  AllowOverride None

  Options +ExecCGI
  #SetHandler perl-script
  PerlOptions +GlobalRequest 
/Directory


and where exactly do you configure, the registry module, Steve? I can't 
see it in this config.


What if you chance that config to:

Directory /web/ssldocs/foobar/auth
  AllowOverride None
  Options +ExecCGI
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
/Directory




--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [Fwd: ApacheCon US 2005 CFP slightly extended]

2005-08-10 Thread Stas Bekman

Perrin Harkins wrote:

You've got an extra couple of days to put in a talk, so let's get some
more mod_perl talks in there!  ApacheCon is a great conference to speak
at and I know that many of you have stories worth telling but haven't
stepped up yet.  This is your chance.


I'm not submitting any proposals, as I won't be there, so hopefully 
someone else will submit the usual 3h tutorial proposal. You are welcome 
to reuse my material for your presentation (for this conference and 
anywhere else), please contact me if you want it (the original source 
files and the build package).


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [Fwd: ApacheCon US 2005 CFP slightly extended]

2005-08-10 Thread Stas Bekman

Philip M. Gollucci wrote:

It's more or less been the same abstract each time around.


Does anyone have it handy for me to submit ?

Well, I don't mind doing, and I've done it once in the past. It's a 
long 3hour
tutorial, so it's certainly not like a quick 45 minute presentation. I 
guess it
depends on the kind of speaking experience you have and how much you'd 
like to

do it. I don't particuarly mind either way.


I'm game. Sign me up.


You need to submit it by yourself. See perrin's original post for details. 
Feel free to ask questions if you have any.


If you want to give the same tutorial I gave, grab the abstract from:
http://stason.org/talks/
(http://stason.org/talks/perlcon2005/tutorial/abstract.txt)


I've taugh classes to up to 20 people before for the
University of Maryland in College Park, Maryland.


Cool!


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [Fwd: ApacheCon US 2005 CFP slightly extended]

2005-08-10 Thread Stas Bekman

Dan Brian wrote:
By the way, Stas deserves some severe kudos for these materials. They  
were the best tutorial materials at OSCON, reading like a well- written 
book. You could stand up and read the whole thing without any  preparation.


Thanks for the kind words, Dan.

The pseudo-pod source of the tutorial (handouts and slides) is available 
here: http://people.apache.org/~stas/modperl-2.0-tutorial.tgz
You will need to install the module DocSet available from CPAN in order to 
build the html/pdf version of it (see README for details). But feel free 
to ask questions if you have any.


If you speak very fast and leave no time for questions, you will need at 
least 3-4 hours to cover it all. So most likely you will want to either 
leave some parts off or flip slides really fast :)


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


svn commit: r231356 - in /perl/modperl/trunk/ModPerl-Registry/t: 206.t 304.t 404.t cgi.t closure.t flush.t perlrun_extload.t redirect.t special_blocks.t

2005-08-10 Thread stas
Author: stas
Date: Wed Aug 10 16:56:57 2005
New Revision: 231356

URL: http://svn.apache.org/viewcvs?rev=231356view=rev
Log:
skip tests if HTML::HeadParser is not available

Modified:
perl/modperl/trunk/ModPerl-Registry/t/206.t
perl/modperl/trunk/ModPerl-Registry/t/304.t
perl/modperl/trunk/ModPerl-Registry/t/404.t
perl/modperl/trunk/ModPerl-Registry/t/cgi.t
perl/modperl/trunk/ModPerl-Registry/t/closure.t
perl/modperl/trunk/ModPerl-Registry/t/flush.t
perl/modperl/trunk/ModPerl-Registry/t/perlrun_extload.t
perl/modperl/trunk/ModPerl-Registry/t/redirect.t
perl/modperl/trunk/ModPerl-Registry/t/special_blocks.t

Modified: perl/modperl/trunk/ModPerl-Registry/t/206.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/206.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/206.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/206.t Wed Aug 10 16:56:57 2005
@@ -5,7 +5,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET);
 
-plan tests = 2, need 'mod_alias.c';
+plan tests = 2, need [qw(mod_alias.c HTML::HeadParser)];
 
 my $url = /registry/206.pl;
 my $res = GET($url);

Modified: perl/modperl/trunk/ModPerl-Registry/t/304.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/304.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/304.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/304.t Wed Aug 10 16:56:57 2005
@@ -5,7 +5,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET);
 
-plan tests = 10, need 'mod_alias.c';
+plan tests = 10, need [qw(mod_alias.c HTML::HeadParser)];
 
 my $url = /registry/304.pl;
 

Modified: perl/modperl/trunk/ModPerl-Registry/t/404.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/404.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/404.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/404.t Wed Aug 10 16:56:57 2005
@@ -5,7 +5,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET_BODY GET);
 
-plan tests = 2, need 'mod_alias.c';
+plan tests = 2, need [qw(mod_alias.c HTML::HeadParser)];
 
 {
 t_client_log_error_is_expected();

Modified: perl/modperl/trunk/ModPerl-Registry/t/cgi.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/cgi.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/cgi.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/cgi.t Wed Aug 10 16:56:57 2005
@@ -5,7 +5,8 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET);
 
-plan tests = 2, need 'mod_alias.c', need_min_module_version CGI = 3.08;
+plan tests = 2, need [qw(mod_alias.c HTML::HeadParser)],
+need_min_module_version CGI = 3.08;
 
 my $url = /registry/cgi.pl;
 my $res = GET $url;

Modified: perl/modperl/trunk/ModPerl-Registry/t/closure.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/closure.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/closure.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/closure.t Wed Aug 10 16:56:57 2005
@@ -17,7 +17,7 @@
 
 my @modules = qw(registry registry_bb perlrun);
 
-plan tests = 6, need 'mod_alias.c';
+plan tests = 6, need [qw(mod_alias.c HTML::HeadParser)];
 
 my $cfg = Apache::Test::config();
 

Modified: perl/modperl/trunk/ModPerl-Registry/t/flush.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/flush.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/flush.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/flush.t Wed Aug 10 16:56:57 2005
@@ -5,7 +5,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET_BODY);
 
-plan tests = 1, need 'deflate', 'mod_alias.c',
+plan tests = 1, need [qw(mod_alias.c deflate HTML::HeadParser)],
 need_min_module_version(Compress::Zlib, 1.09),
 need_min_apache_version(2.0.48);
 # it requires httpd 2.0.48 because of the bug in mod_deflate:

Modified: perl/modperl/trunk/ModPerl-Registry/t/perlrun_extload.t
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/ModPerl-Registry/t/perlrun_extload.t?rev=231356r1=231355r2=231356view=diff
==
--- perl/modperl/trunk/ModPerl-Registry/t/perlrun_extload.t (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/perlrun_extload.t Wed Aug 10 16:56:57 
2005
@@ -6,7 +6,7 @@
 use Apache::TestRequest qw(GET);
 use TestCommon::SameInterp

Re: failing tests in mod_perl-2.0.1/ModPerl-Registry/t

2005-08-07 Thread Stas Bekman

Philip M. Gollucci wrote:

Jim Martinez wrote:

While compiling mod perl 2.0.1 on a box that did not have 
HTML::HeadParser

installed, several tests failed.


What modules did you have installed ?


Stas Bekman, at a Portland Perl Monks meeting, suggested that, since
HTML::HeadParser is not installed, special_blocks.t should be skipped.


I'll look at formulating and commiting a patch Monday/Tuesday night, if 
I can duplicate it and nobody beats me to it.



plan tests = @aliases * 4, 'mod_alias.c';

to the line below skips the test:

plan tests = @aliases * 4, need ['mod_alias.c', 'HTML::HeadParser'];


I think I've already committed that skip rule but the rename branch merge 
has wiped it away. Philip, if you work on that, just wipe off 
HTML::HeadParser from your installed libs and run 'make test' and you will 
see which tests need that check.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [PATCH] Apache2::SizeLimit on Linux

2005-08-07 Thread Stas Bekman

Torsten Foertsch wrote:

Hi,

the attached patch allows Apache2::SizeLimit to use the new /proc/PID/smaps 
instead of /proc/PID/statm. This takes into account copy-on-write pages when 
counting shared memory.


Torsten++!

Could you please submit a doc patch for Apache2/SizeLimit.pod
http://svn.apache.org/viewcvs.cgi/perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/SizeLimit.pod?rev=159831view=log
explaining the fact that shared memory calculation is normally wrong under 
linux kernel 2.6 and how to fix that situation? (below)


The patch looks if /proc/PID/smaps exists and if Linux::Smaps is installed. If 
not it uses the old /proc/PID/statm. Hence, it is compatible with old 
linuxes.


/proc/PID/smaps exists by now in the mm-series of the linux kernel. I hope the 
patch will take its way into the vanilla kernel in the not so distant future.

[...]
The first one uses linux 2.6.13-rc4-mm1 (with a little patch that will go into 
the next mm-version, see 
http://marc.theaimsgroup.com/?l=linux-kernelm=112335328222533w=2), the 
second with Suses default kernel (2.6.11.4-20a-default).


Do you know when the mm-series will become a part of the mainstream branch?

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] CGI.pm porting/co-existence questions

2005-08-07 Thread Stas Bekman



print vs. $r-print


This is drastically faster.. especially if you use
one print
per request at the end and/or pass a reference to
the scalar string.


Actually this is no longer true. in mp2 you can't pass a reference to a 
scalar.


Still $r-print is faster :)


Also, the mp2 User's Guide (section 10.9.1) says
CGI.pm now takes $r as an argument to its new()
function.  What benefit is this?  Is it required? 


For the most part its optional.
You may need to look at PerlGlobalRequest



http://perl.apache.org/docs/2.0/user/config/config.html#C_GlobalRequest_

I'm still confused why this is optional in CGI.pm. 
Does it save some cycles by avoiding CGI.pm having to

sniff around for the Apache requestor?


Right. When you pass $r as an argument you should set -GlobalRequest (see 
the url above). Setting the global $r is time consuming, especially in the 
threaded environment.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache2 filters questions

2005-08-03 Thread Stas Bekman

Javier Alonso Sánchez wrote:

Hi all.

I'm fighting hard with Apache2 filters  + mod_perl, and I have some
doubts to ask you:

I want to analyze a POST request to my Apache2 server, analyze it, and
change the headers to redirect the POST to another uri, depending on
the content (body of the POST).

As I need body+headers, I'm using a Input Connection Filter.

The main problem is how to stop the buckets brigades. It's easy to
analyze the body, but when I process it, the brigades with headers
have just passed to the next filter (or the core).

In order to stop the previous brigades, I read all the brigades
using a loop which knows when the body finishes, reading
Content-Length header. As I use Connection Filter, and there isn't
EOS, it is the unique way to know WHEN the filter must stop getting
brigades  Are there any way else to know it ??


It's very tricky, as Apache doesn't give you any indication of that event. 
I've solved this in a hacky way. which is explained here:

http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Filters_over_KeepAlive_Connections
and is used in http://search.cpan.org/dist/Apache-Filter-HTTPHeadersFixup/


Is there another way to modify the header of a request once processed
the body content?


I think you are much better off not to use a filter here. Use 
Apache::Request which can give the same POST body more than once. So I'd 
write a trans hander, which grabs the body, rewrites the headers based on 
the body and the content handler can still get the body (this is only 
available in libapreq2)



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: win32, mod_perl/2.0.1, Apache/2.0.54 - ithreads problem

2005-08-03 Thread Stas Bekman



I'm not an expert on ithreads (Stas is the resident
guru on this), but from messages such as
 http://marc.theaimsgroup.com/?l=apache-modperlw=2r=1s=threads%3A%3Asharedq=b 


there's still issues with these, especially in a mod_perl
environment.


Try using this modperl2 branch and perl 5.8.7:
http://svn.apache.org/viewcvs.cgi/perl/modperl/branches/clone-skip-unstable/
(this is source)


Could you post a complete (but minimal) script that
illustrates the problem you're encountering? From what
you wrote above, I tried this Registry script:


seconded.

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: writing to file with mp2

2005-07-27 Thread Stas Bekman

Philip M. Gollucci wrote:

Marc Lambrichs wrote:

What's the best way to write to a file using mp2? IO::File is slow and 
Apache::File is lost...


You could use this:
http://perl.apache.org/docs/2.0/api/APR/PerlIO.html


It's certainly not the fastest way. There is some explanation here:
http://perl.apache.org/docs/2.0/api/APR/PerlIO.html#Description

Just open the file and write it out like you always do in Perl.

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: set the UIDs and GIDs in Mod_Perl 2

2005-07-22 Thread Stas Bekman

Shane De Jager wrote:

Hi

I am in the process of moving to mod perl from CGI. Under modCGI i could set 
UIDs and GID with suExec. Is this possible with mod_perl2? If so, how is it 
done?


Not at the moment, Shane.
http://perl.apache.org/docs/1.0/guide/install.html#Is_it_possible_to_run_mod_perl_enabled_Apache_as_suExec_

This may change in the future if perchild or metux MPM will be released. 
This will allow to have groups of processes/threads running under a given 
uid/gid, which may or may not suit your needs (e.g. it probably won't 
scale well if you have hundreds of users you want to 'suexec' to).



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: set the UIDs and GIDs in Mod_Perl 2

2005-07-22 Thread Stas Bekman

Shane De Jager wrote:

Hi

In O'Reilly Practical mod_perl Appendix C Under C.1. Users Sharing a Single Web 
Server it states:

mod_perl 2.0 improves the situation, since it allows a pool of Perl
interpreters to be dedicated to a single virtual host. It is possible to
set the UIDs and GIDs of these interpreters to be those of the user for
which the virtual host is configured, so users can operate within their
own protected spaces and are unable to interfere with other users.

Or is this not the case anymore?


It never was the case, Shane. Unfortunately this is a mistake. You can 
have pools of interpreters, but since they reside in the process, they 
have the perms of the process. It'll be possible with certain MPMs as 
explained below:


This may change in the future if perchild or metux MPM will be released. 
This will allow to have groups of processes/threads running under a given 
uid/gid, which may or may not suit your needs (e.g. it probably won't 
scale well if you have hundreds of users you want to 'suexec' to).


Give a try to the metux mpm, they say it's in beta. Though we haven't 
tried it under mod_perl. Most likely some tweaks might be needed.


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Request-local storage?

2005-07-22 Thread Stas Bekman

Simon Perreault wrote:

Hi,

Is there a good way to have request-local storage? For example, I want to 
cache stuff (file reading primarily) for the length of a given request, and 
have that cache be local to the request (ie. other concurrent requests have 
separate caches). How would you do that? It should not matter wether Apache 
is threading or forking.


$r-notes for strings
$r-pnotes for perl scalars

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_notes_
http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_pnotes_

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Request-local storage?

2005-07-22 Thread Stas Bekman

Simon Perreault wrote:

On Friday 22 July 2005 10:27, Stas Bekman wrote:


$r-notes for strings
$r-pnotes for perl scalars



Thank you very much for your quick reply. I didn't know about those methods.

I should have mentioned that I am running under ModPerl::Registry and am 
trying to keep my scripts free from any mod_perlism so that they can still be 
run stand-alone. Is there still a solution?


But you need this functionality only under mod_perl, right? in which case 
you can do something like:


# mp1.x

if ($ENV{MOD_PERL}) {
my $r = Apache-request;
$r-pnotes(...);
}

# mp2.x

if ($ENV{MOD_PERL}) {
require Apache2::RequestUtil;
my $r = Apache2::RequestUtil-request;
$r-pnotes(...);
}





I'm not quite following you. You mean you need a solution that will work 
with mod_cgi too? or do you need





--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Request-local storage?

2005-07-22 Thread Stas Bekman

Simon Perreault wrote:

On Friday 22 July 2005 11:00, Stas Bekman wrote:


But you need this functionality only under mod_perl, right?



Well, not really. I would still need to cache stuff during the request when 
running under mod_cgi but then the cache would be automatically reset at the 
end of each script. Nothing special needs to be done. Under mod_perl, the 
cache needs to be explicitly reset.




if ($ENV{MOD_PERL}) {
require Apache2::RequestUtil;
my $r = Apache2::RequestUtil-request;
$r-pnotes(...);
}



Very nice! I'll figure out the else part by myself. Thank you!


the else you could just stash it in the global variable, since mod_cgi 
always forgets everything.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: mod_perl2 and Attribute::Handlers?

2005-07-21 Thread Stas Bekman

Stephen Quinney wrote:

I have been attempting to use some code that utilises the
Attribute::Handlers module within mod_perl2 without success. I know the
modules work perfectly outside of the mod_perl2 environment. I am aware
that there are issues with this as it is doing work at the CHECK phase
and I've read:

http://perl.apache.org/docs/2.0/user/coding/coding.html#C_CHECK__and_C_INIT__Blocks

I have tried using PerlModule, PerlLoadModule and a startup.pl script
via PerlPostConfigRequire but none of these are having the desired
effect. Is there any hope of finding a way around this or should I
just bite the bullet and rewrite the code?


Stephen, have you loaded the code that uses the attributes at the startup 
as well? Do you have a simple test case to try? If so please pack it into 
the Apache-Test skeleton:

http://people.apache.org/~geoff/Apache-Test-skeleton-mp2.tar.gz
and send it here. Thanks.

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: The mod_perl protocol handler sample code have some problem!

2005-07-21 Thread Stas Bekman

LUKE wrote:

Thanks!

But the problem is still exist.



The sample code have some problem. When i telnet then
CommandServer in win32 everything is ok. But if i close
then console window(terminal)  immediate, the apache is
hang. CPU use 100% resource.

I  try to use
$c-aborted()
OR
($@ == APR::Const::ECONNABORTED )
to check the connect but it can not  detect the client is disconnect.


[ ... ]
I'm not sure if this will help, but you might try the use
of APR::Status::is_ECONNABORTED(), as discussed at
  http://perl.apache.org/docs/2.0/api/APR/Status.html#C_is_ECONNABORTED_
to check if $@ corresponds to APR_STATUS_IS_ECONNABORTED,
due to variants in the error conditions.


I'm not familiar with windows, but I think you need to run an equivalent 
of unix's strace(1), which shows you where the process is spinning and go 
from there. (or attach with debugger, or something else).


Randy, can you write a test that can emulate such a situation?

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Strange error in log when trying to implement PerlTypeHandler

2005-07-20 Thread Stas Bekman

Michele Gherlone wrote:

Hi all!
I was trying to bypass mod_mime for certain mime type, and I wrote this 
small handler:


package Apache::MIMEMagic;
$Apache::MIMEMagic::VERSION='0.10';
use Apache2::Const -compile = qw(OK DECLINED);
use File::MMagic;
use strict; sub handler { my $r = shift;
my $ct=File::MMagic-new-checktype_filename($r-filename);
  $r-handler('default-handler');$r-content_type($ct);
  return Apache2::Const::OK;
}
1;
-
Since I was running it for a dir under my docroot, i had to set Apache's 
default-handler. All went fine, docs were correctly served, but in my 
logs for every served document, this error line appeared:

`Invalid type 'the' at line 1`.


What's the value of $ct?

I really wish I could know where this error comes from. Perhaps from 
mod_mime itself, or...?


grep the apache sources for 'Invalid type' string?

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Modification of read only value attempted

2005-07-20 Thread Stas Bekman

Malte Ubl wrote:
[...]
We made this test on the production system where the error seems to 
occur on about 50% of the occassions described in my older mails.


We introduced a #line statement which gives conclusive results pointing 
to this line in PerlRun.pm:

$pr-{'code'} = $pr-{r}-slurp_filename; # this is line 215

Then we pumped $pr using Devel::Peek. The result is:
dump
SV = RV(0x87893e4) at 0x8461c04

[...]

/dump

There doesn't seem to be anything read-only here?


no, but there could be other things that hang off those structures.

One extra piece of information: The app that we ported to mod_perl uses 
file-locks (flock) using type glob (pre perl 5.6 style) file handles.


Could this error occur if the close or unlock a type glob that does not 
have a file handle in it?


May be. It's hard to tell w/o being able to reproduce the problem.

Another thing to try is to change the perl source code to dump the sv:

  sv_dump(sv);

in the place it logs this error, so it may give you an idea what kind of 
the variable it has the problem with.


also any difference if you replace {r}-slurp_filename with a manually 
coded version that just reads the file in?


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: memory leak with perl5.8/freebsd/mod_perl 1.29

2005-07-20 Thread Stas Bekman

snacktime wrote:

Before I spend a whole lot of time on this I'm curious if someone else
has run across this.  This is mod perl 1.29.

We upgraded perl on one of our freebsd 5.4 servers from 5.6.1 to
5.8.7.  This included reinstalling around 50 perl modules (some to new
versions) from the freebsd ports.  Ever since the upgrade, apache
increases in memory by about a third of it's original size whenever by
 it restarts via SIGHUP.

Does this ring a bell for anyone, or do I start debugging from scratch?


http://perl.apache.org/docs/1.0/guide/troubleshooting.html#httpd_keeps_on_growing_after_each_restart

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


svn commit: r219899 - in /perl/modperl/trunk: Changes lib/Apache2/Build.pm lib/ModPerl/BuildMM.pm t/filter/out_str_subreq_default.t xs/APR/APR/Makefile.PL

2005-07-20 Thread stas
Author: stas
Date: Wed Jul 20 06:38:16 2005
New Revision: 219899

URL: http://svn.apache.org/viewcvs?rev=219899view=rev
Log:
another round of cygwin fixes
Submitted by Nick *** [EMAIL PROTECTED]

Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/lib/Apache2/Build.pm
perl/modperl/trunk/lib/ModPerl/BuildMM.pm
perl/modperl/trunk/t/filter/out_str_subreq_default.t
perl/modperl/trunk/xs/APR/APR/Makefile.PL

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=219899r1=219898r2=219899view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed Jul 20 06:38:16 2005
@@ -12,6 +12,8 @@
 
 =item 2.0.2-dev
 
+another round of cygwin fixes [Nick *** [EMAIL PROTECTED]]
+
 Multiple fixes to make mod_perl 2.0 work with blead-perl (5.9.3+)
 [Stas]
 

Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/Build.pm?rev=219899r1=219898r2=219899view=diff
==
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Wed Jul 20 06:38:16 2005
@@ -308,11 +308,30 @@
 $self-{'httpd'} ||= $httpd;
 push @Apache::TestMM::Argv, ('httpd' = $self-{'httpd'});
 
-my $mplib = $self-{MP_LIBNAME}$Config{lib_ext};
-my $mplibpath = catfile($self-{cwd}, qw(src modules perl), $mplib);
+my $mplibpath = '';
+my $ldopts = $self-ldopts;
+
+if (CYGWIN) {
+# Cygwin's httpd port links its modules into httpd2core.dll, instead 
of httpd.exe.
+# In this case, we have a problem, because libtool doesn't want to 
include
+# static libs (.a) into a dynamic lib (.dll). Workaround this by 
setting
+# mod_perl.a as a linker argument (including all other flags and libs).
+my $mplib  = $self-{MP_LIBNAME}$Config{lib_ext};
+
+$ldopts = join ' ', 
+'--export-all-symbols',
+$self-{cwd}/src/modules/perl/$mplib,
+$ldopts;
+
+$ldopts =~ s/(\S+)/-Wl,$1/g;
+
+} else {
+my $mplib  = $self-{MP_LIBNAME}$Config{lib_ext};
+$mplibpath = catfile($self-{cwd}, qw(src modules perl), $mplib);
+}
 
 local $ENV{BUILTIN_LIBS} = $mplibpath;
-local $ENV{AP_LIBS} = $self-ldopts;
+local $ENV{AP_LIBS} = $ldopts;
 local $ENV{MODLIST} = 'perl';
 
 #XXX: -Wall and/or -Werror at httpd configure time breaks things
@@ -469,10 +488,6 @@
 $ldopts .= $self-gtop_ldopts;
 }
 
-if (CYGWIN  $self-is_dynamic) {
-$ldopts .= join ' ', '', $self-apru_link_flags;
-}
-
 $config-{ldflags} = $ldflags; #reset
 
 # on Irix mod_perl.so needs to see the libperl.so symbols, which
@@ -802,7 +817,7 @@
 }
 
 return bless {}, (ref($self) || $self) if $@;
-return Apache2::BuildConfig::-new;
+return Apache2::BuildConfig-new;
 }
 
 sub new {
@@ -1122,7 +1137,7 @@
 if ($self-{MP_AP_CONFIGURE} 
 $self-{MP_AP_CONFIGURE} =~ /--with-${what_long}=(\S+)/) {
 my $dir = $1;
-$dir =~ s/$config$// unless -d $dir;
+$dir = dirname $dir if -f $dir;
 push @tries, grep -d $_, $dir, catdir $dir, 'bin';
 }
 }
@@ -1537,6 +1552,21 @@
 \t . '$(MODPERL_RANLIB) $@';
 }
 
+sub dynamic_link_cygwin {
+my $self = shift;
+return 'EOF';
+$(MODPERL_LIBNAME).$(MODPERL_DLEXT): $(MODPERL_PIC_OBJS)
+   $(MODPERL_RM_F) $@
+   $(MODPERL_CC) -shared -o $@ \
+   -Wl,--out-implib=$(MODPERL_LIBNAME).dll.a \
+   -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--stack,8388608 \
+   $(MODPERL_PIC_OBJS) \
+   $(MODPERL_LDDLFLAGS) $(MODPERL_LDOPTS) \
+   $(MODPERL_AP_LIBS)
+   $(MODPERL_RANLIB) $@
+EOF
+}
+
 sub dynamic_link {
 my $self = shift;
 my $link = \{dynamic_link_$^O};
@@ -1544,6 +1574,34 @@
 $link-($self);
 }
 
+# Returns the link flags for the apache shared core library
+my $apache_corelib_cygwin;
+sub apache_corelib_cygwin {
+return $apache_corelib_cygwin if $apache_corelib_cygwin;
+
+my $self = shift;
+my $mp_src = $self-{cwd}/src/modules/perl;
+my $core = 'httpd2core';
+
+# There's a problem with user-installed perl on cygwin.
+# MakeMaker doesn't know about the .dll.a libs and warns
+# about missing -lhttpd2core. Fix it by copying
+# the lib and adding .a suffix.
+# For the static build create a soft link, because libhttpd2core.dll.a
+# doesn't exist at this time.
+if ($self-is_dynamic) {
+my $libpath = $self-apxs(-q = 'exp_libdir');
+File::Copy::copy($libpath/lib$core.dll.a, $mp_src/lib$core.a);
+} else {
+my $libpath = catdir($self-{MP_AP_PREFIX}, '.libs');
+mkdir $libpath unless -d $libpath

Re: vhosts and mod_perl

2005-07-12 Thread Stas Bekman

Malcolm J Harwood wrote:

On Tuesday 12 July 2005 06:23 am, Erik Scholtz wrote:



I have two vhosts, each running with a different project. Both projects
are using a config.pm, located directly in the cgi-bin directory.

Now it happens, that the project1 uses the config.pm of project2 and
vice versa.

I have no idea, why this happens. Anyone of you a hint for me?



Sure. The problem is that modperl is persistant by design.
So what you get is:
server child 1 responds to project1 request, loads config.pm from 
project1.
server child 2 responds to project2 request, loads config.pm from 
project2.
	server child 1 responds to project2 request, already has config.pm from 
project1 loaded, uses that. (use config isn't 
	server child 2 responds to project1 request, already has config.pm from 
project2 loaded, uses that.


You need to namespace the configs, (eg. Project1::Config) and make sure that 
what they export doesn't overlap.


Also documented in deal at:
http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs

:)

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: make test fails under HP-UX 11.11 - working!

2005-07-12 Thread Stas Bekman

Hugh Williams wrote:

Hi;

OK, I have apparently succeeded in my efforts to get mod_perl 2.0.1 onto
Apache 2.0.54 with mod_ssl on HP-UX 11.11.


Nice :)

Hugh, mind to send in pod patches for the troubleshooting.pod? and someone 
will gladly commit your workarounds there. Thank you!


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache XML Content Production Name Space

2005-07-11 Thread Stas Bekman

 Two parts to the question:

 * Apache or Apache2 ? - they only work with Apache2 (I think)

Nowadays everyone seems to use Apache2:: for Apache2 tools.

 * They generate content in the form of XML

Does it make any difference to the user what generator does it use? May be 
the app should come first?


 Currently I call them Apache::XML::iCal etc.

BTW, once you've passed the ApacheX part usually it's module-authors /on/ 
perl.org list where the namespaces are best polished.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] make test fails under HP-UX 11.11

2005-07-11 Thread Stas Bekman
[Hugh, in the future please inline the bug report, including it after your 
signature makes it impossible to reply to it, while quoting it]


Hugh Williams wrote:

Hi;

My first foray into mod_perl 2.x is making my hair grayer than it
already was.  Bug report below.


what's your shell's file descriptors limit? run either:

csh:  limit
bash: ulimit

Thanks.

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: make test fails under HP-UX 11.11 (fwd)

2005-07-11 Thread Stas Bekman

Hugh Williams wrote:

Stas Bekman wrote:

[Hugh, in the future please inline the bug report, including it after your 
signature makes it impossible to reply to it, while quoting it]



Sorry... I've re-inserted above the sig below for ongoing completness.



Hugh Williams wrote:


Hi;

My first foray into mod_perl 2.x is making my hair grayer than it
already was.  Bug report below.


what's your shell's file descriptors limit? run either:

csh:  limit
bash: ulimit



I'm actually doing all work under ksh; here's all three results:

$ ksh
hughw on valhalla: /opt/build/mod_perl-2.0.1
$ ulimit
unlimited

$ csh
valhalla mod_perl-2.0.1[1] % limit
cputime unlimited
filesizeunlimited
datasize524288 kbytes
stacksize   8192 kbytes
coredumpsize2097151 kbytes
descriptors 60 files

  ^^^
This your problem. Your shells are configured to have too few file 
descriptors.


actually ulimit -n shows you just the descriptors limit in bash. I'm not 
sure what's the syntax in ksh.


so first run:

ulimit -n 1024

or its equivalent in ksh and then run 'make test' again in that very shell.

Ideally Apache-Test should be able to set this limit to the required one 
at run time.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Failure calling BOOT: code

2005-07-08 Thread Stas Bekman

Marc Tardif wrote:
[...]
The Mozilla::LDAP::API module was installed from an RPM. I have the 
source but the makefiles don't work out of the box. I have tried 
fiddling around with the compilation flags but haven't managed to get 
the module compiled again. I would prefer to attach to the process with 
gdb but the problem is that it that the process dies when encountering a 
problem with the Perl module (see exit(1) in the XS code above).


So you need to set a breakpoint in that code, which is quite tricky, since 
 it won't see the breakpoint before the perl module is loaded. So you 
need to break at BOOT before perldap_init(). e.g. take a look at:

http://perl.apache.org/docs/2.0/devel/debug/c.html#Precooked_gdb_Startup_Scripts
There is no exact script to copy from but you get an idea on how things 
can be automated.


I've tried building Mozilla::LDAP::API, but I couldn't build it since I 
think I don't have mozilla-dev package. Your best bet is to figure out how 
to build it. since in order to debug it with gdb you will still need to 
build it with debugging info enabled.


If it was a problem at the startup and if perldap uses some static C 
variables, you could have used
http://perl.apache.org/docs/2.0/user/handlers/server.html#Dealing_with_Restarts 


I have tried printing the restart_count value in my handler and it 
always returns 2. Could that be the problem?


On the start STDERR goes to the console, so the value 1 goes there. Only 
on restart it goes to the file that's where you see 2.


But since the problem happens post startup, it's probably not relevant.


Are you using threads?


No, I'm not using threads. How can I make sure mod_perl.so hasn't been 
compiled with threads?


You use perl 5.6.1, so there can be no threads :)


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: MP2 books (was Re: Lost my ?xml version=1.0 encoding=iso-8859-1?)

2005-07-08 Thread Stas Bekman

Malcolm J Harwood wrote:

On Sunday 03 July 2005 08:14 pm, Thomas Hilbig wrote:



The actual CGI script uses the standard Lincoln Stein
library under MP2, and not yet taking advantage of MP2
code (requestor).  Rewriting to pure MP2 is a task for
this summer, once I can find a good MP2 book that
skips the whole MP1-MP2 stuff and is post-Apache2.


As far as I know, there isn't one. MP2 is still new enough there's no MP2 only 
dead-tree documentation (and the namespace rename is even more recent).


If you print the online docs (http://perl.apache.org/docs/2.0/, available 
also in pdf) you will get more than one book. They should be good enough 
to teach you how to write pure MP2 code.


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: I need to unsub

2005-07-08 Thread Stas Bekman

Luinrandir Insight wrote:

I have forgotten where I subscribed to this list.
could someone please reply with the address
so I can unsub?


Lou, it's in the headers of the very message you've posted:

list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
List-Post: mailto:modperl@perl.apache.org
List-Id: modperl.perl.apache.org

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


svn commit: r209855 - /perl/modperl/trunk/src/modules/perl/modperl_common_util.c

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:04:13 2005
New Revision: 209855

URL: http://svn.apache.org/viewcvs?rev=209855view=rev
Log:
fix the magic type logging

Modified:
perl/modperl/trunk/src/modules/perl/modperl_common_util.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_common_util.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_common_util.c?rev=209855r1=209854r2=209855view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_common_util.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_common_util.c Fri Jul  8 
12:04:13 2005
@@ -95,7 +95,7 @@
 return mg-mg_obj;
 }
 else {
-Perl_warn(aTHX_ Not a tied hash: (magic=%c), mg);
+Perl_warn(aTHX_ Not a tied hash: (magic=%c), 
mg-mg_type);
 }
 }
 else {




svn commit: r209856 - /perl/modperl/trunk/src/modules/perl/modperl_io.c

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:05:01 2005
New Revision: 209856

URL: http://svn.apache.org/viewcvs?rev=209856view=rev
Log:
blead fix: %_ = % SVf

Modified:
perl/modperl/trunk/src/modules/perl/modperl_io.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_io.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_io.c?rev=209856r1=209855r2=209856view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_io.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_io.c Fri Jul  8 12:05:01 2005
@@ -124,7 +124,7 @@
 status = Perl_do_open(aTHX_ handle_save, STDIN, 7, FALSE,
   O_RDONLY, 0, Nullfp);
 if (status == 0) {
-Perl_croak(aTHX_ Failed to dup STDIN: %_, get_sv(!, TRUE));
+Perl_croak(aTHX_ Failed to dup STDIN: % SVf, get_sv(!, TRUE));
 }
 
 /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't
@@ -137,7 +137,7 @@
 status = Perl_do_open9(aTHX_ handle, :Apache2, 9, FALSE, O_RDONLY,
0, Nullfp, sv, 1);
 if (status == 0) {
-Perl_croak(aTHX_ Failed to open STDIN: %_, get_sv(!, TRUE));
+Perl_croak(aTHX_ Failed to open STDIN: % SVf, get_sv(!, TRUE));
 }
 
 MP_TRACE_o(MP_FUNC, end\n);
@@ -167,7 +167,7 @@
 status = Perl_do_open(aTHX_ handle_save, STDOUT, 8, FALSE,
   O_WRONLY, 0, Nullfp);
 if (status == 0) {
-Perl_croak(aTHX_ Failed to dup STDOUT: %_, get_sv(!, TRUE));
+Perl_croak(aTHX_ Failed to dup STDOUT: % SVf, get_sv(!, TRUE));
 }
 
 /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't
@@ -180,7 +180,7 @@
 status = Perl_do_open9(aTHX_ handle, :Apache2, 9, FALSE, O_WRONLY,
0, Nullfp, sv, 1);
 if (status == 0) {
-Perl_croak(aTHX_ Failed to open STDOUT: %_, get_sv(!, TRUE));
+Perl_croak(aTHX_ Failed to open STDOUT: % SVf, get_sv(!, TRUE));
 }
 
 MP_TRACE_o(MP_FUNC, end\n);
@@ -221,7 +221,7 @@
 GvNAME(handle), GvNAMELEN(handle), G_DISCARD);
 
 if (err != Nullsv) {
-Perl_croak(aTHX_ Failed to restore STDIN: %_, err);
+Perl_croak(aTHX_ Failed to restore STDIN: % SVf, err);
 }
 }
 
@@ -243,7 +243,7 @@
  */
 if (GvIOn(handle_orig)  IoOFP(GvIOn(handle_orig)) 
 (PerlIO_flush(IoOFP(GvIOn(handle_orig))) == -1)) {
-Perl_croak(aTHX_ Failed to flush STDOUT: %_, get_sv(!, TRUE));
+Perl_croak(aTHX_ Failed to flush STDOUT: % SVf, get_sv(!, TRUE));
 }
 
 /* close the overriding filehandle */
@@ -268,7 +268,7 @@
 GvNAME(handle), GvNAMELEN(handle), G_DISCARD);
 
 if (err != Nullsv) {
-Perl_croak(aTHX_ Failed to restore STDOUT: %_, err);
+Perl_croak(aTHX_ Failed to restore STDOUT: % SVf, err);
 }
 }
 




svn commit: r209857 - /perl/modperl/trunk/src/modules/perl/mod_perl.c

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:05:32 2005
New Revision: 209857

URL: http://svn.apache.org/viewcvs?rev=209857view=rev
Log:
perl blead fix: %vd doesn't work anymore

Modified:
perl/modperl/trunk/src/modules/perl/mod_perl.c

Modified: perl/modperl/trunk/src/modules/perl/mod_perl.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/mod_perl.c?rev=209857r1=209856r2=209857view=diff
==
--- perl/modperl/trunk/src/modules/perl/mod_perl.c (original)
+++ perl/modperl/trunk/src/modules/perl/mod_perl.c Fri Jul  8 12:05:32 2005
@@ -695,9 +695,17 @@
 }
 #endif
 
+#if PERL_REVISION == 5  PERL_VERSION  9
+#define MP_PERL_VERSION_STAMP Perl/v%vd
+#else
+#define MP_PERL_VERSION_STAMP Perl/% SVf
+#endif
+
 ap_add_version_component(pconf, MP_VERSION_STRING);
 ap_add_version_component(pconf,
- Perl_form(aTHX_ Perl/v%vd, PL_patchlevel));
+ Perl_form(aTHX_ MP_PERL_VERSION_STAMP,
+   PL_patchlevel));
+
 modperl_mgv_hash_handlers(pconf, s);
 modperl_modglobal_hash_keys(aTHX);
 modperl_env_hash_keys(aTHX);




svn commit: r209858 - /perl/modperl/trunk/src/modules/perl/modperl_mgv.c

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:06:22 2005
New Revision: 209858

URL: http://svn.apache.org/viewcvs?rev=209858view=rev
Log:
perl blead fix: HvNAME() may return 0 (fixing a warning for a potential 
strlen(0))

Modified:
perl/modperl/trunk/src/modules/perl/modperl_mgv.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_mgv.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_mgv.c?rev=209858r1=209857r2=209858view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_mgv.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_mgv.c Fri Jul  8 12:06:22 2005
@@ -320,8 +320,17 @@
 MpHandlerMETHOD_On(handler);
 }
 
+if (!stash) {
+return 0;
+}
+
+
 if (MpHandlerMETHOD(handler)  !handler-mgv_obj) {
-modperl_mgv_new_name(handler-mgv_obj, p, HvNAME(stash));
+char *name = HvNAME(stash);
+if (!name) {
+name = ;
+}
+modperl_mgv_new_name(handler-mgv_obj, p, name);
 }
 
 handler-attrs = (U32)MP_CODE_ATTRS(cv);




svn commit: r209859 - /perl/modperl/trunk/src/modules/perl/modperl_interp.h

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:07:46 2005
New Revision: 209859

URL: http://svn.apache.org/viewcvs?rev=209859view=rev
Log:
perl blead fix: in 5.9.3 HvPMROOT was completely removed, temporary using 
Perl_Imodglobal_ptr(thx)))-xmg_magic (which fails on perl_clone from ithreads, 
but 
otherwise works). this must be replaced with a better solution once we find it.

Modified:
perl/modperl/trunk/src/modules/perl/modperl_interp.h

Modified: perl/modperl/trunk/src/modules/perl/modperl_interp.h
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_interp.h?rev=209859r1=209858r2=209859view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_interp.h (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_interp.h Fri Jul  8 12:07:46 
2005
@@ -27,12 +27,28 @@
  * HvPMROOT will never be used by Perl with PL_modglobal.
  * so we have stolen it as a quick way to stash the interp
  * pointer.
+ *
+ * However in 5.9.3 HvPMROOT was completely removed, so we have moved
+ * to use another struct member that's hopefully won't be used by
+ * anybody else. But if we can find a better place to store the
+ * pointer to the current mod_perl interpreter object it'd be a much
+ * cleaner solution. of course it must be really fast.
  */
+#ifndef HvPMROOT
+#define MP_THX_INTERP_GET(thx)  \
+(modperl_interp_t *) ((XPVMG*)SvANY(*Perl_Imodglobal_ptr(thx)))-xmg_magic
+#else
 #define MP_THX_INTERP_GET(thx) \
 (modperl_interp_t *)HvPMROOT(*Perl_Imodglobal_ptr(thx))
+#endif
 
-#define MP_THX_INTERP_SET(thx, interp) \
+#ifndef HvPMROOT
+#define MP_THX_INTERP_SET(thx, interp)  \
+((XPVMG*)SvANY(*Perl_Imodglobal_ptr(thx)))-xmg_magic = (MAGIC*)interp
+#else
+#define MP_THX_INTERP_SET(thx, interp)  \
 HvPMROOT(*Perl_Imodglobal_ptr(thx)) = (PMOP*)interp
+#endif
 
 const char *modperl_interp_scope_desc(modperl_interp_scope_e scope);
 




svn commit: r209860 - /perl/modperl/trunk/src/modules/perl/modperl_util.c

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:08:53 2005
New Revision: 209860

URL: http://svn.apache.org/viewcvs?rev=209860view=rev
Log:
perl blead fixes:
- xhv-xhv_array doesn't exist anymore, using the wrapper HvARRAY(hv)
- types casting

Modified:
perl/modperl/trunk/src/modules/perl/modperl_util.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_util.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_util.c?rev=209860r1=209859r2=209860view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_util.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_util.c Fri Jul  8 12:08:53 2005
@@ -136,7 +136,7 @@
 break;
   default:
 Perl_croak(aTHX_ panic: unsupported request_rec type %d,
-   SvTYPE(rv));
+   (int)SvTYPE(rv));
 }
 }
 
@@ -408,7 +408,7 @@
 register HE *entry;
 
 xhv = (XPVHV *)SvANY(hv);
-if (!xhv-xhv_array) {
+if (!HvARRAY(hv)) {
 return 0;
 }
 
@@ -422,7 +422,7 @@
PERL_HASH(hash, key, klen);
 }
 
-entry = ((HE**)xhv-xhv_array)[hash  (I32)xhv-xhv_max];
+entry = ((HE**)HvARRAY(hv))[hash  (I32)xhv-xhv_max];
 
 for (; entry; entry = HeNEXT(entry)) {
 if (HeHASH(entry) != hash) {
@@ -633,7 +633,7 @@
 if (r-finfo.size != size) {
 SvREFCNT_dec(sv); 
 Perl_croak(aTHX_ Error: read %d bytes, expected %d ('%s'),
-   size, r-finfo.size, r-filename);
+   size, (apr_size_t)r-finfo.size, r-filename);
 }
 
 rc = apr_file_close(file);




svn commit: r209861 - /perl/modperl/trunk/src/modules/perl/modperl_cmd.c

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:09:49 2005
New Revision: 209861

URL: http://svn.apache.org/viewcvs?rev=209861view=rev
Log:
blead perl temp fix: some recent change introduced tainting problems, will 
remove 
the workaround once blead perl is fixed

Modified:
perl/modperl/trunk/src/modules/perl/modperl_cmd.c

Modified: perl/modperl/trunk/src/modules/perl/modperl_cmd.c
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_cmd.c?rev=209861r1=209860r2=209861view=diff
==
--- perl/modperl/trunk/src/modules/perl/modperl_cmd.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_cmd.c Fri Jul  8 12:09:49 2005
@@ -554,6 +554,9 @@
 GV *gv = gv_fetchpv(0, TRUE, SVt_PV);
 ENTER;SAVETMPS;
 save_scalar(gv); /* local $0 */
+#if PERL_REVISION == 5  PERL_VERSION = 9
+TAINT_NOT; /* XXX: temp workaround, see my p5p post */
+#endif
 sv_setpv_mg(GvSV(gv), directive-filename);
 eval_sv(code, G_SCALAR|G_KEEPERR);
 SvREFCNT_dec(code);




svn commit: r209862 - /perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:10:18 2005
New Revision: 209862

URL: http://svn.apache.org/viewcvs?rev=209862view=rev
Log:
blead perl fix: casting warning

Modified:
perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h

Modified: perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h?rev=209862r1=209861r2=209862view=diff
==
--- perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h (original)
+++ perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h Fri Jul  8 12:10:18 2005
@@ -18,7 +18,7 @@
 Perl_newSVpvf(aTHX_ 0x%lx, (unsigned long)aTHX)
 #else
 #define mpxs_ModPerl__Util_current_perl_id() \
-Perl_newSVpvf(aTHX_ 0x%lx, 0)
+Perl_newSVpvf(aTHX_ 0x%lx, (unsigned long)0)
 #endif
 
 static MP_INLINE void mpxs_ModPerl__Util_untaint(pTHX_ I32 items,




svn commit: r209864 - /perl/modperl/trunk/Changes

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:14:59 2005
New Revision: 209864

URL: http://svn.apache.org/viewcvs?rev=209864view=rev
Log:
recent changes

Modified:
perl/modperl/trunk/Changes

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=209864r1=209863r2=209864view=diff
==
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Fri Jul  8 12:14:59 2005
@@ -12,6 +12,9 @@
 
 =item 2.0.2-dev
 
+Multiple fixes to make mod_perl 2.0 work with blead-perl (5.9.3+)
+[Stas]
+
 t/modules/reload.t would fail if run more than 3 times, breaking
 smokes [Gozer]
 




svn commit: r209871 - /perl/modperl/trunk/todo/release

2005-07-08 Thread stas
Author: stas
Date: Fri Jul  8 12:36:08 2005
New Revision: 209871

URL: http://svn.apache.org/viewcvs?rev=209871view=rev
Log:
things we need not forget to fix better

Modified:
perl/modperl/trunk/todo/release

Modified: perl/modperl/trunk/todo/release
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/release?rev=209871r1=209870r2=209871view=diff
==
--- perl/modperl/trunk/todo/release (original)
+++ perl/modperl/trunk/todo/release Fri Jul  8 12:36:08 2005
@@ -9,6 +9,23 @@
 
 -
 
+The following items need more work in order to work with blead-perl:
+
+http://svn.apache.org/viewcvs?rev=209859view=rev
+perl blead fix: in 5.9.3 HvPMROOT was completely removed, temporary
+using Perl_Imodglobal_ptr(thx)))-xmg_magic (which fails on perl_clone
+from ithreads, but otherwise works). this must be replaced with a
+better solution once we find it.
+
+http://svn.apache.org/viewcvs?rev=209861view=rev
+blead perl temp fix: some recent change introduced tainting problems,
+will remove the workaround once blead perl is fixed
+
+
+
+
+-
+
 MP_STATIC_EXTS=1 must link all extensions but APR.so. At the moment
 the following are not linked:
 




Re: Broken pipe Connection reset by peer

2005-07-07 Thread Stas Bekman
[Wendy, please do not email modperl-help /at/ perl.apache.org, it has 
nothing to do with the mod_perl, but used when you have problems with the 
the list itself]


Wendy Tan wrote:
I got numerous entries as following in the log. 


I have read mailing archives regarding this topic. To sum it up, it's
as follows. The server I set up is not a production server and there
are not many users. I do not understand why I have connection reset by
peer message since the server's CPU and message is still 95% idle. I
have followed standard instruction to configure httpd.conf.  The
entries show up only when https is used. Can I rule out anything
wrong with Apache, mod_perl and OpenSSL but blame on ISP/Network
Connection? Thank you for your help. (Server Version: Apache/1.3.33
(Unix) mod_perl/1.29 mod_ssl/2.8.22 OpenSSL/0.9.7f)


There is nothing wrong with any of the server-side components. It's the 
client that disconnects before getting a complete response.



1) That message happens when the client breaks the connection while
your script is trying to write to the client.  


2) client disconnect from you server

3) It may be worth noting
that I've so far only seen this behavior on SSL connections...

4) do not set LogLevel as 'info' and the entries will be gone - even
though I can not see it any more but it happened.


That's exactly what you need to do if you don't want to see the messages 
you've quoted below. For example set the LogLevel to 'error'.



I wonder why it happens because sometimes I got page can not displayed 
message when I
try to access the web page with https from IE 6 browser. 


May be some network glitches?


[Tue Jul  5 09:18:47 2005] [info] [client XX.XX.XX.XX] (32)Broken pipe:
client stopped connection before rwrite completed

[Tue Jul  5 09:18:47 2005] [debug] Apache.c(364): (32)Broken pipe:
mod_perl: rwrite returned -1 (fd=5, B_EOUT=8)\n

[Tue Jul  5 09:54:18 2005] [info] [client XX.XX.XX.XX] (104)Connection
reset by peer: client stopped connection before rwrite completed

[Tue Jul  5 09:54:18 2005] [debug] Apache.c(364): (104)Connection reset
by peer: mod_perl: rwrite returned -1 (fd=5, B_EOUT=8)\n




--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Modification of read only value attempted

2005-07-07 Thread Stas Bekman

Malte Ubl wrote:


Can you reproduce the problem at will?


Unfortunately not. Although I have seen the problem on our development 
system (where I was testing), the problem is not reproducable. As I said 
the live system doesn't behave deterministically either. The conditions 
under which is fails are always similar, but it doesn't fail always 
under these conditions.


I'd try to use ab or something similar on the dev machine to reproduce it. 
Do you know what script/args does it hit when you get this error? e.g. you 
could customise the $SIG{__DIE__} handler or put that code above in eval 
{} and log the args and the uri of the request that has caused the 
problem. However sometimes the error happens on the next request following 
the request that has triggered the problem.


Quite often the error line is reported incorrectly. You can always add 
something like:


#line 215
   $pr-{'code'} = $pr-{r}-slurp_filename;


I'll try that, but I haven't been able to reproduce the problem yet. Can 
I be sure that the reported file is right?


Normally it is correct. Unless someone has messed up with the low level C 
code that can change that.



For example $$ is readonly, so you get:



That is a good hint. I only had literals on my mind and I didn't think 
of special vars.


Our code is not using any specials variables though except %SIG for alarm.


I've used $$ just as an example, any variable can be affected.

If the error occurs, it seem to bubble from apache child to apache child 
like an infection (Although it seems to take a pretty long time (like 15 
Minutes)). That's why I always figured that this bug must be releated to 
source code that is being modified and copied to the children.


Could it be some environment issue? running out of disk space, RAM, etc.?

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Modification of read only value attempted

2005-07-07 Thread Stas Bekman

Malte Ubl wrote:
[...]
Our code is not using any specials variables though except %SIG for 
alarm.



I've used $$ just as an example, any variable can be affected.


How does a variable become read-only? Is that something that can be done 
on C/XS Level?


Yes. By setting the READONLY flag on the scalar. But it may happen as a 
result of some bug.


You also get a readonly variable if it's not a variable but a constant, e.g.:

perl -MDevel::Peek -le 'Dump aaa'
SV = PV(0x804c4a0) at 0x805b88c
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK)
  PV = 0x805e420 aaa\0
  CUR = 3
  LEN = 4

so for example if a function receives a string as an argument, e.g., 
foo(aaa) and then the function tries to modify its $_[0]'s argument you 
will get this error.


If the error occurs, it seem to bubble from apache child to apache 
child like an infection (Although it seems to take a pretty long time 
(like 15 Minutes)). That's why I always figured that this bug must be 
releated to source code that is being modified and copied to the 
children.




Could it be some environment issue? running out of disk space, RAM, etc.?



RAM would be possible. We'll look into that and maybe go down with 
MaxClients a little. It doesnt look like we have ever hit the SWAP though.


If you debug on the dev machine. it's important to run in the single 
server mode (-X), so you will see the error as soon as it happens and not 
wait through 50 or whatever the number of server you are running. see the 
mod_perl guide/the practical mod_perl book for more information.



--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


[JOB SEARCH] Looking for a new job

2005-07-06 Thread Stas Bekman

Hi,

First of all, I'd like to thank TicketMaster for sponsoring my full time 
work on the development and the support of the mod_perl project over the 
period of the last 3.5 years (!). Special thanks go to Craig McLane, who 
was my invisible supervisor all these years.


Finally mod_perl 2.0 is released and it's the time to move on and to jump 
into the deep waters and have fun in some other challenging projects.


I'm continuing to teach mod_perl 2.0 around the world till mid-August [1] 
and after that I'll be available for hire/consulting. So if you have some 
interesting projects you need help with please contact me.


At the moment my primary preference is to work on-site in Vancouver, BC, 
Canada. But if I won't find a satisfactory offer I'll certainly consider 
to telecommute. Obviously it'd be nice to use Perl, but I'm interested in 
exploring other areas as well :)


Thank you.

[1] http://stason.org/schedule.html

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Problems with DBI modperl on Irix 6.5

2005-07-06 Thread Stas Bekman

Robert Aspinall wrote:


I'm running modperl 1.29 on Apache 1.3.31 with Perl 5.8.2, running on
Irix 6.5.25m.

When I try to use the Apache::DBI module, I get the following


Can't load
'/opt/perl-5.8.2/lib/site_perl/5.8.2/IP27-irix/auto/DBI/DBI.so' for
module DBI: 71121247:/var/sgi_apache/server/sbin/httpd: rld: Fatal
Error: unresolvable symbol in
/opt/perl-5.8.2/lib/site_perl/5.8.2/IP27-irix/auto/DBI/DBI.so:
PL_curstackinfo at /opt/perl-5.8.2/lib/5.8.2/IP27-irix/DynaLoader.pm


Usually that's the case when you get a wrong perl library loaded. (not the 
one mod_perl was compiled with). Please take a look at:

http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_relocation_errors__or__undefined_symbol_

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


  1   2   3   4   5   6   7   8   9   10   >