Bug in 4.2BSD (2.9BSD?) ls
Chuck Privitera
crp at ccivax.UUCP
Fri Nov 9 08:08:13 AEST 1984
Index: bin/ls.c 4.2BSD/(2.9BSD?)
Description:
When using the -R (recurse) option to ls, it will sometimes
complain about a directory being unreadable (even when run
as root - hint). A closer inspection will show that the
directory doesn't even exist!
Repeat-By:
Try 'ls -R /' you should get at least one of these.
Run it as root, so you should be able to read anything.
Fix:
In routine formatd() there is a for loop that builds
a linked list of sub-directories by starting at the
end of the list. Thus when the linked list is traversed,
the files will be presented to the user in order. The
trouble is, they start one PAST the end of the list.
Here's the fix:
rcsdiff -c3 -r1.1 -r1.2 ls.c
RCS file: RCS/ls.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c3 -r1.1 -r1.2
*** /tmp/,RCSt1008114 Thu Nov 8 15:30:28 1984
--- /tmp/,RCSt2008114 Thu Nov 8 15:30:39 1984
***************
*** 197,203
printf("total %ld\n", nkb);
formatf(dfp0, dfplast);
if (Rflg)
! for (fp = dfplast; fp >= dfp0; fp--) {
if (fp->ftype != 'd' ||
!strcmp(fp->fname, ".") ||
!strcmp(fp->fname, ".."))
--- 197,203 -----
printf("total %ld\n", nkb);
formatf(dfp0, dfplast);
if (Rflg)
! for (fp = dfplast-1; fp >= dfp0; fp--) {
if (fp->ftype != 'd' ||
!strcmp(fp->fname, ".") ||
!strcmp(fp->fname, ".."))
More information about the Comp.bugs.2bsd
mailing list