Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#323 closed defect (fixed)

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

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



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 komh 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by komh


comment:1 Changed 5 years ago by bird

  • Component changed from libc to libc-frontend
  • Keywords _path _path2 _searchenv _searchenv2 _searchenv2_value added
  • Resolution set to fixed
  • Severity changed from normal to trivial
  • Status changed from new to closed

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 5 years ago by komh

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.