BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000668 [uClibc] Standards Compliance minor always 01-30-06 19:02 02-03-06 19:02
Reporter rfelker View Status public  
Assigned To uClibc
Priority normal Resolution no change required  
Status closed   Product Version
Summary 0000668: opendir should not set FD_CLOEXEC
Description uClibc opendir sets FD_CLOEXEC. This contradicts POSIX which says
either the parent or child may continue using the directory handle,
just not both.
Additional Information
Attached Files

- Relationships

- Notes
(0001034)
vapier
02-03-06 18:32

glibc uses FD_CLOEXEC and it was added to uClibc due to POSIX conformance

http://www.opengroup.org/onlinepubs/009695399/functions/exec.html [^]
exec() has this to say:
Directory streams open in the calling process image shall be closed in the new process image.

http://www.opengroup.org/onlinepubs/009695399/functions/opendir.html [^]
opendir() has this to say:
Based on historical implementations, the rules about file descriptors apply to directory streams as well. However, this volume of IEEE Std 1003.1-2001 does not mandate that the directory stream be implemented using file descriptors. The description of closedir() clarifies that if a file descriptor is used for the directory stream, it is mandatory that closedir() deallocate the file descriptor. When a file descriptor is used to implement the directory stream, it behaves as if the FD_CLOEXEC had been set for the file descriptor.

so, since our opendir() utilizes file descriptors in the backend, it sounds like using the FD_CLOEXEC on the file descriptor is the correct behavior
 
(0001035)
rfelker
02-03-06 18:58

OK, then this is a bug in POSIX. See:
http://www.opengroup.org/onlinepubs/009695399/functions/rewinddir.html [^]
which reads:
"After a call to the fork() function, either the parent or child (but not both) may continue processing the directory stream using readdir(), rewinddir(), or [XSI] [Option Start] seekdir(). [Option End] If both the parent and child processes use these functions, the result is undefined."

Bleh.
 
(0001036)
vapier
02-03-06 19:00

i dont see how that is related ...

FD_CLOEXEC closes file descriptors after a call to an exec() function, not a call to fork()
 
(0001037)
rfelker
02-03-06 19:01

Yes, stupid me for misreading. Consider this issue closed then.
 
(0001038)
vapier
02-03-06 19:02

np
 

- Issue History
Date Modified Username Field Change
01-30-06 19:02 rfelker New Issue
01-30-06 19:02 rfelker Status new => assigned
01-30-06 19:02 rfelker Assigned To  => uClibc
02-03-06 18:32 vapier Note Added: 0001034
02-03-06 18:58 rfelker Note Added: 0001035
02-03-06 19:00 vapier Note Added: 0001036
02-03-06 19:01 rfelker Note Added: 0001037
02-03-06 19:02 vapier Note Added: 0001038
02-03-06 19:02 vapier Status assigned => closed
02-03-06 19:02 vapier Resolution open => no change required


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker