Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#323 closed defect (fixed)

spawnlp() does not check if an entry is a directory

Reported by: KO Myung-Hun Owned by:
Priority: normal Milestone: libc-0.7
Component: libc-frontend Version: 0.6.6
Severity: trivial Keywords: _path _path2 _searchenv _searchenv2 _searchenv2_value
Cc:

Description

Hi/2.

If a directory whose name is same as [name] exist in a current dir or maybe in PATH, spawnlp() fails. spawnlp() and its families should check if [name] is a directory when searching the executable for [name].

Attachments (1)

spawn.c (279 bytes) - added by KO Myung-Hun 10 years ago.
testcase

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by KO Myung-Hun

Attachment: spawn.c added

testcase

comment:1 Changed 10 years ago by bird

Component: libclibc-frontend
Keywords: _path _path2 _searchenv _searchenv2 _searchenv2_value added
Resolution: fixed
Severity: normaltrivial
Status: newclosed

No, won't happen if it's within EMXPATH or PATH, only for the current directory.

The _searchenv2 / _searchenv2_value would pass on EISDIR from the current directory iff the path variable (EMXPATH) wasn't set in the environment. This would stop _path2() from searching the PATH. Fixed in r3941 (both trunk + branch).

(Note! This is not new behavior, EMX always did this, even for matching directories within EMXPATH and PATH. kLibC 0.6.6 attempted to improve on this and this one problem slipped thru.)

comment:2 Changed 10 years ago by KO Myung-Hun

emx(maybe and kLIBC older than 0.6.6) does not this behavior. However, this is because emx adds .exe to a file name not having an extension by default. If there is a directory whose name is [name].exe, emx will fail.

This problem have been hidden so far. Lucky.

Note: See TracTickets for help on using tickets.