Re: Next release of apr?

2003-01-07 Thread Kevin Pilch-Bisson
On Mon, Jan 06, 2003 at 09:36:32PM -0500, Craig Rodrigues wrote:
> Hi,
> 
> Is there any anticipated schedule for the release of apr-0.9.2?
> 
> I'm trying to track the development of Subversion, for the purpose
> of maintaining a FreeBSD Subversion port, and the Subverison developers
> basically compile their latest snapshots against HEAD of apr.
> 
Are you aware of the fact that there is already a free bsd port of subversion
maintained by Garrett Rooney <[EMAIL PROTECTED]>?

-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpy0dIN7ZnOn.pgp
Description: PGP signature


Re: APR_TMP_DIRECTORY

2002-12-04 Thread Kevin Pilch-Bisson
On Wed, Dec 04, 2002 at 05:56:38PM +, Thom May wrote:
> * David Reid ([EMAIL PROTECTED]) wrote :
> > If we don't have such a declare maybe we  should add one? I say this as
> > htpasswd.c (in httpd) uses P_tmpdir that isn't portable and breaks the beos
> > build. Also Thom found a note in his stdio.h file saying that it wasn't the
> > right way to do things, and I agree it's not.
> > 
> > I propose that it would simply take the form of a define
> > 
> > #define APR_TMP_DIRECTORY "/var/tmp"
> > 
> This sounds good. definable via configure, yes?

I'm not sure I like this, as windows temp directories depend on where certain
system folders live.
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp05VBsnAZpp.pgp
Description: PGP signature


Re: pipe hanging on win32

2002-10-01 Thread Kevin Pilch-Bisson
Quoting [EMAIL PROTECTED]:

> Quoting Kevin Pilch-Bisson <[EMAIL PROTECTED]>:
> 
> > I've attached a short example of what I am trying to do on in svn for
> > the  benefit of any apr folks who may be able to look at this.
> > 
> > Basically I'm calling the run_pre_revprop_change_hook(), and it's
> > hanging in apr_file_flush(...) specifically in FlushFileBuffers it seems.
> > 
> > The hook script (shown below), is hanging in getc().
> > 
> > Any ideas why this isn't working?
> > 
> > Note that log.txt never includes anything from stdin.
> > 
> > int main(int argc, char **argv)
> > {
> > std::ofstream file("log.txt");
> > file << "Repos is: " << argv[1] << std::endl;
> > file << "Rev is: " << argv[2] << std::endl;
> > file << "Propname is: " << argv[3] << std::endl;
> > while (!std::cin.eof()) {
> > std::string s;
> > std::cin >> s;
> 
> IIRC this is a fairly well-known bug in MS's implementation of the iostream
> library. It hangs in getc() because it doesn't check for end-of-file
> correctly.

Well that's fine except that the same thing happens in a propval with no line 
endings, or with DOS line endings or with Unix line endings.
> 
> > file << s << std::endl;
> 
> BTW, why are you breaking lines in the prop value like this? "std::cin >>
> s"
> will _not_ read a whole line of input.

I know, at this point I was just trying to see whether the hook got any input 
at all.
> 
> > }
> > file << std::ends;
> 
> Hm. Stuffing nulls into text files is not nice, either.
Doh! That was a mistake.
> 
> > file.close();
> > return 0;
> > }
> 
> 
> Anyway. Try rewriting that hook of yours in C, with appropriate eof checking.
> It
> has a good chance of working then. Or you might try to use "std::getline(cin,
> s,
> '\n')", maybe that doesn't tickle the same bug -- not to mention that lines
> will
> be broken correctly.
> 
> Brane
I don't think that's what the problem is.  My perl script which copied stdin 
to the log file had the same problem, I wrote the above hook just so that I 
could attach to it and see where it was hanging.

--
~~~
Kevin Pilch-Bisson
[EMAIL PROTECTED]
~~~


pipe hanging on win32

2002-09-30 Thread Kevin Pilch-Bisson
I've attached a short example of what I am trying to do on in svn for the 
benefit of any apr folks who may be able to look at this.

Basically I'm calling the run_pre_revprop_change_hook(), and it's hanging in 
apr_file_flush(...) specifically in FlushFileBuffers it seems.

The hook script (shown below), is hanging in getc().

Any ideas why this isn't working?

Note that log.txt never includes anything from stdin.

int main(int argc, char **argv)
{
std::ofstream file("log.txt");
file << "Repos is: " << argv[1] << std::endl;
file << "Rev is: " << argv[2] << std::endl;
file << "Propname is: " << argv[3] << std::endl;
while (!std::cin.eof()) {
std::string s;
std::cin >> s;
file << s << std::endl;
    }
    file << std::ends;
file.close();
return 0;
}

--
~~~
Kevin Pilch-Bisson
[EMAIL PROTECTED]
~~~svn_error_t *
svn_io_start_cmd(apr_proc_t *pcmd_proc,
 const char *path,
 const char *cmd,
 const char *const *args,
 svn_boolean_t inherit,
 apr_file_t *infile,
 apr_file_t *outfile,
 apr_file_t *errfile,
 apr_pool_t *pool)
{
  apr_status_t apr_err;
  apr_procattr_t *cmdproc_attr;
  unsigned int num_args;
  const char **args_native;
  const char *cmd_native;

  /* Create the process attributes. */
  apr_err = apr_procattr_create (&cmdproc_attr, pool); 
  if (apr_err)
return svn_error_createf
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error creating %s process attributes",
   cmd);

  /* Make sure we invoke cmd directly, not through a shell. */
  apr_err = apr_procattr_cmdtype_set (cmdproc_attr,
  inherit?APR_PROGRAM_PATH:APR_PROGRAM);

  if (apr_err)
return svn_error_createf 
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error setting %s process cmdtype",
   cmd);

  /* Set the process's working directory. */
  if (path)
{
  const char *path_native;

  SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));

  apr_err = apr_procattr_dir_set (cmdproc_attr, path_native);

  if (apr_err)
return svn_error_createf 
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error setting %s process directory",
   cmd);
}

  /* Use requested inputs and outputs.

 ### Unfortunately each of these apr functions creates a pipe and then
 overwrites the pipe file descriptor with the descriptor we pass
 in. The pipes can then never be closed. This is an APR bug. */
  if (infile)
{
  apr_err = apr_procattr_child_in_set (cmdproc_attr, infile, NULL);
  if (apr_err)
return svn_error_createf 
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error setting %s process child input",
   cmd);
}
  if (outfile)
{
  apr_err = apr_procattr_child_out_set (cmdproc_attr, outfile, NULL);
  if (apr_err)
return svn_error_createf 
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error setting %s process child outfile",
   cmd);
}
  if (errfile)
{
  apr_err = apr_procattr_child_err_set (cmdproc_attr, errfile, NULL);
  if (apr_err)
return svn_error_createf 
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error setting %s process child errfile",
   cmd);
}

  /* Convert cmd and args from UTF-8 */
  SVN_ERR (svn_utf_cstring_from_utf8 (&cmd_native, cmd, pool));
  for (num_args = 0; args[num_args]; num_args++)
;
  args_native = apr_palloc (pool, (num_args + 1) * sizeof(char *));
  args_native[num_args] = NULL;
  while (num_args--)
{
  SVN_ERR (svn_utf_cstring_from_utf8 (&args_native[num_args],
  args[num_args],
  pool));
}

  /* Start the cmd command. */ 
  apr_err = apr_proc_create (pcmd_proc, cmd_native, args_native, NULL,
 cmdproc_attr, pool);
  if (apr_err)
return svn_error_createf 
  (apr_err, 0, NULL, pool,
   "svn_io_start_cmd: error starting %s process",
   cmd);


  return SVN_NO_ERROR;
}

