Summary: | DT_UNKNOWN happens on Debian when reading a file from CD | ||
---|---|---|---|
Product: | glibc | Reporter: | Siward de Groot <siward> |
Component: | manual | Assignee: | Roland McGrath <roland> |
Status: | RESOLVED INVALID | ||
Severity: | minor | CC: | glibc-bugs |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Siward de Groot
2006-04-17 22:31:43 UTC
P.S. Where i said 'file' i mean regular file. Directories on CDROM have type DT_DIR. When you say "reading a file" what glibc function are you calling? When you say "the manual" what manual are you referring to and what section in the manual are you referring to? Can you propose text which you think would resolve this problem? Subject: Re: DT_UNKNOWN happens on Debian when reading a file from CD On Wednesday 19 April 2006 22:47, decimal at us dot ibm dot com wrote: > > ------- Additional Comments From decimal at us dot ibm dot com 2006-04-19 20:47 ------- > When you say "reading a file" what glibc function are you calling? > > When you say "the manual" what manual are you referring to and what section in > the manual are you referring to? info libc, both my version i downloaded at 20050115 and latest version on gnu.org 15 - File System Interface 15.2 - Accessing Directories READING AND CLOSING A DIRECTORY pf struct dirent * readdir( DIR * pd ) > Can you propose text which you think would resolve this problem? Current text : 15.2 - Accessing Directories FORMAT OF A DIRECTORY ENTRY DATATYPE struct dirent unsigned char d_type This is type of file, possibly unknown. following constants are defined for its value : DT_UNKNOWN Type is unknown. On some systems this is only value returned. DT_REG A regular file. Proposed text : unsigned char d_type This is type of file, possibly unknown. following constants are defined for its value : DT_UNKNOWN Type is unknown. On Debian this can occur when reading files and directories from CDROM, in that case stat() does show correct filetype. On some systems this is only value returned. ---- It probably happens on all linuxes, not just debian, but i have only seen this on debian. It may be relevant that i am using a 2.6 kernel, so that the ATAPI CDROM is seen by the kernel as a SCSI device, without me needing to specify any append clause in my /etc/lilo.conf --- TEST : #include <stdio.h> #include <dirent.h> #include <sys/stat.h> int main( void ){ DIR * pd ; struct dirent * psd ; struct stat stats ; int ck ; pd = opendir("/cdrom"); if( pd == NULL ){ printf("NULL opendir1\n"); return(0); } while( NULL != (psd = readdir( pd ) ) ){ if( 0 == strcmp( psd->d_name, "README.html") ){ printf("name=%s type=%d DT_UNKNOWN=%d\n",psd->d_name, psd->d_type, DT_UNKNOWN ); } if( 0 == strcmp( psd->d_name, "debian") ){ printf("name=%s type=%d DT_UNKNOWN=%d\n",psd->d_name, psd->d_type, DT_UNKNOWN ); } } ck = stat("/cdrom/README.html", &stats ); if( ck != 0 ){ printf("no stat"); } printf("mode=%d isreg=%d isdir=%d\n", stats.st_mode, S_ISREG(stats.st_mode), S_ISDIR(stats.st_mode) ); ck = stat("/cdrom/debian" , &stats ); if( ck != 0 ){ printf("no stat"); } printf("mode=%d isreg=%d isdir=%d\n", stats.st_mode, S_ISREG(stats.st_mode), S_ISDIR(stats.st_mode) ); return(0); } TESTOUTPUT: name=debian type=0 DT_UNKNOWN=0 name=README.html type=0 DT_UNKNOWN=0 mode=33060 isreg=1 isdir=0 mode=16749 isreg=0 isdir=1 ---------------------------------------------------------------------------- geen Windows maar Linux :-) (In reply to comment #1) > P.S. Where i said 'file' i mean regular file. > Directories on CDROM have type DT_DIR. > OOPS. that was not correct. directories also report DT_UNKNOWN The description is clear, read it again: "This is type of file, possibly unknown.". We will not add distribution specific information. |