restore -t crashes when ``.'' or ``..'' is missing
Stephen Crawley
scc at camjenny.UUCP
Tue Apr 16 23:35:22 AEST 1985
Index: etc/restore 4.2BSD
Description:
When restore t is run on a dump of a file system containing a
directory which has either of ``.'' or ``..'' missing, it will
generate a floating point exception and dump core.
Repeat-By:
Find yourself a suitably corrupt file system, take a dump of
it and run restore t.
Fix:
What happens is that the treescan() routine in restore/dirs.c
finds that ``.'' or ``..'' is missing from a directory, and
tries to find an entry in the dump symbol table for the directory
so that it can work out the pathname for the error message.
The problem is that unlike the other commands, restore t does
not build a symbol table, and lookupino() does not check.
The fix I chose is to build a symbol table of the nodes listed.
Alternatively, treescan() could be changed to just print out the
inode number if no symbol table has been allocated.
In restore/main.c
***************
*** 204,209
*/
case 't':
setup();
extractdirs(0);
while (argc--) {
canon(*argv++, name);
--- 204,210 -----
*/
case 't':
setup();
+ initsymtable((char *)0);
extractdirs(0);
while (argc--) {
canon(*argv++, name);
***************
In restore/restore.c
***************
*** 23,28
}
vprintf(stdout, "%s", type == LEAF ? "leaf" : "dir ");
fprintf(stdout, "%10d\t%s\n", ino, name);
return (descend);
}
--- 23,30 -----
}
vprintf(stdout, "%s", type == LEAF ? "leaf" : "dir ");
fprintf(stdout, "%10d\t%s\n", ino, name);
+ if (lookupino(ino) == NIL)
+ (void) addentry(name, ino, type);
return (descend);
}
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list