From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1351 invoked by alias); 27 Apr 2006 08:15:19 -0000 Received: (qmail 1272 invoked by alias); 27 Apr 2006 08:15:15 -0000 Date: Thu, 27 Apr 2006 08:15:00 -0000 Message-ID: <20060427081515.1271.qmail@sourceware.org> From: "siward at wanadoo dot nl" To: glibc-bugs@sources.redhat.com In-Reply-To: <20060417223143.2581.siward@wanadoo.nl> References: <20060417223143.2581.siward@wanadoo.nl> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug manual/2581] DT_UNKNOWN happens on Debian when reading a file from CD X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00360.txt.bz2 List-Id: ------- 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 #include #include 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.