This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug manual/2581] DT_UNKNOWN happens on Debian when reading a file from CD
- From: "siward at wanadoo dot nl" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 27 Apr 2006 08:15:15 -0000
- Subject: [Bug manual/2581] DT_UNKNOWN happens on Debian when reading a file from CD
- References: <20060417223143.2581.siward@wanadoo.nl>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From siward at wanadoo dot nl 2006-04-27 08:15 -------
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 :-)
--
http://sourceware.org/bugzilla/show_bug.cgi?id=2581
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.