aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/Config.in17
-rw-r--r--archival/libunarchive/data_extract_all.c2
-rw-r--r--archival/libunarchive/get_header_tar.c31
3 files changed, 31 insertions, 19 deletions
diff --git a/archival/Config.in b/archival/Config.in
index affde32c8..cc65b6db4 100644
--- a/archival/Config.in
+++ b/archival/Config.in
@@ -182,26 +182,29 @@ config CONFIG_FEATURE_TAR_GZIP
182 help 182 help
183 Please submit a patch to add help text for this item. 183 Please submit a patch to add help text for this item.
184 184
185config CONFIG_FEATURE_TAR_OLD_FORMAT 185config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
186 bool " Enable support for old tar header format" 186 bool " Enable support for old tar header format"
187 default n 187 default N
188 depends on CONFIG_TAR 188 depends on CONFIG_TAR
189 help 189 help
190 Please submit a patch to add help text for this item. 190 This option is required to unpack archives created with
191 in the old GNU format, help to kill this old format by
192 repacking your ancient archives with the new format.
191 193
192config CONFIG_FEATURE_GNUTAR_LONG_FILENAME 194config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
193 bool " Enable support for GNU long filenames" 195 bool " Enable support for some GNU tar extensions"
194 default y 196 default y
195 depends on CONFIG_TAR 197 depends on CONFIG_TAR
196 help 198 help
197 Please submit a patch to add help text for this item. 199 With this option usybox supports the GNU long filename
200 and linkanmes.
198 201
199config CONFIG_FEATURE_UNARCHIVE_TAPE 202config CONFIG_FEATURE_UNARCHIVE_TAPE
200 bool " Enable tape drive support" 203 bool " Enable tape drive support"
201 default n 204 default n
202 depends on CONFIG_TAR || CONFIG_CPIO 205 depends on CONFIG_TAR || CONFIG_CPIO
203 help 206 help
204 Please submit a patch to add help text for this item. 207 I dont think this is needed anymore.
205 208
206config CONFIG_UNCOMPRESS 209config CONFIG_UNCOMPRESS
207 bool "uncompress" 210 bool "uncompress"
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 9c4510e6b..1eb8bb388 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -84,6 +84,8 @@ extern void data_extract_all(archive_handle_t *archive_handle)
84 perror_msg("Cannot create node %s", file_header->name); 84 perror_msg("Cannot create node %s", file_header->name);
85 } 85 }
86 break; 86 break;
87 default:
88 error_msg_and_die("Unrecognised file type");
87 } 89 }
88 90
89 chmod(file_header->name, file_header->mode); 91 chmod(file_header->name, file_header->mode);
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 5fed7c1bf..2cb141ede 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -20,7 +20,7 @@
20#include "unarchive.h" 20#include "unarchive.h"
21#include "libbb.h" 21#include "libbb.h"
22 22
23#ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME 23#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
24static char *longname = NULL; 24static char *longname = NULL;
25static char *linkname = NULL; 25static char *linkname = NULL;
26#endif 26#endif
@@ -72,7 +72,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
72 * 0's are for the old tar format 72 * 0's are for the old tar format
73 */ 73 */
74 if (strncmp(tar.formated.magic, "ustar", 5) != 0) { 74 if (strncmp(tar.formated.magic, "ustar", 5) != 0) {
75#ifdef CONFIG_FEATURE_TAR_OLD_FORMAT 75#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
76 if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0) 76 if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
77#endif 77#endif
78 error_msg_and_die("Invalid tar magic"); 78 error_msg_and_die("Invalid tar magic");
@@ -90,7 +90,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
90 return(EXIT_FAILURE); 90 return(EXIT_FAILURE);
91 } 91 }
92 92
93#ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME 93#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
94 if (longname) { 94 if (longname) {
95 file_header->name = longname; 95 file_header->name = longname;
96 longname = NULL; 96 longname = NULL;
@@ -120,33 +120,34 @@ extern char get_header_tar(archive_handle_t *archive_handle)
120 file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) + 120 file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
121 strtol(tar.formated.devminor, NULL, 8)); 121 strtol(tar.formated.devminor, NULL, 8));
122 122
123#if defined CONFIG_FEATURE_TAR_OLD_FORMAT || defined CONFIG_FEATURE_GNUTAR_LONG_FILENAME 123#if defined CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY || defined CONFIG_FEATURE_TAR_GNU_EXTENSIONS
124 /* Fix mode, used by the old format */ 124 /* Fix mode, used by the old format */
125 switch (tar.formated.typeflag) { 125 switch (tar.formated.typeflag) {
126# ifdef CONFIG_FEATURE_TAR_OLD_FORMAT 126# ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
127 case 0: 127 case 0:
128 case '0':
128 file_header->mode |= S_IFREG; 129 file_header->mode |= S_IFREG;
129 break; 130 break;
130 case 1: 131 case '1':
131 error_msg("Internal hard link not supported"); 132 error_msg("Internal hard link not supported");
132 break; 133 break;
133 case 2: 134 case '2':
134 file_header->mode |= S_IFLNK; 135 file_header->mode |= S_IFLNK;
135 break; 136 break;
136 case 3: 137 case '3':
137 file_header->mode |= S_IFCHR; 138 file_header->mode |= S_IFCHR;
138 break; 139 break;
139 case 4: 140 case '4':
140 file_header->mode |= S_IFBLK; 141 file_header->mode |= S_IFBLK;
141 break; 142 break;
142 case 5: 143 case '5':
143 file_header->mode |= S_IFDIR; 144 file_header->mode |= S_IFDIR;
144 break; 145 break;
145 case 6: 146 case '6':
146 file_header->mode |= S_IFIFO; 147 file_header->mode |= S_IFIFO;
147 break; 148 break;
148# endif 149# endif
149# ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME 150# ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
150 case 'L': { 151 case 'L': {
151 longname = xmalloc(file_header->size + 1); 152 longname = xmalloc(file_header->size + 1);
152 archive_xread_all(archive_handle, longname, file_header->size); 153 archive_xread_all(archive_handle, longname, file_header->size);
@@ -164,6 +165,12 @@ extern char get_header_tar(archive_handle_t *archive_handle)
164 file_header->name = linkname; 165 file_header->name = linkname;
165 return(get_header_tar(archive_handle)); 166 return(get_header_tar(archive_handle));
166 } 167 }
168 case 'D':
169 case 'M':
170 case 'N':
171 case 'S':
172 case 'V':
173 error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
167# endif 174# endif
168 } 175 }
169#endif 176#endif