Package: magicrescue
Version: 1.1.6-1
Severity: important
Tags: patch
Attached bugfix has description of proposed changes. Consider also at
least 'Suggests:' for 'zip' and 'unzip' packages. Without them
'magicrescue' is completely unable to recover .zip files (think
openoffice).
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (700, 'testing'), (700, 'stable'), (1, 'testing'), (1, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=ru_UA.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash
--- zip.old 2009-09-04 13:14:50.000000000 +0300
+++ zip 2009-09-04 13:36:30.000000000 +0300
@@ -16,8 +16,28 @@
# This command takes a 50MB chunk of the file and tries to repair it. If the
# zip files you are looking for are less than 50MB, you can lower the value of
# the count= parameter for performance.
-command dd bs=1024k count=50 of="$1" 2>/dev/null; zip -qF "$1" || rm -f "$1"
+# # That's that cumbersome because: (since 3.0?) 'zip' has changed its behviour
+# # regarding recovery
+# # [1] -F option appears to be impractical (it gives up almost always)
+# # [2] -FF option is interactive (hence 'yes')
+# # [3] -FF *creates* recovered contents
+# # [4] 'zip' appears to be too picky about suffixes
+command dd bs=1024k count=50 of="$1" 2>/dev/null; x=`tempfile --suffix=".zip"
--directory="${1%/*}"` ; mv "$1" "$x" ; { yes | zip -FF "$x" --out "$1" || rm
-f "$1" ; } >/dev/null 2>&1 ; rm -f "$x"
# Try to guess if it's a JAR archive or an OpenOffice.org file, and rename
# accordingly
-rename if unzip -l "$1"|grep META-INF/MANIFEST.MF >/dev/null 2>&1; then echo
"RENAME jar"; elif unzip -p "$1" content.xml >/dev/null 2>&1; then echo "RENAME
ooo"; fi
+# # That's that cumbersome too because: (since 6.0?) 'unzip' has(?) changed its
+# # behaviour
+# # [1] it's too chatty while listing
+# # [2] it's too chatty while printing(?)
+# # [3] that's violates 'magicrescue' specs regarding chatty commands
+rename if unzip -l "$1" 2>/dev/null |grep META-INF/MANIFEST.MF >/dev/null
2>&1; then echo "RENAME jar"; elif unzip -p "$1" content.xml >/dev/null 2>&1;
then echo "RENAME ooo"; fi
+
+# # p.s. While that works (for me) it's a way fragile. Once upon
+# # experimenting I've got lots of
+# Found zip at 0x1E784555F
+# Output too small, removing
+# # and no results. I don't know why, but that definetely works (I've
+# # successfully recovered yearly report (in oowriter) from completely broken
+# # partition (/home, e2fsck even didn't considered that to be a partition at
+# # all)).