svn_error_t * 
svn_io_wait_for_cmd(apr_proc_t *cmd_proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_pool_t *pool)
{
  apr_status_t apr_err;
  apr_exit_why_e exitwhy_val;
  int exitcode_val;

  /* The Win32 apr_proc_wait doesn't set this... */
  exitwhy_val = APR_PROC_EXIT;

  /* Wait for the cmd command to fini

Re: NSLinkEditErrorHandlers....

2002-04-13 Thread Kevin Pilch-Bisson
On Sat, Apr 13, 2002 at 09:07:46AM -0700, Justin Erenkrantz wrote:
> On Sat, Apr 13, 2002 at 05:03:11PM +0100, Pier Fumagalli wrote:
> > On Darwin, if there's a link error (in APR-dso, if something goes wrong),
> > the program will exit without giving a chance to the caller to do anything:
> > 
> > #man NSModule
> > [...]
> >If the user does not supply these functions,  the  default
> >will  be to write an error message on to file descriptor 2
> >(usually stderr) and exit  the  program  (except  for  the
> >linkEdit   error  handler  when  the  NSLinkEditErrors  is
> >NSLinkEditWarningError, then the default is  to  do  noth-
> >ing).
> > [...]
> > 
> > "these functions" refer to a set of NSLinkEditErrorHandlers which should be
> > installed to alter the default behavior... Do you think it would be wise to
> > go ahead and install them?
> 
> Is there anything we can do other than exit?  -- justin

Well some code, like svn's plugin system, wants to attemp to load a dso to see
if it is there.  If it's not, that's fine, it just means that a certain method
of accessing the repository is unavailable.  Thus, failure to be able to loead
a dso shouldn't be a fatal error IMO.
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp91DGXhPT9x.pgp
Description: PGP signature


Re: [PATCH] Look for apr in /usr/local/apache2

2002-04-12 Thread Kevin Pilch-Bisson
On Fri, Apr 12, 2002 at 12:46:19AM -0400, Kevin Pilch-Bisson wrote:
> Not committing, as I can't put it into APR, 

This would have made more sense if I had actually cross posted to the
subversion dev list, which keeps a copy of these files that I could have
committed to.


-- 
~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpLhlzwcNvdz.pgp
Description: PGP signature


[PATCH] Look for apr in /usr/local/apache2

2002-04-12 Thread Kevin Pilch-Bisson
I've attached a patch to make find-ap*.m4 look in /usr/local/apache2, since
they are probably the most common places people are going to have apr and
apr-util installed (at least for a while).  Plus it saves me some typing on
the configure line :).

Not committing, as I can't put it into APR, and I'm not sure if there was a
reason it wasn't included in the first place.

Log:
* find_apr.m4, find_apu.m4: Also look in /usr/local/apache2, since it is
  apache's default install location.

Index: ./find_apr.m4
===
--- ./find_apr.m4
+++ ./find_apr.m4   Fri Apr 12 00:27:30 2002
@@ -77,7 +77,7 @@
   apr_config="apr-config"
 else
   dnl look in some standard places (apparently not in builtin/default)
-  for lookdir in /usr /usr/local /opt/apr ; do
+  for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do
 if $TEST_X "$lookdir/bin/apr-config"; then
   apr_found="yes"
   apr_config="$lookdir/bin/apr-config"
Index: ./find_apu.m4
===
--- ./find_apu.m4
+++ ./find_apu.m4   Fri Apr 12 00:27:15 2002
@@ -75,7 +75,7 @@
   apu_config="apu-config"
 else
   dnl look in the some standard places (apparently not in builtin/default)
-  for lookdir in /usr /usr/local /opt/apr ; do
+  for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do
 if test -x "$lookdir/bin/apu-config"; then
   apu_found="yes"
   apu_config="$lookdir/bin/apu-config"
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp6UM7v7JIKP.pgp
Description: PGP signature


Re: cvs commit: apr/network_io/unix sa_common.c sockets.c

2002-03-28 Thread Kevin Pilch-Bisson
On Thu, Mar 28, 2002 at 06:17:02PM -, [EMAIL PROTECTED] wrote:
>   
>   prototypes for the new function -- apr_set_sockaddr_vars() --

Wouldn't apr_sockaddr_vars_set be a more consistent name for the function?
-- 
~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpVpEbmSelXr.pgp
Description: PGP signature


find_apu.m4 needs to be smarter about installed locations.

2002-02-13 Thread Kevin Pilch-Bisson
Hey All,

I recently tried to configure and build subversion with apr and apr-util not
included in my subversion tree.

I have a directory structure like this:
projects/svn
projects/apr
projects/apr-util

I buildconf; ./configure --enable-maintainer-mode; make; su -c 'make install'
in both projects/apr and projects/apr-util, resulting in installed versions of
both in /usr/local.

Then I went into projects/svn and did ./autogen.sh; ./configure \
--enable-maintainer-mode --disable-shared.

Subversion's configure failed to find apr-util.  Here's my diagnoses of why.
It looks in a bunch of standard places for apr-util, including /usr/local, but
fails to link.  Why?  A bunch of necessary stuff is missing from the link
line.  First of all, there is no mention of -lapr.  Second, there are none of
the LDFLAGSS and LIBS needed by apr-util itself.

Fine I thought, I'll change it to find apu-config first and then add them in.
That didn't work because 1) apu-config doesn't mention needing apr, and 2)
apu-config --libs gives /usr/local/lib/libexpat.la which ld says is an invalid
file type.

Anyone with more autoconf experience want to step up to this one.  (Note that
it works find if I pass a --with-apr-util=/usr/local to subversion's configure
script).

-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpvabXdOm9cg.pgp
Description: PGP signature


Re: [PATCH] APR turn off readonly/executable, add apr_file_attrs_get

2002-02-03 Thread Kevin Pilch-Bisson
On Sat, Feb 02, 2002 at 08:34:44PM +, Philip Martin wrote:
> +#ifdef APR_HAS_THREADS
> +status = apr_thread_mutex_lock(umask_mutex);
> +if (!APR_STATUS_IS_SUCCESS(status))
> +return status;
> +#endif

Shouldn't this be 
#if APR_HAS_THREADS

i.e. isn't it always defined to either 0 or 1.

And the rest below...

-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpP6EZxQ9XTw.pgp
Description: PGP signature


Re: cvs commit: apr Makefile.in

2001-12-11 Thread Kevin Pilch-Bisson
On Tue, Dec 11, 2001 at 11:19:17AM -0800, Justin Erenkrantz wrote:
> On Tue, Dec 11, 2001 at 01:59:23PM -0500, Jeff Trawick wrote:
> > uhh, I trust it was by accident that you committed code without prior
> > discussion that used a feature that doesn't work on libtool < 1.4.? on
> > any platform ;)
> 
> The docs for libtool suggested this trick should work for all 
> platforms.
> 
> http://sources.redhat.com/autobook/autobook/autobook_77.html
> 
> There was no mention of it not working on AIX.  =)  But, given all
> of the DSO problems, I'm not surprised.
> 
> > The system refuses to load httpd because it doesn't know how to find
> > libaprutil.  I would guess that the library search path that libtool
> > records in the executable file is somehow hosed, but I have not had a
> > chance to look into it.
> 
> Are the libraries installed?  I know that libtool is supposed to do
> some rewriting of the paths when it "installs" the executable.
> Perhaps that isn't happening?  -- justin
> 

When libtool installs things we often see that banner that goes by saying
"to complete this installation you need to run libtool --finish $prefix/lib"
Which most people tend to ignore, because its a no-op on Linux.  Maybe it is
actually required but not performed on AIX?

Just a thought from someone who doesn't know much about libtool.
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpYB7giuccSW.pgp
Description: PGP signature


Re: umasks, apr_file_perms_set and APR_OS_DEFAULT

2001-11-22 Thread Kevin Pilch-Bisson
On Thu, Nov 22, 2001 at 02:48:15PM -0500, Kevin Pilch-Bisson wrote:
> Hi All,
> 
> I'm a developer on the subversion project, and one of the things I'm
> trying to do is make the files in the .svn administrative directory
> read-only.
> 
> In order to do that I have to play around with permissions on a bunch of
> files.  The problem I have run into is that if APR_OS_DEFAULT is is
> passed to apr_file_open, the resulting permissions are the result of the
> umask and APR_OS_DEFAULT.  However, if apr_file_perms_set is used, the
> umask doesn't get applied, and all my files end up being rwxrwxrwx.
> 
> Any ideas on a way to retrieve the umask, so that I can reliably use
> apr_file_perms_set to set file permissions to the users default
> preference?

For the sake of clarity, what I am doing now is this:

apr_fileperms_t uperms = apr_unix_mode2perms (umask (0777));
apr_fileperms_t perms = (APR_UREAD | APR_UWRITE | APR_GREAD
| APR_GWRITE | APR_WREAD | APR_WWRITE)
& ~uperms;
status = apr_file_perms_set (full_dest_path->data, perms);
umask ( apr_unix_perms2mode(uperms));


I would like to be able to do that in a portable way, since neither
umask nor apr_unix_perms2mode are portable.

Something like:

apr_fileperms_t perms = apr_umask(APR_OS_DEFAULT)
status = apr_file_perms_set(full_dest_path->data, APR_OS_DEFAULT & ~perms);
apr_umask(perms);

Doing this would require implementing apr_umask, and changing APR_OS_DEFAULT
from 0xFFF to 0x777.

What do people think?  I can write the patch for unix if people think
this approach is alright.  If not I would love to hear suggestions.
-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpGtuHLivj7d.pgp
Description: PGP signature


umasks, apr_file_perms_set and APR_OS_DEFAULT

2001-11-22 Thread Kevin Pilch-Bisson
Hi All,

I'm a developer on the subversion project, and one of the things I'm
trying to do is make the files in the .svn administrative directory
read-only.

In order to do that I have to play around with permissions on a bunch of
files.  The problem I have run into is that if APR_OS_DEFAULT is is
passed to apr_file_open, the resulting permissions are the result of the
umask and APR_OS_DEFAULT.  However, if apr_file_perms_set is used, the
umask doesn't get applied, and all my files end up being rwxrwxrwx.

Any ideas on a way to retrieve the umask, so that I can reliably use
apr_file_perms_set to set file permissions to the users default
preference?
-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp8Evf5iq3ng.pgp
Description: PGP signature


Re: [PATCH] Re: cvs commit: apr/threadproc/unix proc.c

2001-10-16 Thread Kevin Pilch-Bisson
On Tue, Oct 16, 2001 at 08:41:35AM -0400, Jeff Trawick wrote:
> Ryan Bloom <[EMAIL PROTECTED]> writes:
> 
> > On Monday 15 October 2001 10:38 am, Jeff Trawick wrote:
> > 
> > I seriously doubt that we want to extend the apr_proc_t type anymore.  
> > Having
> > this type be complete has caused Windows to have to jump through hoops to
> > keep track of processes correctly, and adding more to it is a
> > mistake IMO.
> 
> (rest of Ryan's comments omitted)
> 
> I'll reimplement according to your suggestions and post again.

Ryan's solution seems fine to me.  We're not usually too concerned with programs
exiting due to a signal, since we are just running diff, patch or a small
script.  Sorry to have overlooked that when I made the patch before.  Thanks for
noticing it Jeff.

> -- 
> Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
>http://www.geocities.com/SiliconValley/Park/9289/
>  Born in Roswell... married an alien...

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp9VUAU521A1.pgp
Description: PGP signature


Re: cvs commit: apr/threadproc/unix proc.c

2001-10-13 Thread Kevin Pilch-Bisson
On Sat, Oct 13, 2001 at 02:06:30PM -0400, Jeff Trawick wrote:
> Justin Erenkrantz <[EMAIL PROTECTED]> writes:
> 
> > On Fri, Oct 12, 2001 at 05:44:38PM -0400, Jeff Trawick wrote:
> > > no!!!  Because of this, we're returning APR_CHILD_NOTDONE when a
> > > child exits due to a signal (like SIGSEGV)...  thus Apache isn't able
> > > to see that the segfault happened and the log message is broken.
> > > 
> > > The old code had this correct. If waitpid() returns >0, a child has
> > > finished.  The WIF...() macros are just to find out how it finished
> > > (it chose to exit -- WIFEXITED, it got a signal -- WIFSIGNALED()).
> > 
> > Um, okay.  Is this acceptable?  -- justin
> > 
> > Index: threadproc/unix/proc.c
> > ===
> > RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
> > retrieving revision 1.49
> > diff -u -r1.49 proc.c
> > --- threadproc/unix/proc.c  2001/09/21 16:14:50 1.49
> > +++ threadproc/unix/proc.c  2001/10/13 15:00:27
> > @@ -390,9 +390,8 @@
> >  if (exitcode != NULL) {
> >  *exitcode = WEXITSTATUS(exit_int);
> >  }
> > -return APR_CHILD_DONE;
> >  }
> > -return APR_CHILD_NOTDONE;
> > +return APR_CHILD_DONE;
> >  }
> >  else if (pstatus == 0) {
> >  return APR_CHILD_NOTDONE;
> 
> The handling of the return code looks right, but as far as I can
> tell we're still missing the ability for the caller of
> apr_proc_wait_all_procs() (and thus the caller of
> ap_wait_or_timeout()) to know how the child exited, since exitcode is
> only updated if the child chose to exit.
> 
> I don't think apr_wait_t pretends to be some sort of portable
> the-process-chose-to-exit-with-this-return-code value, so it seems
> fine to feed back the raw OS status as we did before, whether the
> process exited normally or due to a signal.
As the one who proposed this patch, I thought I should jump in here.

WIFEXITED and WEXITSTATUS are not portable.  Applications may need more detail
than simply whether it exited due to a signal or not.  For example, subversion
has a pre-commit hook which prevents a commit if it returns non-zero.  We need
to be able to determine the exact return value.  It is also useful when we run
programs such as diff and patch, which return diagnostics via the exit code.

Maybe this isn't the right way to go about it, but I think there does need to 
be a way of determining what the process chose to exit with.

> 
> -- 
> Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
>http://www.geocities.com/SiliconValley/Park/9289/
>  Born in Roswell... married an alien...

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpVEB1AGy0yO.pgp
Description: PGP signature


[Patch] again

2001-09-21 Thread Kevin Pilch-Bisson
Here it is again with NULL checking.
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


Index: proc.c
===
RCS file: /home/cvspublic/apr/threadproc/unix/proc.c,v
retrieving revision 1.48
diff -u -r1.48 proc.c
--- proc.c  2001/09/20 08:59:31 1.48
+++ proc.c  2001/09/21 13:26:18
@@ -364,19 +364,8 @@
 APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, apr_wait_t 
*status,
   apr_wait_how_e waithow, 
apr_pool_t *p)
 {
-int waitpid_options = WUNTRACED;
-
-if (waithow != APR_WAIT) {
-waitpid_options |= WNOHANG;
-}
-
-if ((proc->pid = waitpid(-1, status, waitpid_options)) > 0) {
-return APR_CHILD_DONE;
-}
-else if (proc->pid == 0) {
-return APR_CHILD_NOTDONE;
-}
-return errno;
+proc->pid = -1;
+return apr_proc_wait(proc, status, waithow);
 } 
 
 APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
@@ -384,18 +373,24 @@
 apr_wait_how_e waithow)
 {
 pid_t pstatus;
+int waitpid_options = WUNTRACED;
+int exit_int;
 
-if (waithow == APR_WAIT) {
-if ((pstatus = waitpid(proc->pid, exitcode, WUNTRACED)) > 0) {
-return APR_CHILD_DONE;
+if (waithow != APR_WAIT) {
+waitpid_options |= WNOHANG;
+}
+
+if ((pstatus = waitpid(proc->pid, &exit_int, waitpid_options)) > 0) {
+if (proc->pid == -1) {
+proc->pid = pstatus;
 }
-else if (pstatus == 0) {
-return APR_CHILD_NOTDONE;
+if (WIFEXITED(exit_int)) {
+   if (exitcode != NULL) {
+   *exitcode = WEXITSTATUS(exit_int);
+   }
+return APR_CHILD_DONE;
 }
-return errno;
-}
-if ((pstatus = waitpid(proc->pid, exitcode, WUNTRACED | WNOHANG)) > 0) {
-return APR_CHILD_DONE;
+return APR_CHILD_NOTDONE;
 }
 else if (pstatus == 0) {
 return APR_CHILD_NOTDONE;


pgp42RYSrxzYs.pgp
Description: PGP signature


[Patch] simplify apr_proc_wait_all_procs, and normalize exitcode.

2001-09-21 Thread Kevin Pilch-Bisson
Here is a patch which makes the unix version of apr_proc_wait_all_procs
a simple wrapper around apr_proc_wait, and which extracts the exit code from
the status returned by waitpid.

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~

Index: proc.c
===
RCS file: /home/cvspublic/apr/threadproc/unix/proc.c,v
retrieving revision 1.48
diff -u -r1.48 proc.c
--- proc.c  2001/09/20 08:59:31 1.48
+++ proc.c  2001/09/21 13:04:21
@@ -364,19 +364,8 @@
 APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, apr_wait_t 
*status,
   apr_wait_how_e waithow, 
apr_pool_t *p)
 {
-int waitpid_options = WUNTRACED;
-
-if (waithow != APR_WAIT) {
-waitpid_options |= WNOHANG;
-}
-
-if ((proc->pid = waitpid(-1, status, waitpid_options)) > 0) {
-return APR_CHILD_DONE;
-}
-else if (proc->pid == 0) {
-return APR_CHILD_NOTDONE;
-}
-return errno;
+proc->pid = -1;
+return apr_proc_wait(proc, status, waithow);
 } 
 
 APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
@@ -384,18 +373,22 @@
 apr_wait_how_e waithow)
 {
 pid_t pstatus;
+int waitpid_options = WUNTRACED;
+int exit_int;
 
-if (waithow == APR_WAIT) {
-if ((pstatus = waitpid(proc->pid, exitcode, WUNTRACED)) > 0) {
-return APR_CHILD_DONE;
+if (waithow != APR_WAIT) {
+waitpid_options |= WNOHANG;
+}
+
+if ((pstatus = waitpid(proc->pid, &exit_int, waitpid_options)) > 0) {
+if (proc->pid == -1) {
+proc->pid = pstatus;
 }
-else if (pstatus == 0) {
-return APR_CHILD_NOTDONE;
+if (WIFEXITED(exit_int)) {
+*exitcode = WEXITSTATUS(exit_int);
+return APR_CHILD_DONE;
 }
-return errno;
-}
-if ((pstatus = waitpid(proc->pid, exitcode, WUNTRACED | WNOHANG)) > 0) {
-return APR_CHILD_DONE;
+return APR_CHILD_NOTDONE;
 }
 else if (pstatus == 0) {
 return APR_CHILD_NOTDONE;


pgp9MD9xDRdyx.pgp
Description: PGP signature


Re: apr_proc_wait status codes.

2001-09-20 Thread Kevin Pilch-Bisson
On Thu, Sep 20, 2001 at 12:33:06PM -0700, Ryan Bloom wrote:
> On Thursday 20 September 2001 11:53 am, William A. Rowe, Jr. wrote:
> > IMHO, these discrepancies should be hidden by our API.  E.g. we aught to
> > provide both an apr_status_t (with the return results matched up across
> > platforms, and added to our APR_statuses lists) and the processes' exit
> > code.
> >
> > APR_SUCCESS would mean the process _has_ terminated, here's the exit code
> > we can share with you.  IMHO exit code is undefined for all other results.
> 
> Our API already creates APR_CHILD_DONE and APR_CHILD_NOTDONE.  These
> are status codes, which is why APR_SUCCESS doesn't make sense here.  There is
> no success or failure, just status.
>
That's fine, what I wanted was the processes exit_code, which for unix would
probably be the value of WEXITSTATUS(status_code) under unix, and just the 
status code under win32, both of which only be valid under APR_CHILD_DONE.

> 
> Ryan
> 

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpS8FGeEroVs.pgp
Description: PGP signature


Re: apr_proc_wait status codes.

2001-09-20 Thread Kevin Pilch-Bisson
On Thu, Sep 20, 2001 at 01:53:54PM -0500, William A. Rowe, Jr. wrote:
> IMHO, these discrepancies should be hidden by our API.  E.g. we aught to
> provide both an apr_status_t (with the return results matched up across 
> platforms, and added to our APR_statuses lists) and the processes' exit code.
> 
> APR_SUCCESS would mean the process _has_ terminated, here's the exit code
> we can share with you.  IMHO exit code is undefined for all other results.

Sounds good to me, I just want to be able to portably check the exit code of
a finished process. However APR makes that possible is fine with me, as long
as it is possible.


> 
> Bill
> 
> 
> - Original Message - 
> From: "Bill Tutt" <[EMAIL PROTECTED]>
> To: "'Kevin Pilch-Bisson'" <[EMAIL PROTECTED]>; 
> Sent: Thursday, September 20, 2001 1:26 PM
> Subject: RE: apr_proc_wait status codes.
> 
> 
> > That would seem to make lots of sense. 
> > 
> > Bill
> > 
> > "Though we are not now that strength that in old days moved Earth and
> > Heaven, that which we are we are; One equal temper of heroic hearts made
> > weak by time and fate but strong in will to strive, to seek, to find,
> > and not to yield." -- Tennyson
> > 
> > 
> > 
> > -Original Message-
> > From: Kevin Pilch-Bisson [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, September 20, 2001 7:50 AM
> > To: dev@apr.apache.org
> > Subject: apr_proc_wait status codes.
> > 
> > 
> > Hi all,
> > 
> > I'm the one sort of reponsible for asking for return codes in 
> > apr_proc_wait (and thanks for how quickly they were added), but now I am
> > concerned about their portability.
> > 
> > My MSDN page for GetExitCodeProcess says it retrurns either 
> > STILL_ACTIVE or the return code for the process.  Meanwhile my linux
> > waitpid man page says that the status code must be acessed using
> > WIFEXITED, WEXITSTATUS, etc macros.
> > 
> > Perhaps we also need some APR_PROC_STATUS macros?
> > -- 
> > ~
> > Kevin Pilch-Bisson    http://www.pilch-bisson.net
> >  "Historically speaking, the presences of wheels in Unix
> >  has never precluded their reinvention." - Larry Wall
> > ~
> > 
> > 
> 

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp0nAXRngacB.pgp
Description: PGP signature


apr_proc_wait status codes.

2001-09-20 Thread Kevin Pilch-Bisson
Hi all,

I'm the one sort of reponsible for asking for return codes in 
apr_proc_wait (and thanks for how quickly they were added), but now I am
concerned about their portability.

My MSDN page for GetExitCodeProcess says it retrurns either 
STILL_ACTIVE or the return code for the process.  Meanwhile my linux
waitpid man page says that the status code must be acessed using
WIFEXITED, WEXITSTATUS, etc macros.

Perhaps we also need some APR_PROC_STATUS macros?
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpeU3Bc0Kuus.pgp
Description: PGP signature


Re: APR != HTTPD :) (Was: Re: problem with mod_webapp)

2001-06-30 Thread Kevin Pilch-Bisson
On Sat, Jun 30, 2001 at 12:20:31AM +0100, David Reid wrote:
> > Ian Holsman at [EMAIL PROTECTED] wrote:
> >
> > > On 29 Jun 2001 11:53:47 -0700, Kevin Pilch-Bisson wrote:
> > >> On Fri, Jun 29, 2001 at 10:28:46AM -0700, Justin Erenkrantz wrote:
> > >>> I guess I'd see what Subversion does - do they
> > >>> require an "installed" APR, or do they ask for the location of the
> > >>> source?  -- justin
> > >>>
> > >> Subversion requires apr source to be present in subversion/apr.
> 
> Why?  If we have shared libraries available can't it just use those?  I mean
> at present I'm not sure apache can, so this whole area needs some looking at
> yet.
Not yet unfortunately, although this is planned once apr stabilizes a bit.
It is mostly to ensure that when people cvs up subversion, they get apr up to 
date as well.
> 
> If you're building subversion on the same system as apache can you tell
> either apache or subversion where to look for the source?  ISTR this is
> something we've talked about for apache before now. AFAIK not done anything
> about it yet.
> 
Likewise not yet, which is a real pain since the subversion server actually 
requires apache 2.0.

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpNBirzIphrX.pgp
Description: PGP signature


Re: problem with mod_webapp

2001-06-29 Thread Kevin Pilch-Bisson
On Fri, Jun 29, 2001 at 10:28:46AM -0700, Justin Erenkrantz wrote:
> I guess I'd see what Subversion does - do they
> require an "installed" APR, or do they ask for the location of the
> source?  -- justin
> 
Subversion requires apr source to be present in subversion/apr.
-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpuAg7Gi50hk.pgp
Description: PGP signature


Re: apr_realpath

2001-03-15 Thread Kevin Pilch-Bisson
On Wed, Mar 14, 2001 at 03:29:49PM -0600, William A. Rowe, Jr. wrote:
> From: "Kevin Pilch-Bisson" <[EMAIL PROTECTED]>
> Sent: Wednesday, March 14, 2001 3:08 PM
> 
> 
> > > > Would there be a way to convert an incomplete path to a complete path?
> > > > (change drive to c:, getpwd, append foo, in the above example)
> > > 
> > > That is what apr_filepath_merge does for you.  You can pass a partial 
> > > root [/ or d:]
> > > apr_filepath_root over to apr_filepath_merge as the addpath (with a null 
> > > root).  That
> > > will return a true root.  apr_filepath_root is as much to help 
> > > apr_filepath_merge
> > > (and any other app) break apart the root from a name, since the root is 
> > > very platform
> > > specific (moreso than any other part of this debate.)  Look at netware 
> > > machine/sys:/
> > > versus win32/os2, toss in unc names and unix remote volumes and ugh, what 
> > > a mess.
> > > 
> > I believe you, I am just a little confused as to the process.  Say I do
> > the following:
> > 
> > C:\mywork\subversion\ > svn commit C:foo
> > 
> > which eventually reaches the following code.
> > 
> > char added_path[][] = { "C:foo", NULL };
> > (or should this be { "C:", "foo", NULL }; ?)
> > char *newpath;
> > apr_filepath_merge(&newpath, NULL, added_path, APR_FILEPATH_TRUEPATH, p);
> > 
> > What do I get back from apr_filepath_merge?  Or more to the point, how
> > can I get C:\mywork\subversion\foo as newpath?
> 
> Simply, rootpath == NULL uses CWD, therefore c:\mywork\subversion.
> 
> 
> char *newpath = "foo"
> char **addpath = &newpath
> char **newpath;
> 
> apr_filepath_merge(&newpath, NULL, addpath, APR_FILEPATH_TRUEPATH, p);
> 
> If foo exists, newpath == "c:\mywork\subversion\foo", and addpath += 4
> (points to the trailing NULL of the string you passed).
> 
> If foo is not found, newpath == "c:\mywork\subversion\" and addpath didn't
> change (the path wasn't found.
> 
> If you pass "foo/bar" as addpath, and foo exists, then ".../foo/" is retured
> for newpath, and addpath += 4 (pointing at "bar") if bar was not found.
> 
> Of course, without APR_FILEPATH_TRUEPATH, the whole thing just returns, and
> doesn't care if the path names are real.  With APR_FILEPATH_TRUECASE, those
> parts that exist are returned with the correct case followed by the remaining
> given path, since it also doesn't care if the files exist, only that the
> names that exist are the proper case.  Both of these would set point addpath
> to it's own trailing NULL.
> 
> The Q. remains, do we want char** addpath, or simply a char* with no feedback
> of existing v.s. nonexisting path components?
> 
> Bill
> 
> 
Right.  Now say the target was D:foo, but my current drive was C:, as in
D:\mywork\subversion> C:
C:\Program Files\Subversion> svn commit D:foo

How do I find out that D:foo is really D:\mywork\subversion\foo?

On another note, I thought of another root case to be handled under
UNIX.  Cygwin with windows drives.  I.e. / is %SYSDRIVE%:\, but //c/ is
C:\ and //d/ is D:\.  The double slashes are important to cygwin.

What a PITA.  Sometimes I don't know whether I am glad for cygwin
because it makes having to use 'Doze at work less annoying, or pissed of
because of the hassle it makes for real unix development!
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


Re: apr_realpath

2001-03-14 Thread Kevin Pilch-Bisson
On Wed, Mar 14, 2001 at 12:34:39PM -0600, [EMAIL PROTECTED] wrote:
> Kevin Pilch-Bisson <[EMAIL PROTECTED]> writes:
> 
> > Sorry, I think it has to do with the way mutt handles pgp signing
> > messages.  I'm not going to sign this one, so hopefully it won't do so.
> > 
> > Offhand, which pathetic win32 client.
> 
> X-Mailer: Microsoft Outlook Express 5.50.4133.2400
> 
> Just a guess. :-)
> 
Doh! I have ignores set up for most standard mail headers.

Don't I feel silly.
> 

-- 
~~~~~~~~~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


Re: apr_realpath

2001-03-14 Thread Kevin Pilch-Bisson
On Wed, Mar 14, 2001 at 09:38:21AM -0600, William A. Rowe, Jr. wrote:
> From: "Kevin Pilch-Bisson" <[EMAIL PROTECTED]>
> Sent: Wednesday, March 14, 2001 7:48 AM
> 
> >> Attachment
> 
> Huge favor, if you would, look into why all your posts are going in as text 
> file
> attachments?  At least they appear so on my pathetic Win32 email client.

Sorry, I think it has to do with the way mutt handles pgp signing
messages.  I'm not going to sign this one, so hopefully it won't do so.

Offhand, which pathetic win32 client.

> 
> To answer your questions:
> 
> apr_filepath_merge(char **newpath, char *rootpath, char **addedpath, 
> APR_FILEPATH_TRUEPATH, p)
> 
> would allow us to take rootpath of '/usr/local/bin' and addedpath of 
> 'apache/secure/conf',
> merge them into '/usr/local/bin/apache/' [an existing path] and leave 
> addedpath pointing
> to 'secure/conf' [the non-existant portion of addedpath.]  The user can do 
> whatever they like
> to make them work.

[snip explanation]

OOhhh, now I understand.  I like!

> 
> My only other 'simple' solution, if that flag is passed, is to append a 
> second string following
> the null of the root string.  If they pass that flag, the user is guarenteed 
> a second null 
> (even if the entire given path was existed, so the non-existant result is 
> empty.)
> 
> Since that is alien to everything we have done in APR, I'm hesistant to try 
> it.

No, no, no.  I don't like that at all.
> 
> 
> I didn't miss your question on comparing paths, we need to add these other 
> functions:

Actually, for now I think I can do what I need with just
apr_filepath_merge, with NULL, rootpath arguments.  (We have existing
svn functions to do the rest, although in time they would probably be
re-worked to use the below).

> 
> apr_status_t apr_filepath_root(char** pathroot, char** name, apr_pool_t *p)
> Which returns the canonical form of the pathroot and returns the first 
> non-root
> part of name (e.g. '/foo' is '/' 'foo' on unix, 'c:\foo' is 'c:\' 'foo' 
> and
> '//machine/share/foo' is '//machine/share/' 'foo' on win32)
> Handles incomplete roots ('c:foo' on win32 is 'c:', 'foo', but returns a 
> status
> of APR_EINCOMPLETE).

Would there be a way to convert an incomplete path to a complete path?
(change drive to c:, getpwd, append foo, in the above example)
> 
> apr_status_t apr_filepath_elements_count(int *n, char *path)
> counts the elements given in the file path.  
> [counts the root as one element]
> 
> apr_status_t apr_filepath_elements_get(char **segments, char *path, int 
> first, int last, apr_pool_t *p)
> returns the requested elements of the file path.
> All even numbered elements are delimiters, so 0 is the delimited root,
> 1 is the first name, 2 is the delimiter, 3 is the second name.
> While more complex, this presupposes some platform could have a multi-byte
> delimiter (unlikely, but consider a utf-8 path delimiter char that is more
> than a single byte, not true of '/' or '\', but it's easier to code for it
> now than change it later.)
> 
> The even/odd theory falls apart for relative paths like foo/bar unless we 
> return an
> empty string for foo, so this needs more thought.

Will keep thinking about this.

> 
> apr_status_t apr_filepath_common(char** result, char* a, char* b, apr_pool_t 
> *p)
> returns the segments that match, comparing from the beginning.
> The user must canonicalize the paths first with apr_filepath_merge.
> /foo/bar compared to /foo/barstool  returns  /foo/
> compare does not distinguish between '/' and '\' on win32/os2 - they 
> compare equal.
> If a and b were char**, we could point at the first uncommon element, but 
> a strlen
> of result provides the same answer, no?  [This isn't true of the above 
> example that
> is changing the case, eliminating trailing '.'s and ' 's from win32 
> names, and 
> converting short aliases to true names).
> 
> Canonicalizing first to the truename is required before apr_filepath_common 
> can be
> trusted on Win32 or OS2, since c:/thislongname/ is also c:/THISLO~1/

Canonicalizing is done by apr_filepath_merge, with NULL rootpath, right?
> 
> Bill

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


Re: apr_realpath

2001-03-14 Thread Kevin Pilch-Bisson
ove the root path.
>   * 
>   *
>   * @param status The APR_status code to check.
> @@ -236,6 +240,10 @@
>  /* empty slot: +17 */
>  /* empty slot: +18 */
>  #define APR_EDSOOPEN   (APR_OS_START_ERROR + 19)
> +#define APR_EABSOLUTE  (APR_OS_START_ERROR + 20)
> +#define APR_ERELATIVE  (APR_OS_START_ERROR + 21)
> +#define APR_EINCOMPLETE(APR_OS_START_ERROR + 22)
> +#define APR_EABOVEROOT (APR_OS_START_ERROR + 23)
> 
> 
>  /* APR ERROR VALUE TESTS */
> @@ -258,6 +266,10 @@
>  /* empty slot: +17 */
>  /* empty slot: +18 */
>  #define APR_STATUS_IS_EDSOOPEN(s)   ((s) == APR_EDSOOPEN)
> +#define APR_STATUS_IS_EABSOLUTE(s)  ((s) == APR_EABSOLUTE)
> +#define APR_STATUS_IS_ERELATIVE(s)  ((s) == APR_ERELATIVE)
> +#define APR_STATUS_IS_EINCOMPLETE(s)((s) == APR_EINCOMPLETE)
> +#define APR_STATUS_IS_EABOVEROOT(s) ((s) == APR_EABOVEROOT)
> 
> 
>  /* APR STATUS VALUES */
> Index: include/apr_file_info.h
> ===
> RCS file: /home/cvs/apr/include/apr_file_info.h,v
> retrieving revision 1.13
> diff -u -r1.13 apr_file_info.h
> --- include/apr_file_info.h 2001/02/16 04:15:43 1.13
> +++ include/apr_file_info.h 2001/03/13 07:32:36
> @@ -246,7 +246,9 @@
> 
>  /**
>   * Read the next entry from the specified directory.
> - * @param thedir the directory descriptor to read from, and fill out.
> + * @param finfo the file info structure and filled in by apr_dir_read
> + * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ 
> values
> + * @param thedir the directory descriptor returned from apr_dir_open
>   * @tip All systems return . and .. as the first two files.
>   * @deffunc apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t 
> wanted, apr_dir_t *thedir)
>   */
> @@ -260,6 +262,49 @@
>   */
>  APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
> 
> +/* apr_filepath flags
> + */
> +
> +/* Cause apr_filepath_merge to fail if addpath is above rootpath */
> +#define APR_FILEPATH_NOTABOVEROOT   0x01
> +
> +/* internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT */
> +#define APR_FILEPATH_SECUREROOTTEST 0x02
> +
> +/* Cause apr_filepath_merge to fail if addpath is above rootpath,
> + * even given a rootpath /foo/bar and an addpath ../bar/bash
> + */
> +#define APR_FILEPATH_SECUREROOT 0x03
> +
> +/* Fail apr_filepath_merge if the merged path is relative */
> +#define APR_FILEPATH_NOTRELATIVE0x04
> +
> +/* Fail apr_filepath_merge if the merged path is absolute */
> +#define APR_FILEPATH_NOTABSOLUTE0x08
> +
> +/* Cleans all ambigious /./  or // segments
> + * if the target is a directory */
> +#define APR_FILEPATH_CANONICAL  0x10
> +
> +/* Resolve the true case of existing directories and file elements
> + * of addpath, and append a proper trailing slash if a directory
> + */
> +#define APR_FILEPATH_TRUECASE   0x20
> +
> +
> +/**
> + * Merge additional file path onto the previously processed rootpath
> + * @param newpath the merged paths returned
> + * @param rootpath the root file path (NULL uses the current working path)
> + * @param addpath the path to add to the root path
> + * @param flags the desired APR_FILEPATH_ rules to apply when merging
> + * @param p the pool to allocate the new path string from
> + * @deffunc apr_status_t apr_filepath_merge(char **newpath, const char 
> *rootpath, const char *addpath, apr_int32_t flags,
> apr_pool_t *p)
> + */
> +APR_DECLARE(apr_status_t)
> +apr_filepath_merge(char **newpath, const char *rootpath,
> +   const char *addpath, apr_int32_t flags,
> +   apr_pool_t *p);
> 
>  #ifdef __cplusplus
>  }
> 
> 
> 
> 
> 

