Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!sgt From: sgt@alice.UucP (Steve Tell) Newsgroups: net.sources Subject: Re: dtree.c (BUG found, diff enclosed) Message-ID: <5367@alice.uUCp> Date: Wed, 30-Apr-86 01:50:55 EDT Article-I.D.: alice.5367 Posted: Wed Apr 30 01:50:55 1986 Date-Received: Sat, 3-May-86 00:19:22 EDT Organization: Bell Labs, Murray Hill Lines: 57 I just downloaded and compiled the source to the dtree directory tree program posted recently. The version posted chokes on files (not necessarily directories) whose name has a length of 14 characters. What happens is that in the directory entry for such a file, there is no room for the null padding that usually precedes the inode-number for the next entry to pad out the name to the required size. The result is that the offending file comes up " can't stat" and then you get a whole slew of strange names that can't be stat'ed, most containing binary stuff that messes up your terminal. Here's the fix, direct from diff -c: *** dtree.c Wed Apr 30 01:37:00 1986 <-------------OLD FILE --- ../dtree/dtree.c Wed Apr 30 01:34:27 1986 <-NEW FILE *************** *** 406,411 || (Point && dp->d_name[0] == '.')) continue; sprintf(sub, "%s", dp->d_name); #ifdef LINK if (lstat (sub,&Lstat) == FAIL) { --- 406,415 ----- || (Point && dp->d_name[0] == '.')) continue; + #ifndef NEWDIR /*** Here's the fix ***/ + strncpy(sub, dp->d_name, 14); + sub[14] = 0; + #else sprintf(sub, "%s", dp->d_name); #endif NEWDIR #ifdef LINK *************** *** 407,412 continue; sprintf(sub, "%s", dp->d_name); #ifdef LINK if (lstat (sub,&Lstat) == FAIL) { fprintf(stderr, "%s:lstat can't find\n", sub); --- 411,417 ----- sub[14] = 0; #else sprintf(sub, "%s", dp->d_name); + #endif NEWDIR #ifdef LINK if (lstat (sub,&Lstat) == FAIL) { fprintf(stderr, "%s:lstat can't find\n", sub); ----- Note that this only makes a difference on pre-BSD-4.1c file systems. Steve Tell, AT&T Bell Labs, Murray Hill, NJ