From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucio De Re To: 9fans@cse.psu.edu Subject: Re: [9fans] opendir/closedir in CVS sources Message-ID: <20020108194526.D12098@cackle.proxima.alt.za> References: <20020108164758.350DA19A63@mail.cse.psu.edu> <20020108185830.C12098@cackle.proxima.alt.za> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=jRHKVT23PllUwdXP In-Reply-To: <20020108185830.C12098@cackle.proxima.alt.za>; from Lucio De Re on Tue, Jan 08, 2002 at 06:58:31PM +0200 Date: Tue, 8 Jan 2002 19:45:26 +0200 Topicbox-Message-UUID: 3c065f2c-eaca-11e9-9e20-41e7f4b1d025 --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii On Tue, Jan 08, 2002 at 06:58:31PM +0200, Lucio De Re wrote: > > I see things like: > > Opened dir '.' as 5 > N test/mkfile > succeeded to close dir 5 > 8.out import: Importing /n/other/sys/cvs/test/9 > Opened dir '.' as 6 > N /test/9/mkfile > succeeded to close dir 6 > 8.out import: Importing /n/other/sys/cvs/test/9/boot > Opened dir '.' as 7 > ... > > from my debugging output. One consideration is that these are freshly > created directories, presumably following a mkdir/chdir operation. > I seem unable to reproduce the problem from a simple test program :-( I attach the diffs for my test code in /sys/src/cmd/cvs/src/import.c. If CVS exists as 8.out, the following commands should exhibit the behaviour above: % CVSROOT=$home/cvsroot % mkdir $CVSROOT % 8.out init % cd /sys/src % .../8.out import -mTest test ABC DEF At this point, one can crash 8.out and remove the spurious directories before filling up the repository. ++L > I _do_ run out of FDs around 100. > > ++L --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diffs 23,41d22 < #define TESTING < #ifdef TESTING < #undef CVS_OPEN < #undef CVS_OPENDIR < < int CVS_OPEN (const char *path, int flags, mode_t *mode) < { < int fd = open (path, flags, mode); < fprintf (stderr, "Opened '%s' as %d\n", path, fd); < return fd; < } < DIR *CVS_OPENDIR (const char *path) < { < DIR *dirp = opendir (path); < fprintf (stderr, "Opened dir '%s' as %d\n", path, dirp->dd_fd); < return dirp; < } < #endif < 508,514d488 < #ifdef TESTING < if (closedir (dirp) != 0) { < fprintf (stderr, "failed to close dir %d - err %d\n", dirp->dd_fd, errno); < } else { < fprintf (stderr, "succeeded to close dir %d\n", dirp->dd_fd); < } < #else 516d489 < #endif --jRHKVT23PllUwdXP--