Have fun with this :)

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpTS2DzgsVfY.pgp
Description: PGP signature


Re: cvs commit: apr-util/xml/expat Makefile.in

2001-03-12 Thread Kevin Pilch-Bisson
On Sun, Mar 11, 2001 at 01:03:40PM -, [EMAIL PROTECTED] wrote:
>   -all: $(SUBDIRS)
>   +all: build-subdirs
>
>.PHONY: all $(SUBDIRS) clean distclean maintainer-clean dist install \
>uninstall distdir

Shouldn't you add build-subdirs to .PHONY now?

>   @@ -105,9 +105,11 @@
>   CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADERS) \
>   $(SHELL) ./config.status
>
>   -$(SUBDIRS): config.status
>   -   cd $@; $(MAKE)
>   -
>   +build-subdirs:
>   +   @list='$(SUBDIRS)'; \
>   +   for dir in $$list; do \
>   + cd $$dir; $(MAKE); cd ..; \
>   +   done
>
>clean:
>   @list='$(SUBDIRS)'; for dir in $$list; do \
>   
>   
>   
> 

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpVzgKvVfr0P.pgp
Description: PGP signature


Re: apr_realpath

2001-03-05 Thread Kevin Pilch-Bisson
On Sun, Mar 04, 2001 at 03:17:02PM -, David Reid wrote:
> This all looks good, but I wonder if also having a simple function along the
> lines of unix's realpath wouldn't be a useful addition as well.  I'd
> envisage soemthing whereby you just pass a path and it returns the full path
> using the current directory as a starting point.  I can see room for both as
> they do slightly different things.
> 
> Basically,
> if I have just a path relative to where I am now ... use apr_realpath
> I want a full path based on a location plus a relative path ... use
> apr_dir_merge
> 
> In some ways I'm not sure we'd ever use apr_realpath in apache, but other
> projects may well find it useful.
For example, this is exactly what Subversion needs from realpath.
Basically, given n paths, we want to find the common root of all the
paths.  Obviously this involves comparisons of the absolute path.
> 
> Comments.
> 
> david
> - Original Message -
> From: "William A. Rowe, Jr." <[EMAIL PROTECTED]>
> To: "David Reid" <[EMAIL PROTECTED]>; "APR Development List"
> 
> Sent: Sunday, March 04, 2001 6:09 AM
> Subject: Re: apr_realpath
> 
> 
> > Here's what I envision...
> >
> > #define APR_DM_TRUECASE   0x01
> > #define APR_DM_NOTABOVEROOT   0x02
> > #define APR_DM_NOTRELATIVE0x04
> > #define APR_DM_NOTABSOLUTE0x08
> > #define APR_DM_CANONICAL  0x10
> >
> > apr_status_t apr_dir_merge(char *newpath, const char *rootpath, const char
> *addpath,
> >apr_int32_t flags, apr_pool_t *p)
> >
> > Where rootpath may be null, but only newpath elements are proper cased.
> Why?
> > Since getting the true case is a slow operation, and we can trust rootpath
> either
> > doesn't matter (true name only instead of true path) or was already
> truecased, we
> > are halfway to the finish line :-)  Also, don't assume root path is
> absolute.  It
> > could simply be 'foo' and addpath could be 'bar', resulting in foo/bar.
> Or in that
> > same example, addpath could be '../../bar', resulting in '../bar'
> (relative to foo).
> >
> > NOTABOVEROOT means addpath can't be '../bar' [technically, it could.
> Should we allow
> > the case where root /foo/bar + '../bar' is not above root?]  Note that
> NOTABOVEROOT
> > precludes returning a relative name that is '../anything', since that is
> above whatever
> > root path it would be concatinated to, later.
> >
> > NOTABSOLUTE and NOTRELATIVE mean just what they suggest.  Note that if the
> product
> > is not absolute, the name is never truecased.
> >
> > Dirmerge will resolve all '..', '.', '//' and other pathing issues into a
> canonical
> > form, iff CANONICAL is flagged.  If not, a slash will be added iff the
> rootpath isn't
> > slash terminated, e.g. 'foo' 'bar' will become 'foo/bar', but 'test/'
> 'path' won't
> > ever inherit an extra slash, ever if CANONICAL is not specified.
> >
> > Note especially, the rootpath is presumed to have been processed through
> the
> > appropriate TRUECASE and CANONICAL filters, and _only_ the addpath is
> parsed
> > by those rules.  We are essensially asking, take this root, fix up this
> addpath,
> > and give us the new (more) complete path.
> >
> > Doing all of these operations as single-pass should be quite quick.  Can
> we all
> > live with this API?  Other ideas, suggestions or pointers to my
> ommissions?
> >
> > Sorry I couldn't wrap this today (and would like to read the feedback to
> this
> > proposal.)  It's as fast as I can picture, and should work for 98% of the
> needs.
> > Comments are welcome.
> >
> > Bill
> >
> >
> >
> >
> > - Original Message -
> > From: "David Reid" <[EMAIL PROTECTED]>
> > To: "APR Development List" 
> > Sent: Saturday, March 03, 2001 9:55 AM
> > Subject: apr_realpath
> >
> >
> > > Did we ever get a point of agreeing if we wanted to add apr_realpath?  I
> > > seem to have deleted the emails concerning it but ISTR that there was a
> > > patch?
> > >
> > > david
> > >
> > >
> >
> 
> 

