opendir(/dev/fd/n) should fail

Helmut Karlowski helmut.karlowski@ish.de
Fri Jan 23 10:30:00 GMT 2015


--------------------------------------------------
Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:
(23/01/2015 10:43)

> > numerous entries ...
> 
> This occurs on Linux as well, just with a few less entries in
> fd (42 rather than 560).  These descriptors are apparently
> created by bash for some reason I don't know, and our bash seems
> to create some more descriptors than the newler bash on Linux.

It's not just bash. The same happens in my home-grown shell. Starting 
with /dev/fd/3 opendir succeeds giving (only the opendir-entries):

[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/0/',prefix_len=12,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/1/',prefix_len=12,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/2/',prefix_len=12,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/',prefix_len=12,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/0/',prefix_len=14,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/1/',prefix_len=14,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/2/',prefix_len=14,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/',prefix_len=14,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/0/',prefix_len=16,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/1/',prefix_len=16,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/2/',prefix_len=16,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/',prefix_len=16,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/0/',prefix_len=18,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/1/',prefix_len=18,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/2/',prefix_len=18,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/',prefix_len=18,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/0/',prefix_len=20,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/1/',prefix_len=20,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/2/',prefix_len=20,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/',prefix_len=20,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/0/',prefix_len=22,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/1/',prefix_len=22,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/2/',prefix_len=22,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/',prefix_len=22,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/0/',prefix_len=24,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/1/',prefix_len=24,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/2/',prefix_len=24,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/3/',prefix_len=24,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/3/0/',prefix_len=26,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/3/1/',prefix_len=26,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/3/2/',prefix_len=26,hasdot=0,fignore=484444:''
[ 752:3] 
globit:ksh_opendir:'/dev/fd/3/3/3/3/3/3/3/3/3/',prefix_len=26,hasdot=0,fignore=484444:

...

Linux seems to have  has a similar bug.

-Helmut

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list