From owner-freebsd-bugs Tue Dec 5 11:20:11 2000 From owner-freebsd-bugs@FreeBSD.ORG Tue Dec 5 11:20:03 2000 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0500E37B401 for ; Tue, 5 Dec 2000 11:20:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id eB5JK2h13241; Tue, 5 Dec 2000 11:20:02 -0800 (PST) (envelope-from gnats) Resent-Date: Tue, 5 Dec 2000 11:20:02 -0800 (PST) Resent-Message-Id: <200012051920.eB5JK2h13241@freefall.freebsd.org> Resent-From: gnats-admin@FreeBSD.org (GNATS Management) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: gnats-admin@FreeBSD.org, Jim.Pirzyk@disney.com Received: from mail.disney.com (mail.disney.com [204.128.192.15]) by hub.freebsd.org (Postfix) with ESMTP id D5C5137B402 for ; Tue, 5 Dec 2000 11:16:45 -0800 (PST) Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100]) by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id eB5JGcp06283 for ; Tue, 5 Dec 2000 11:16:39 -0800 (PST) Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Tue, 5 Dec 2000 11:17:23 -0800 Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2]) by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id LAA27656 for ; Tue, 5 Dec 2000 11:16:43 -0800 (PST) (envelope-from root@snoopy.fan.fa.disney.com) Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [153.7.117.170]) by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id LAA05477 for ; Tue, 5 Dec 2000 11:16:43 -0800 (PST) (envelope-from root@snoopy.fan.fa.disney.com) Received: (from root@localhost) by snoopy.fan.fa.disney.com (8.11.1/8.9.3) id eB5JGr169436; Tue, 5 Dec 2000 11:16:54 -0800 (PST) (envelope-from root@snoopy.fan.fa.disney.com) Message-Id: <200012051916.eB5JGr169436@snoopy.fan.fa.disney.com> Date: Tue, 5 Dec 2000 11:16:54 -0800 (PST) From: Jim.Pirzyk@disney.com Sender: MailHub.Postmaster@disney.com Reply-To: Jim.Pirzyk@disney.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/23300: make assumes readdir return '.' and '..' first Resent-Sender: gnats@FreeBSD.org Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 23300 >Category: bin >Synopsis: make assumes readdir returns '.' and '..' for the first two calls. >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 05 11:20:02 PST 2000 >Closed-Date: >Last-Modified: >Originator: Jim Pirzyk >Release: FreeBSD 4.2-RELEASE i386 >Organization: >Environment: the /usr/src tree mounted over NFS from an SGI IRIX server running XFS. >Description: The readdir on a specific NFS dir will not return '.' and '..' as the first entries. Make assumes that the first two calls to readdir will return those. The make fails because it cannot find the file 'S' (which is returned second, see below) >How-To-Repeat: Running this short C program shows that '.' and '..' are not the first two entries returned by readdir. --- listdir.c --- #include #include #include void main (int argc, char *argv[]) { int i; for (i = 1; i < argc; i++) { (void)list_files (argv[i]); } } void list_files (char *dir) { DIR *d = opendir (dir); struct dirent *dp; if ( d ) { while (dp=readdir(d)) { printf ("%s\n", dp->d_name); } } else { printf ("Could not open %s\n", dir); } closedir(dir); } --- output from listdir (run by ./listdir /usr/src/contrib/groff/devX100 ) --- . S .. CB CI CR HB HI HR NB NI NR TB TI TR CBI HBI NBI TBI DESC >Fix: *** ./usr.bin/make/dir.c.orig Tue Dec 5 10:54:57 2000 --- ./usr.bin/make/dir.c Tue Dec 5 11:05:40 2000 *************** *** 1060,1067 **** --- 1060,1069 ---- /* * Skip the first two entries -- these will *always* be . and .. */ + /* (void)readdir(d); (void)readdir(d); + */ while ((dp = readdir (d)) != (struct dirent *) NULL) { #if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */ *************** *** 1074,1079 **** --- 1076,1093 ---- continue; } #endif /* sun && d_ino */ + + /* + * Skip the '.' and '..' entries, XFS over NFS filesystems + * since SGI does not guarentee that '.' and '..' are the + * first two entries returned from readdir(). + */ + if (dp->d_name[0] == '.' && + (dp->d_name[1] == NULL || + (dp->d_name[1] == '.' && dp->d_name[2] == NULL))) { + continue; + } + (void)Hash_CreateEntry(&p->files, dp->d_name, (Boolean *)NULL); } (void) closedir (d); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message