-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgp2b5vgW1Oxj.pgp
Description: PGP signature


[PATCH]: Use $(builddir)/build for @INCLUDE_RULES@

2001-02-19 Thread Kevin Pilch-Bisson
Hi all,

Just noticed that since the move of helper files to apr/build, vpath
builds don't work anymore, since APR tries to include rules.mk from the
srcdir, but it is generated in the builddir.  This patch fixes that.


Index: configure.in
===
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.228
diff -u -p -r1.228 configure.in
--- configure.in2001/02/18 15:52:12 1.228
+++ configure.in2001/02/19 14:19:49
@@ -31,7 +31,9 @@ if test "$abs_builddir" != "$abs_srcdir"
 fi
 
 dnl Directory containing apr build macros, helpers, and make rules
+dnl NOTE: make rules (rules.mk) will be in the builddir for vpath builds.
 apr_builders=$abs_srcdir/build
+apr_built_builders=$abs_builddir/build
 AC_SUBST(apr_builders)
 
 MKDIR=$apr_builders/mkdir.sh
@@ -920,10 +922,10 @@ dnl BSD/OS (BSDi) needs to use a differe
 dnl
 case "$host_alias" in
 *bsdi*)
-INCLUDE_RULES=".include \"$apr_builders/rules.mk\""
+INCLUDE_RULES=".include \"$apr_built_builders/rules.mk\""
 ;;
 *)
