patchmake - Patches: patch #6811, Fix for bug in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #6811: Fix for bug in win32/subproc/sub_proc.c

Submitter:  Rafi Einstein <rafi_einstein>
Submitted:  Sun 19 Apr 2009 05:59:06 PM UTC
   
 
Category:  None Priority:  7 - High
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Fixed Release:  None

Sun 18 Jul 2010 11:36:14 PM UTC, comment #5: 

This was applied a while ago.

Paul D. Smith <psmith>
Group administrator
Mon 14 Sep 2009 06:23:52 PM UTC, comment #4: 

You are right.  Fixed with the attached patch.

Regarding item #2, I still feel that the current code does an adequate job with PATH and Path.  If you have evidence to the contrary, please show it.


(file #18717)

Eli Zaretskii <eliz>
Group Member
Mon 14 Sep 2009 01:49:25 AM UTC, comment #3: 

Re: #1: ep will never be null, because it points to the array that envp points to (well, in this case it might be null if someone passes a null pointer to process_begin() for this argument).  What might be null is ep.  Just like in main(char *argv), argv will never be null but *argv might.

I used this code:

        if (envp) {
                char **ep;
                for (ep = envp; *ep; ep++) {
                        if (strncmp (*ep, "PATH=", 5) == 0
                            || strncmp (*ep, "Path=", 5) == 0) {
                                path_var = *ep + 5;
                                break;
                        }
                }
        }


This is not GNU style but I kept the existing style.

Paul D. Smith <psmith>
Group administrator
Sun 13 Sep 2009 07:59:02 PM UTC, comment #2: 

Regarding Item #1: sorry, I must be dense (maybe because it's too late), because I don't understand the problem.  On Windows, the only NULL pointer in the environ[] array is the last one, and the for loop which uses `ep' only runs as long as `ep' is non-NULL.  What am I missing?

Regading Item #2: Make on Windows alsways takes care to define PATH whose value is identical to Path.  See the function sync_Path_environment on variable.c.  Does this resolve the problem?  If not, please be more specific about real-life use-cases where such problems happen.

Thanks.

Eli Zaretskii <eliz>
Group Member
Sat 12 Sep 2009 10:45:47 PM UTC, comment #1: 

I agree with item #1.

Item #2 should be done with strcasecmp(), rather than copying/converting the string.

However, I don't know if this is correct or not for Windows; can the PATH env. var. truly have any case at all?  Eli, do you have a comment on this?

Paul D. Smith <psmith>
Group administrator
Sun 19 Apr 2009 05:59:06 PM UTC, original submission:  

In function begin_process().
Two problems:
(1) *ep can be null at end of environment.
(2) PATH specification can be of arbitrary case in certain shells (4NT/TakeCommand for instance).

Should replace:
for (ep = envp; ep; ep++) {
if (strncmp (*ep, "PATH=", 5) == 0
    || strncmp (*ep, "Path=", 5) == 0) {
path_var = *ep + 5;
break;
}
}

with:

char path_str[6];
int j;

for (ep = envp; ep && *ep; ep++) {
strncpy(path_str, *ep, 5);
path_str[5] = '\0';
for (j = 0; j < 4; ++j)
path_str[j] = toupper(path_str[j]);
if (strncmp (path_str, "PATH=", 5) == 0) {
path_var = *ep + 5;
break;
}
}

Rafi Einstein <rafi_einstein>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #18717:  epnull.dif added by eliz (1KiB - application/vnd.ms-excel)
file #17964:  sub_proc.c.patch added by rafi_einstein (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eliz (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by rafi_einstein (Submitted the item)
  • -email is unavailable- added by rafi_einstein
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-18 psmith StatusNone Done
        Open/ClosedOpen Closed
    2009-09-14 eliz Attached File- Added epnull.dif, #18717
    2009-04-19 rafi_einstein Attached File- Added sub_proc.c.patch, #17964
        Carbon-Copy- Added rafi_einstein

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code