Re: [PHP-DEV] [patch] solaris getcwd() brokeness

[email protected] (Andi Gutmans) Tue, 11 Mar 2003 23:23:48 +0200
Newsgroups php.dev
Message-ID <[email protected]>
I think the patch is OK. I'm not extremely happy with it because I don't 
think it's very beautiful but I didn't have time to think of a better way 
of fixing it.
I think he can go ahead and commit it but I'd like there to be comments in 
the source code to explain why those checks on state->cwd_length are being 
made. This will help ppl understand this weirdness later on...

Andi

At 04:38 PM 3/10/2003 +0200, Jani Taskinen wrote:

>     Andi, what's the status with this?
>
>     --Jani
>
>
>On Sun, 23 Feb 2003, Wez Furlong wrote:
>
> >Hi Andi (and James)
> >
> >Andi: I'd appreciate your comments on this patch, specifically if there
> >are any concerns about it doing the right thing.
> >
> >Most people here:
> >http://bugs.php.net/bug.php?id=21310&edit=1
> >
> >report that it fixes their problems with solaris.
> >
> >I've held off from looking at this, as I didn't want to duplicate any
> >effort you have been making.
> >
> >--Wez.
> >
> >On Sun, 16 Feb 2003, Andi Gutmans wrote:
> >
> >> At 03:41 PM 2/13/2003 -0500, James E. Flemer wrote:
> >> >RCS file: /repository/TSRM/tsrm_virtual_cwd.c,v
> >> >retrieving revision 1.41
> >> >diff -u -b -r1.41 tsrm_virtual_cwd.c
> >> >--- TSRM/tsrm_virtual_cwd.c     6 Nov 2002 18:07:22 -0000       1.41
> >> >+++ TSRM/tsrm_virtual_cwd.c     13 Feb 2003 20:40:07 -0000
> >> >@@ -303,7 +303,7 @@
> >> >                 return (0);
> >> >
> >> >  #if !defined(TSRM_WIN32) && !defined(NETWARE)
> >> >-       if (IS_ABSOLUTE_PATH(path, path_length)) {
> >> >+       if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length 
> < 1)) {
> >> >                 if (use_realpath && realpath(path, resolved_path)) {
> >> >                         path = resolved_path;
> >> >                         path_length = strlen(path);
> >>
> >> Will realpath() work in cases where getcwd() didn't work? (btw it's nicer
> >> to check state->cwd_length == 0 than < 1 IMO).
> >>
> >> >@@ -363,6 +363,7 @@
> >> >         }
> >> >
> >> >
> >> >+  if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) {
> >> >         ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
> >> >         while (ptr) {
> >> >                 ptr_length = strlen(ptr);
> >> >@@ -416,6 +417,11 @@
> >> >                 state->cwd[state->cwd_length+1] = '\0';
> >> >                 state->cwd_length++;
> >> >         }
> >> >+  } else {
> >> >+       state->cwd = (char *) realloc(state->cwd, path_length+1);
> >> >+       memcpy(state->cwd, path, path_length+1);
> >> >+       state->cwd_length = path_length;
> >> >+  }
> >>
> >> I'm trying to think if there's some other way of doing this. What is the
> >> main problem in this loop? Does it add  / or c:\ in the beginning of the
> >> string?
> >>
> >> Andi
> >>
> >>
> >> --
> >> PHP Development Mailing List <http://www.php.net/>
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
> >
> >
>
>--
><- For Sale! ->