-INCLUDE_RULES="include $apr_builders/rules.mk"
+INCLUDE_RULES="include $apr_built_builders/rules.mk"
 ;;
 esac
 AC_SUBST(INCLUDE_RULES)
-- 
~
Kevin Pilch-Bissonhttp://www.pilch-bisson.net
 "Historically speaking, the presences of wheels in Unix
 has never precluded their reinvention." - Larry Wall
~


pgpGOE1mYqNae.pgp
Description: PGP signature


Re: cvs commit: apr/file_io/unix dir.c

2001-02-13 Thread Kevin Pilch-Bisson
On Mon, Feb 12, 2001 at 04:11:55PM -0600, William A. Rowe, Jr. wrote:
> From: "Jeff Trawick" <[EMAIL PROTECTED]>
> Sent: Monday, February 12, 2001 3:42 PM
> 
> 
> > apr.hw:
> > 
> > Move this code from include/arch/win32/fileio.h to apr.hw but also add
> > any needed includes (what are they?):
> > 
> > #if APR_HAS_UNICODE_FS
> > /* An arbitrary size that is digestable. True max is a bit less than
> > 32000 */
> > #define APR_PATH_MAX 8192
> > #define APR_FILE_MAX MAX_PATH
> > #else /* !APR_HAS_UNICODE_FS */
> > #define APR_PATH_MAX MAX_PATH
> > #define APR_FILE_MAX MAX_PATH
> > #endif
> 
> 
> The MAX_PATH comes from windows.h, which is included right off the top in 
> apr.hw.
> 
> 
> > apr.h.in:
> > 
> > include sys/limits.h and limits.h then
> > 
> > #if defined(PATH_MAX)
> > #define APR_PATH_MAX PATH_MAX
> > #elif defined(_POSIX_PATH_MAX)
> > #define APR_PATH_MAX _POSIX_PATH_MAX
> > #else
> > #error Fix APR_PATH_MAX for your platform.
> > #endif
> > 
> > -- 
> > Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
> >    http://www.geocities.com/SiliconValley/Park/9289/
> >  Born in Roswell... married an alien...
> > 

