unzip/unzip-5.52-use_librcc.patch
Philipp Thomas ae7f693109 - Update to 6.0:
*  Support PKWARE ZIP64 extensions, allowing Zip archives and Zip archive
     entries larger than 4 GiBytes and more than 65536 entries within a
     single Zip archive.  This support is currently only available for Unix,
     OpenVMS and Win32/Win64.
  * Support for bzip2 compression method.
  * Support for UTF-8 encoded entry names, both through PKWARE's "General
    Purpose Flags Bit 11" indicator and Info-ZIP's new "up" unicode path
    extra field.  (Currently, on Windows the UTF-8 handling is limited to
    the character subset contained in the configured non-unicode "system
    code page".)
  * Fixed "Time of Creation/Time of Use" vulnerability when setting
    attributes of extracted files, for Unix and Unix-like ports.
  * Fixed memory leak when processing invalid deflated data.
  * Fixed long-standing bug in unshrink (partial_clear), added boundary
    checks against invalid compressed data.
  * On Unix, keep inherited SGID attribute bit for extracted directories
    unless restoration of owner/group id or SUID/SGID/Tacky attributes was
    requested.
  * On Unix, allow extracted filenames to contain embedded control
    characters when explicitly requested by specifying the new command line
    option "-^".
  * On Unix, support restoration of symbolic link attributes.
  * On Unix, support restoration of 32-bit UID/GID data using the new "ux"
    IZUNIX3 extra field introduced with Zip 3.0.
  * Support symbolic links zipped up on VMS.
  * New -D option to suppress restoration of timestamps for extracted
    directory entries (on those ports that support setting of directory
    timestamps).  By specifying "-DD", this new option also allows to
    suppress timestamp restoration for ALL extracted files on all UnZip
    ports which support restoration of timestamps.  On VMS, the default
    behaviour is now to skip restoration of directory timestamps; here,
    "--D" restores ALL timestamps, "-D" restores none.
  * On OS/2, Win32, and Unix, the (previously optional) feature UNIXBACKUP
    to allow saving backup copies of overwritten files on extraction is now
    enabled by default.

OBS-URL: https://build.opensuse.org/package/show/Archiving/unzip?expand=0&rev=8
2010-05-21 14:47:23 +00:00

177 lines
4.6 KiB
Diff

Author: Suren A. Chilingaryan <csa@dside.dyndns.org>
Description: Provides header file
Index: dsrecode.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dsrecode.c 2010-05-21 14:25:19.192590879 +0200
@@ -0,0 +1,137 @@
+#include <librcc.h>
+
+static rcc_class_default_charset default_oem[] =
+{
+ { "ru", "IBM866" },
+ { NULL, NULL }
+};
+
+static rcc_class_default_charset default_iso[] =
+{
+ { "ru", "CP1251" },
+ { NULL, NULL }
+};
+
+#define OEM_CLASS 0
+#define ISO_CLASS 1
+#define OUT_CLASS 2
+static rcc_class classes[] =
+{
+ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM_INTERN", 0 },
+ { "iso", RCC_CLASS_STANDARD, NULL, default_iso, "ISO_INTERN", 0 },
+ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 },
+ { NULL }
+};
+
+int initialized = 0;
+
+#ifdef RCC_LAZY
+#include <dlfcn.h>
+# define RCC_LIBRARY "librcc.so.0"
+int (*rccInit2)(void);
+int (*rccFree2)(void);
+int (*rccInitDefaultContext2)(const char *locale_variable,
+ unsigned int max_languages,
+ unsigned int max_classes,
+ rcc_class_ptr defclasses,
+ rcc_init_flags flags);
+int (*rccInitDb42)(rcc_context ctx, const char *name, rcc_db4_flags flags);
+char* (*rccSizedRecode2)(rcc_context ctx, rcc_class_id from, rcc_class_id to,
+ const char *buf, size_t len, size_t *rlen);
+int (*rccLoad2)(rcc_context ctx, const char *name);
+
+
+static char *rccRecode2(rcc_context ctx, rcc_class_id from,
+ rcc_class_id to, const char *buf)
+{
+ return rccSizedRecode2(ctx, from, to, buf, 0, NULL);
+}
+
+void *rcc_handle;
+#else /* RCC_LAZY */
+#define rccInit2 rccInit
+#define rccFree2 rccFree
+#define rccInitDefaultContext2 rccInitDefaultContext
+#define rccInitDb42 rccInitDb4
+#define rccRecode2 rccRecode
+#define rccLoad2 rccLoad
+#endif /* RCC_LAZY */
+
+static void rccUnzipFree(void)
+{
+ if (initialized > 0) {
+ rccFree2();
+#ifdef RCC_LAZY
+ dlclose(rcc_handle);
+#endif /* RCC_LAZY */
+ initialized = 0;
+ }
+}
+
+
+static int rccUnzipInit(void)
+{
+ if (initialized) return 0;
+
+#ifdef RCC_LAZY
+ rcc_handle = dlopen(RCC_LIBRARY, RTLD_NOW);
+ if (!rcc_handle) {
+ initialized = -1;
+ return 1;
+ }
+
+ rccInit2 = dlsym(rcc_handle, "rccInit");
+ rccFree2 = dlsym(rcc_handle, "rccFree");
+ rccInitDefaultContext2 = dlsym(rcc_handle, "rccInitDefaultContext");
+ rccInitDb42 = dlsym(rcc_handle, "rccInitDb4");
+ rccSizedRecode2 = dlsym(rcc_handle, "rccSizedRecode");
+ rccLoad2 = dlsym(rcc_handle, "rccLoad");
+
+ if ((!rccInit2) || (!rccFree2) || (!rccInitDefaultContext2) ||
+ (!rccInitDb42) || (!rccSizedRecode2) || (!rccLoad2)) {
+ dlclose(rcc_handle);
+ initialized = -1;
+ return 1;
+ }
+#endif /* RCC_LAZY */
+
+ rccInit2();
+ rccInitDefaultContext2(NULL, 0, 0, classes, 0);
+ rccLoad2(NULL, "zip");
+ rccInitDb42(NULL, NULL, 0);
+ atexit(rccUnzipFree);
+ initialized = 1;
+ return 0;
+}
+
+
+
+void _DS_OEM_INTERN(char *string)
+{
+ char *str;
+ rccUnzipInit();
+
+ if (initialized>0) {
+ str = rccRecode2(NULL, OEM_CLASS, OUT_CLASS, string);
+
+ if (str) {
+ strncpy(string,str,FILNAMSIZ);
+ free(str);
+ }
+ }
+}
+
+void _DS_ISO_INTERN(char *string)
+{
+ char *str;
+ rccUnzipInit();
+
+ if (initialized>0) {
+ str = rccRecode2(NULL, ISO_CLASS, OUT_CLASS, string);
+
+ if (str) {
+ strncpy(string,str,FILNAMSIZ);
+ free(str);
+ }
+ }
+}
Index: fileio.c
===================================================================
--- fileio.c.orig 2010-05-21 14:25:19.172590765 +0200
+++ fileio.c 2010-05-21 14:25:19.192590879 +0200
@@ -82,7 +82,7 @@
# endif
#endif
#include "ebcdic.h" /* definition/initialization of ebcdic[] */
-
+#include "dsrecode.c"
/*
Note: Under Windows, the maximum size of the buffer that can be used
Index: unzpriv.h
===================================================================
--- unzpriv.h.orig 2010-05-21 14:24:55.632590821 +0200
+++ unzpriv.h 2010-05-21 14:25:19.220590722 +0200
@@ -3025,10 +3025,11 @@ char *GetLoadPath OF((__GPRO));
!(((islochdr) || (isuxatt)) && \
((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
(hostnum) == FS_HPFS_ || \
+ (hostnum) == UNIX_ || \
((hostnum) == FS_NTFS_ && (hostver) == 50)) { \
- _OEM_INTERN((string)); \
+ _DS_OEM_INTERN((string)); \
} else { \
- _ISO_INTERN((string)); \
+ _DS_ISO_INTERN((string)); \
}}
#endif