Re: PerlIO :APR / apr_file_open() flag issue

2009-04-25 Thread Jeff Trawick
The only issue I could see is if APR_WRITE was addeed
at some point somewhat recently, and this change would break
against older APRs.

APR_READ and/or APR_WRITE has been required since the first APR release.
Here's the logic to check for APR_READ/APR_WRITE back in 1999 (still called
ap_open at that point):

(
http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/file_io/unix/open.c?revision=59512view=markup
)

*if* ((flag  APR_READ)  (flag  APR_WRITE)) {

}
*else* *if* (flag  APR_READ) {

}
*else* *if* (flag  APR_WRITE) {

}
*else* {
*return* APR_EACCES;
}



-- Forwarded message --
From: Philippe M. Chiasson go...@apache.org
To: Marc Adkins madk...@marchex.com
Date: Mon, 20 Apr 2009 23:51:57 -0400
Subject: Re: PerlIO :APR / apr_file_open() flag issue
On 20/04/09 19:59 , Marc Adkins wrote:
 Originally posted to the APR dev list.  The response (from jTrawick) was
 as follows:

 The Perl code that builds the apr_file_open() flags needs to turn on
 APR_WRITE.

 I think that this patch to mod_perl is what you need:

 --- modperl_apr_perlio.c.orig2007-12-31 02:39:50.0 -0500
 +++ modperl_apr_perlio.c2009-04-20 19:37:25.954107404 -0400
 @@ -85,7 +85,7 @@

  switch (*mode) {
case 'a':
 -apr_flag = APR_APPEND | APR_CREATE;
 +apr_flag = APR_WRITE | APR_CREATE | APR_APPEND;
  break;
case 'w':
  apr_flag = APR_WRITE | APR_CREATE | APR_TRUNCATE;


 The rest of this email is my original post.  I would still like a
 workaround is one exists.

Looks sensible to me. The only issue I could see is if APR_WRITE was
addeed at some point somewhat recently, and this change would break
against older APRs. Might need a version check of some sort.

Otherwise, +1


signature.asc
Description: PGP signature


Re: PerlIO :APR / apr_file_open() flag issue

2009-04-22 Thread Marc Adkins
So are there no work-arounds for this?  I notice that there seems to be 
only the PerlIO interface to the APR file I/O functionality.  If there 
was a more direct Perl API (wherein I could pass the flags I want) this 
wouldn't be an issue.


Philippe M. Chiasson wrote:

On 20/04/09 19:59 , Marc Adkins wrote:
  

Originally posted to the APR dev list.  The response (from jTrawick) was
as follows:

The Perl code that builds the apr_file_open() flags needs to turn on
APR_WRITE.

I think that this patch to mod_perl is what you need:

--- modperl_apr_perlio.c.orig2007-12-31 02:39:50.0 -0500
+++ modperl_apr_perlio.c2009-04-20 19:37:25.954107404 -0400
@@ -85,7 +85,7 @@
 
 switch (*mode) {

   case 'a':
-apr_flag = APR_APPEND | APR_CREATE;
+apr_flag = APR_WRITE | APR_CREATE | APR_APPEND;
 break;
   case 'w':
 apr_flag = APR_WRITE | APR_CREATE | APR_TRUNCATE;


The rest of this email is my original post.  I would still like a
workaround is one exists.



Looks sensible to me. The only issue I could see is if APR_WRITE was
addeed at some point somewhat recently, and this change would break
against older APRs. Might need a version check of some sort.

Otherwise, +1

  



--
Marc M. Adkins
Software Development Engineer
520 Pike Street, Suite 500
Seattle, WA  98101
P: 206-331-3508
F: 206.331.3695
E: madk...@marchex.com

Marchex Inc.
www.marchex.com

This e-mail message and any attachments are solely for
intended recipients, and may contain information that is
privileged and confidential.  If you are not the intended
recipient, any dissemination, distribution or copying is
strictly prohibited.  If you believe that you may have
received this message in error, please immediately notify
the sender by replying to this e-mail message. 



Re: PerlIO :APR / apr_file_open() flag issue

2009-04-20 Thread Philippe M. Chiasson
On 20/04/09 19:59 , Marc Adkins wrote:
 Originally posted to the APR dev list.  The response (from jTrawick) was
 as follows:
 
 The Perl code that builds the apr_file_open() flags needs to turn on
 APR_WRITE.
 
 I think that this patch to mod_perl is what you need:
 
 --- modperl_apr_perlio.c.orig2007-12-31 02:39:50.0 -0500
 +++ modperl_apr_perlio.c2009-04-20 19:37:25.954107404 -0400
 @@ -85,7 +85,7 @@
  
  switch (*mode) {
case 'a':
 -apr_flag = APR_APPEND | APR_CREATE;
 +apr_flag = APR_WRITE | APR_CREATE | APR_APPEND;
  break;
case 'w':
  apr_flag = APR_WRITE | APR_CREATE | APR_TRUNCATE;
 

 The rest of this email is my original post.  I would still like a
 workaround is one exists.

Looks sensible to me. The only issue I could see is if APR_WRITE was
addeed at some point somewhat recently, and this change would break
against older APRs. Might need a version check of some sort.

Otherwise, +1

-- 
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm)\.org/



signature.asc
Description: OpenPGP digital signature