Has it been decided that this will happen?  If so, any idea when?

-- 
>
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net
PGP Public Key At http://pgp.pilch-bisson.net


pgp40EhAJHBTB.pgp
Description: PGP signature


Re: Feature request realpath(3) wrapper

2001-02-13 Thread Kevin Pilch-Bisson
On Mon, Feb 12, 2001 at 02:44:17PM -0600, William A. Rowe, Jr. wrote:
> In the works :-)

Anything I can help you with, I have access to a Solaris 2.5 box, and a
Linux glibc 2.1 box.  Not exactly the most obscure machines I know, but
I will do my best if you need me to do anything.

-- 
>~~~~
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net
PGP Public Key At http://pgp.pilch-bisson.net


pgprVDXxJmUhw.pgp
Description: PGP signature


Feature request realpath(3) wrapper

2001-02-12 Thread Kevin Pilch-Bisson
Hi All,

In doing some work for Subversion, I came accross a need to convert
relative pathnames to absolute pathnames.  Now realpath works under
Linux, but I am told it is broken under some versions of Solaris
(although it works for 2.5), and doesn't exist under win32(although
there is _fullpath).  I have no idea about BeOS. 

Is this something that anyone on the APR team would like to implement in
a nice portable fashion?

--
>~~~~
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net
PGP Public Key At http://pgp.pilch-bisson.net


