Package: unshield
Version: 0.6-2
Followup-For: Bug #580470
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This bug has been fixed upstream for quite a while and makes unshield pretty
useless on a number of newer archives:
bjorn@nemi:~/docs/hardware/ZTE/MF60$ unshield -D3 l /mnt/temp/Data/data2.cab
[unshield_read_headers:226] Reading header from .hdr file 1.
[unshield_read_headers:281] Version 0x02000578 handled as major version 0
[unshield_get_cab_descriptor:81] Cabinet descriptor: 00002610 00002eb4 00002eb4
00000014
[unshield_get_cab_descriptor:83] Directory count: 5
[unshield_get_cab_descriptor:84] File count: 129
Aborted
The generic solution provided as an attachment to
http://sourceforge.net/tracker/?func=detail&aid=3163039&group_id=30550&atid=399603
has been integrated upstream as commit 0c81b16e in the git repo at
git://github.com/twogood/unshield.git
The patch is based on the previous hacky workaround for specific versions
so it needs minor cleanup to apply to the current Debian package. I've
attached a cleaned up patch which has been tested an verified on top of
the Debian unshield version 0.6-2. Please either apply this patch or
update to current git head.
Thanks,
Bjørn
- -- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (990, 'testing'), (700, 'stable'), (600, 'unstable'), (500,
'stable-updates'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages unshield depends on:
ii libc6 2.13-26
ii libunshield0 0.6-2
ii zlib1g 1:1.2.6.dfsg-1
unshield recommends no packages.
unshield suggests no packages.
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iEYEARECAAYFAk9R/0MACgkQ10rqkowbIsm4TQCeMaaNka6KkzN5I2DM/dcuvz1m
siUAnRmtiXer3wYY5C22c2J9M9OCw7y8
=Ijyc
-----END PGP SIGNATURE-----
diff -urN unshield-0.6.old/lib/component.c unshield-0.6/lib/component.c
--- unshield-0.6.old/lib/component.c 2012-03-03 11:57:55.000000000 +0100
+++ unshield-0.6/lib/component.c 2012-03-03 11:58:54.000000000 +0100
@@ -40,11 +40,13 @@
case 7:
case 8:
case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ default:
p += 0x6b;
break;
-
- default:
- abort();
}
self->file_group_count = READ_UINT16(p); p += 2;
diff -urN unshield-0.6.old/lib/file.c unshield-0.6/lib/file.c
--- unshield-0.6.old/lib/file.c 2012-03-03 11:57:55.000000000 +0100
+++ unshield-0.6/lib/file.c 2012-03-03 11:58:54.000000000 +0100
@@ -77,6 +77,11 @@
case 7:
case 8:
case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ default:
saved_p = p = header->data +
header->common.cab_descriptor_offset +
header->cab.file_table_offset +
@@ -117,10 +122,6 @@
assert((p - saved_p) == 0x57);
break;
-
- default:
- unshield_error("Unknown major version: %i", header->major_version);
- abort();
}
if (!(fd->flags & FILE_COMPRESSED) &&
@@ -363,6 +364,11 @@
case 7:
case 8:
case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ default:
{
uint8_t six_header[VOLUME_HEADER_SIZE_V6];
uint8_t* p = six_header;
@@ -389,10 +395,6 @@
reader->volume_header.last_file_size_compressed_high = READ_UINT32(p); p += 4;
}
break;
-
- default:
- abort();
- goto exit;
}
#if VERBOSE >= 2
diff -urN unshield-0.6.old/lib/libunshield.c unshield-0.6/lib/libunshield.c
--- unshield-0.6.old/lib/libunshield.c 2012-03-03 11:57:55.000000000 +0100
+++ unshield-0.6/lib/libunshield.c 2012-03-03 12:01:22.000000000 +0100
@@ -205,7 +205,7 @@
/**
Read all header files
*/
-static bool unshield_read_headers(Unshield* unshield)/*{{{*/
+static bool unshield_read_headers(Unshield* unshield, int version)/*{{{*/
{
int i;
bool iterate = true;
@@ -269,7 +269,20 @@
goto error;
}
- header->major_version = (header->common.version >> 12) & 0xf;
+ if (version != -1)
+ {
+ header->major_version = version;
+ }
+ else if (header->common.version >> 24 == 1)
+ {
+ header->major_version = (header->common.version >> 12) & 0xf;
+ }
+ else if (header->common.version >> 24 == 2)
+ {
+ header->major_version = (header->common.version & 0xffff);
+ if (header->major_version != 0)
+ header->major_version = header->major_version / 100;
+ }
#if 0
if (header->major_version < 5)
@@ -326,6 +339,11 @@
Unshield* unshield_open(const char* filename)/*{{{*/
{
+ return unshield_open_force_version(filename, -1);
+}/*}}}*/
+
+Unshield* unshield_open_force_version(const char* filename, int version)/*{{{*/
+{
Unshield* unshield = NEW1(Unshield);
if (!unshield)
{
@@ -339,7 +357,7 @@
goto error;
}
- if (!unshield_read_headers(unshield))
+ if (!unshield_read_headers(unshield, version))
{
unshield_error("Failed to read header files");
goto error;
diff -urN unshield-0.6.old/lib/libunshield.h unshield-0.6/lib/libunshield.h
--- unshield-0.6.old/lib/libunshield.h 2012-03-03 11:57:55.000000000 +0100
+++ unshield-0.6/lib/libunshield.h 2012-03-03 11:58:54.000000000 +0100
@@ -33,6 +33,7 @@
*/
Unshield* unshield_open(const char* filename);
+Unshield* unshield_open_force_version(const char* filename, int version);
void unshield_close(Unshield* unshield);
/*
diff -urN unshield-0.6.old/src/unshield.c unshield-0.6/src/unshield.c
--- unshield-0.6.old/src/unshield.c 2012-03-03 11:57:55.000000000 +0100
+++ unshield-0.6/src/unshield.c 2012-03-03 11:58:54.000000000 +0100
@@ -58,6 +58,7 @@
static int log_level = UNSHIELD_LOG_LEVEL_LOWEST;
static int exit_status = 0;
static FORMAT format = FORMAT_NEW;
+static int is_version = -1;
static bool make_sure_directory_exists(const char* directory)/*{{{*/
{
@@ -108,7 +109,7 @@
fprintf(stderr,
"Syntax:\n"
"\n"
- "\t%s [-c COMPONENT] [-d DIRECTORY] [-D LEVEL] [-g GROUP] [-GhlOrV] c|g|l|t|x CABFILE\n"
+ "\t%s [-c COMPONENT] [-d DIRECTORY] [-D LEVEL] [-g GROUP] [-i VERSION] [-GhlOrV] c|g|l|t|x CABFILE\n"
"\n"
"Options:\n"
"\t-c COMPONENT Only list/extract this component\n"
@@ -120,6 +121,7 @@
"\t 3 - Errors, warnings and debug messages\n"
"\t-g GROUP Only list/extract this file group\n"
"\t-h Show this help message\n"
+ "\t-i VERSION Force InstallShield version number (don't autodetect)\n"
"\t-j Junk paths (do not make directories)\n"
"\t-L Make file and directory names lowercase\n"
"\t-O Use old compression\n"
@@ -152,7 +154,7 @@
{
int c;
- while ((c = getopt(argc, argv, "c:d:D:g:hjLnoOrV")) != -1)
+ while ((c = getopt(argc, argv, "c:d:D:g:hi:jLnoOrV")) != -1)
{
switch (c)
{
@@ -172,6 +174,10 @@
file_group_name = optarg;
break;
+ case 'i':
+ is_version = atoi(optarg);
+ break;
+
case 'j':
junk_paths = true;
break;
@@ -532,7 +538,7 @@
cabfile = argv[last_optind];
- unshield = unshield_open(cabfile);
+ unshield = unshield_open_force_version(cabfile, is_version);
if (!unshield)
{
fprintf(stderr, "Failed to open %s as an InstallShield Cabinet File\n", cabfile);