Opened 13 years ago

Closed 13 years ago

#246 closed defect (wontfix)

Outdated Information about file handles

Reported by: dmik Owned by: bird
Priority: normal Milestone:
Component: baselayout Version:
Severity: major Keywords:
Cc:

Description

If the process connects its stdin/out/err handles to pipes using DosDupHandle() and then starts a child with spawn*() (perhaps, fork too?), isatty() called in the child one will return 1 for stdin/out/err while they are actually pipes, not character devices any longer.

In fact, calling isatty() in the parent process after DosDupHandle() will continue to return 1 too.

My guess is that once LIBC has cached imported file handle information, it is never refreshed. I see these options:

  1. Don't cache information for imported file handles but instead always fetch it from the system. The question is the performance impact.
  1. Provide a custom libc extension (available to end user programs) that resets the cache of imported file handles. This extension is to be called by the end user program when it manipulates file handles bypassing LIBC (as in case of DosDupHandle()) as well as by spawn*() and fork().
  1. A combination of 1 and 2. I.e. reset the cache for the particular handle in public calls like isatty() but still use the cached information internally (i.e. through libc_FH, etc.). This should not have a big performance impact and still free the programmer from caring about this cache at all (which is a good thing).

Change History (2)

comment:1 by dmik, 13 years ago

Hmm, given that _imphanlde(), dup() and dup2() all work as expected (including named pipe handles created by DosCreateNPipe) , this defect is actually a no-problem and may be closed.

Version 0, edited 13 years ago by dmik (next)

comment:2 by dmik, 13 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.