From e6e3df1becf6e9bc6a28049f098791fa4f74ec43 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 22 Mar 2010 15:40:55 +0000 Subject: [PATCH] Fix invalid EA metainformation in dump, add a workaround to restore to cope with the invalid entries. --- CHANGES | 9 ++++++++- dump/traverse.c | 4 +++- restore/tape.c | 12 ++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 439ccc7..ae9f283 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.308 2010/03/08 10:57:24 stelian Exp $ +$Id: CHANGES,v 1.309 2010/03/22 15:40:55 stelian Exp $ Changes between versions 0.4b42 and 0.4b43 (released ?????????????) =================================================================== @@ -27,6 +27,13 @@ Changes between versions 0.4b42 and 0.4b43 (released ?????????????) 6. Make the dump man page explicit about ext4 support. +7. Fix a bug in dump which caused EA entries to be unrecognizable by + restore in some corner cases. Add a workaround to restore making + it able to properly deal with those corrupted EA entries. Thanks + to John Austin for reporting + the bug. + + Changes between versions 0.4b41 and 0.4b42 (released June 18, 2009) =================================================================== diff --git a/dump/traverse.c b/dump/traverse.c index ac9db80..1889218 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -37,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.67 2009/06/18 10:00:38 stelian Exp $"; + "$Id: traverse.c,v 1.68 2010/03/22 15:40:55 stelian Exp $"; #endif /* not lint */ #include @@ -833,6 +833,8 @@ dump_xattr(dump_ino_t ino, struct dinode *dp) { spcl.c_flags |= DR_EXTATTRIBUTES; spcl.c_extattributes = EXT_XATTR; spcl.c_count = howmany(EXT2_INODE_SIZE(fs->super), TP_BSIZE); + for (i = 0; i < spcl.c_count; i++) + spcl.c_addr[i] = 1; writeheader(ino); for (i = 0, cp = xattr; i < spcl.c_count; i++, cp += TP_BSIZE) writerec(cp, 0); diff --git a/restore/tape.c b/restore/tape.c index 0289246..3dc8bba 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.95 2009/12/04 16:29:18 stelian Exp $"; + "$Id: tape.c,v 1.96 2010/03/22 15:40:55 stelian Exp $"; #endif /* not lint */ #include @@ -1238,12 +1238,20 @@ readxattr(char *buffer) skipfile(); return (FAIL); } - + memset(xattrbuf, 0, XATTR_MAXSIZE); xattrlen = 0; + /* + * ugly hack: cope with invalid spcl.c_addr[] records written by + * old versions of dump. + */ + readmapflag = 1; + getfile(xtrxattr, xtrnull); + readmapflag = 0; + memcpy(buffer, xattrbuf, XATTR_MAXSIZE); return (GOOD); -- 2.39.5