pgp7E9PDwZvgp.pgp
Description: PGP signature


Re: apr_ function prefixes

2001-02-07 Thread Kevin Pilch-Bisson
On Tue, Feb 06, 2001 at 03:05:30PM -0800, Greg Stein wrote:
> On Tue, Feb 06, 2001 at 09:38:16AM -0500, Kevin Pilch-Bisson wrote:
> >...
> > +1 for this, but only if it is done soon.  As Ryan said recently, APR is
> > approaching the Beta stage, so API's shouldn't change much.  However, I
> > think this is a useful change.
> 
> A little process comment here: Ryan is a single voice out of all of us here.
> I want to see a "beta" also, but just because Ryan or I say so doesn't make
> it true.
> 
> Basically, we release it as a beta when we (the group) think it is a beta.
> 
My apologies if I stepped on any toes.  I didn't mean to say that Ryan
had the final say or anything like that.  I was just referring to the
fact that Ryan recently suggested not changing API's much, because APR
was approaching Beta.  All I meant to say was that I thought this change
was important, even though it _DOES_ in fact change those API's, but
that it should be done soon if it is done, because the API should be
stable once APR is `Beta'd.

If you interpreted it differently, please rest assured that this was all
I meant to imply.
-- 
>
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net
PGP Public Key At http://pgp.pilch-bisson.net


pgptqEvaU4ZLR.pgp
Description: PGP signature


Re: apr_ function prefixes

2001-02-06 Thread Kevin Pilch-Bisson
On Mon, Feb 05, 2001 at 09:21:55PM -0800, Doug MacEachern wrote:
> there's a number of places where apr (and httpd) is not consistent with
> prefixes or doesn't use one at all (beyond apr_ or ap_).
> personally, i like to see functions named with the prefix of the base type
> (struct) they operate on if possible.  for example, apr_xlate_t related
> functions all have an apr_xlate_ prefix, this is goodness.  for certain
> types, many, but not all related functions use a consistent prefix
> (e.g. apr_table_t), for some there is no prefix at all.
> i know this might be considered "late in the game", but in reality apr is
> very young software.  consistent/meaningful naming should start now,
> rather than 2 years down the road when i suspect it'll be in pretty
> widespread use.  below are some suggestions, i think i still have a
> rename script handy if there's consensus to move forward on some or all.
> 


Although I haven't been much of a contributor to APR, I have been
working with the Subversion group a little bit, so I lurk around here,
since this stuff affects subversion too.  I would have to say that I am
+1 for this, but only if it is done soon.  As Ryan said recently, APR is
approaching the Beta stage, so API's shouldn't change much.  However, I
think this is a useful change.

-- 
>
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net
PGP Public Key At http://pgp.pilch-bisson.net


pgpzCYvtYe3Rx.pgp
Description: PGP signature


Another patch for configure.in

2001-01-23 Thread Kevin Pilch-Bisson
Hi again,

Modified: configure.in
Log: Changed the definition of LIBTOOL_LIBS to use the abs_builddir
instead of abs_srcdir.

RevisionChanges Path
1.213   1   configure.in


Index: configure.in
===
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.213
diff -u -p -r1.213 configure.in
--- configure.in2001/01/23 16:26:28 1.213
+++ configure.in2001/01/23 19:16:47
@@ -168,7 +168,7 @@ if test "$ac_cv_enable_shmem" = "mm"; th
   sharedmem="1"
   anonymous_shm="1"
   AC_MSG_RESULT(anonymous)
-  LIBTOOL_LIBS="$abs_srcdir/shmem/unix/mm/libmm.la"
+  LIBTOOL_LIBS="$abs_builddir/shmem/unix/mm/libmm.la"
 elif test "$ac_cv_enable_shmem" = "file"; then
   sharedmem="1"
   filebased_shm="1"

-- 
>
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net


pgpVaUIGrEmRB.pgp
Description: PGP signature


Two small patches

2001-01-23 Thread Kevin Pilch-Bisson
Hi all,

I have recently been contributing to the subversion project, and one of
the things I am looking at is the build.  I noticed that APR would not
do a build from a different directory properly and came up with this
small patch to configure.in to make it work.  The second patch is for
file_io/unix/dir.c which was using a `dirent *' where it needed a `struct
dirent *'.  Hope these help.  I did them as two different patches since
the two problems were so unrelated.

