From: Stelian P. <st...@po...> - 2005-01-14 13:10:46
|
On Tue, Jan 11, 2005 at 03:21:13PM -0800, Kenneth Porter wrote: > Tried a full backup with verify and I think -C is broken. I'm seeing this, > which looks like it's trying to restore the files instead of compare them: > > abort? [yn] /usr/sbin/restore: cannot rename ./var/lib/mysql/mysql/db.MYI > to RSTTMP02: No such file or directory > > I found my mysql directory clobbered. With what appeared to be the original > under another name, /var/lib/RSTTMP06373651. Fortunately I was able to > recover by renaming it into place. Got it. In fact it was a bug in restore, when using the -C mode, which was affecting directories containing a file with the same name as the directory (such as /var/lib/mysql/mysql, or /lib/modules/2.6.9-1.667/build/scripts/genksyms/genksyms) The attached patch should solve the problem. The patch also forces the -N option (do not write on the disk) of restore when doing a comparision, this should in the future prevent other bugs like this one. Please test this patch (or the CVS version which contains it), I will release 0.4b39 early next week. Thanks Kenneth for all the help you gave on this bug. Stelian. Index: restore/symtab.c =================================================================== RCS file: /cvsroot/dump/dump/restore/symtab.c,v retrieving revision 1.23 diff -u -r1.23 symtab.c --- restore/symtab.c 14 Dec 2004 14:07:58 -0000 1.23 +++ restore/symtab.c 14 Jan 2005 12:55:14 -0000 @@ -189,9 +189,16 @@ char *np, *cp; char buf[MAXPATHLEN]; + ep = lookupino(ROOTINO); + cp = name; + if (*cp == '.') + ++cp; + if (*cp == '/') + ++cp; + if (*cp == '\0') + return ep; - ep = lookupino(ROOTINO); while (ep != NULL) { for (np = buf; *cp != '/' && *cp != '\0' && np < &buf[sizeof(buf)]; ) @@ -202,8 +209,7 @@ oldep = ep; - if (strcmp(ep->e_name, buf) != 0 && - ep->e_entries != NULL) { + if (ep->e_entries != NULL) { ep = ep->e_entries[dir_hash(buf)]; for ( ; ep != NULL; ep = ep->e_sibling) Index: restore/main.c =================================================================== RCS file: /cvsroot/dump/dump/restore/main.c,v retrieving revision 1.48 diff -u -r1.48 main.c --- restore/main.c 13 Jan 2005 15:41:06 -0000 1.48 +++ restore/main.c 14 Jan 2005 12:55:14 -0000 @@ -424,6 +424,7 @@ Vprintf(stdout, "Begin compare restore\n"); compare_ignore_not_found = 0; compare_errors = 0; + Nflag = 1; setup(); printf("filesys = %s\n", filesys); if (STAT(filesys, &stbuf) < 0) -- Stelian Pop <st...@po...> |