Modified: configure.in
Log: Changed top_builddir to use $abs_builddir instead of $abs_srcdir

RevisionChanges Path
1.212   1   configure.in

Index: configure.in
===
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.212
diff -u -p -r1.212 configure.in
--- configure.in2001/01/23 06:16:29 1.212
+++ configure.in2001/01/23 14:39:43
@@ -23,7 +23,7 @@ abs_srcdir=`(cd $srcdir && pwd)`
 abs_builddir=`pwd`
 
 dnl Libtool needs this symbol
-top_builddir="$abs_srcdir"
+top_builddir="$abs_builddir"
 AC_SUBST(top_builddir)
 
 dnl Get location of helpers directory


Modified: file_io/unix/dir.c
Log: Changed `dirent *' to `struct dirent *'

RevisionChanges Path
1.451   file_io/unix/dir.c

Index: file_io/unix/dir.c
===
RCS file: /home/cvspublic/apr/file_io/unix/dir.c,v
retrieving revision 1.45
diff -u -p -r1.45 dir.c
--- file_io/unix/dir.c  2001/01/23 06:16:48 1.45
+++ file_io/unix/dir.c  2001/01/23 14:40:06
@@ -115,7 +115,7 @@ apr_status_t apr_dir_read(apr_finfo_t *f
 apr_status_t ret = 0;
 #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
 && !defined(READDIR_IS_THREAD_SAFE)
-dirent *retent;
+struct dirent *retent;
 
 ret = readdir_r(thedir->dirstruct, thedir->entry, &retent);
 
-- 
>
Kevin Pilch-Bisson
[EMAIL PROTECTED]
http://www.pilch-bisson.net


pgpEVh3yB3E2a.pgp
Description: PGP signature