1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
diff -bruw tar-1.13.25-5-orig/src/create.c tar-1.13.25-5/src/create.c
--- tar-1.13.25-5-orig/src/create.c 2002-05-17 03:21:16.000000000 +0200
+++ tar-1.13.25-5/src/create.c 2004-08-20 15:23:36.194913600 +0200
@@ -903,6 +903,13 @@
time_t original_ctime;
struct utimbuf restore_times;
+#ifdef PATHCOMPRESS
+ char compressed[4096];
+ //printf("dump_file %s", p);
+ p = pathcompress_compress_path(p, compressed);
+ //printf(" -> %s\n", p);
+#endif
+
/* FIXME: `header' might be used uninitialized in this
function. Reported by Bruno Haible. */
@@ -985,10 +992,22 @@
/* Build new prototype name. Ensure exactly one trailing slash. */
+#ifndef PATHCOMPRESS
len = strlen (p);
buflen = len + NAME_FIELD_SIZE;
namebuf = xmalloc (buflen + 1);
memcpy (namebuf, p, len);
+#else
+ {
+ char uncompressed[4096]="";
+ pathcompress_uncompress_path(p, uncompressed);
+ //printf("p='%s' -> uncompressed='%s'\n", p, uncompressed);
+ len = strlen(uncompressed);
+ buflen = len + NAME_FIELD_SIZE;
+ namebuf = xmalloc (buflen + 1);
+ memcpy (namebuf, uncompressed, len);
+ }
+#endif
while (len >= 1 && ISSLASH (namebuf[len - 1]))
len--;
namebuf[len++] = '/';
@@ -1108,6 +1127,13 @@
(entrylen = strlen (entry)) != 0;
entry += entrylen + 1)
{
+#ifdef PATHCOMPRESS
+ //printf("readdir: entry %s\n", entry->d_name);
+ if (strcmp(entry, "=dirnames")==0) {
+ continue;
+ }
+#endif
+
if (buflen <= len + entrylen)
{
buflen = len + entrylen;
@@ -1317,8 +1343,16 @@
/* If the file is sparse, we've already taken care of this. */
if (!header_moved)
+#ifdef PATHCOMPRESS
+ {
+ char uncompressed[4096];
+ pathcompress_uncompress_path(p, uncompressed);
+ //printf("readdir: %s ->> %s\n", p, uncompressed);
+ header = start_header (uncompressed, ¤t_stat);
+ }
+#else
header = start_header (p, ¤t_stat);
-
+#endif
/* Mark contiguous files, if we support them. */
if (archive_format != V7_FORMAT && S_ISCTG (current_stat.st_mode))
diff -bruw tar-1.13.25-5-orig/src/extract.c tar-1.13.25-5/src/extract.c
--- tar-1.13.25-5-orig/src/extract.c 2002-05-17 03:27:50.000000000 +0200
+++ tar-1.13.25-5/src/extract.c 2004-10-06 11:12:01.178804800 +0200
@@ -142,6 +142,11 @@
{
mode_t mode;
+#ifdef PATHCOMPRESS
+ char compressed[4096];
+ file_name = pathcompress_compress_path(file_name, compressed);
+#endif
+
if (0 < same_permissions_option
&& permstatus != INTERDIR_PERMSTATUS)
{
@@ -216,6 +221,11 @@
{
struct utimbuf utimbuf;
+#ifdef PATHCOMPRESS
+ char compressed[4096];
+ file_name = pathcompress_compress_path(file_name, compressed);
+#endif
+
if (typeflag != SYMTYPE)
{
/* We do the utime before the chmod because some versions of utime are
@@ -355,6 +365,9 @@
int invert_permissions;
int status;
+#ifdef PATHCOMPRESS
+ char abspath[4096];
+#endif
for (cursor = cursor0; *cursor; cursor++)
{
@@ -377,6 +390,11 @@
*cursor = '\0'; /* truncate the path there */
mode = MODE_RWX & ~ newdir_umask;
invert_permissions = we_are_root ? 0 : MODE_WXUSR & ~ mode;
+#ifdef PATHCOMPRESS
+ pathcompress_add_path(file_name, abspath);
+ file_name = pathcompress_compress_path(file_name, abspath);
+ pathcompress_add_pathid(file_name);
+#endif
status = mkdir (file_name, mode ^ invert_permissions);
if (status == 0)
@@ -608,6 +626,9 @@
int interdir_made = 0;
char typeflag;
union block *exhdr;
+#ifdef PATHCOMPRESS
+ char abspath[4096];
+#endif
#define CURRENT_FILE_NAME (skipcrud + current_file_name)
@@ -806,7 +827,12 @@
WARN ((0, 0, _("Extracting contiguous files as regular files")));
}
}
+#ifdef PATHCOMPRESS
+ pathcompress_compress_path(CURRENT_FILE_NAME, abspath);
+ fd = open (abspath, openflag, current_stat.st_mode);
+#else
fd = open (CURRENT_FILE_NAME, openflag, mode);
+#endif
#endif /* not O_CTG */
@@ -1153,7 +1179,17 @@
& MODE_RWX);
again_dir:
+#ifdef PATHCOMPRESS
+ {
+ char abspath[4096];
+ pathcompress_add_path(CURRENT_FILE_NAME, abspath);
+ pathcompress_compress_path(CURRENT_FILE_NAME, abspath);
+ status = mkdir (abspath, mode);
+ pathcompress_add_pathid(CURRENT_FILE_NAME);
+ }
+#else
status = mkdir (CURRENT_FILE_NAME, mode);
+#endif
if (status != 0)
{
diff -bruw tar-1.13.25-5-orig/src/names.c tar-1.13.25-5/src/names.c
--- tar-1.13.25-5-orig/src/names.c 2002-05-17 03:21:16.000000000 +0200
+++ tar-1.13.25-5/src/names.c 2004-08-20 15:23:36.395201600 +0200
@@ -351,6 +351,16 @@
while (cursor > name_buffer && ISSLASH (*cursor))
*cursor-- = '\0';
+#ifdef PATHCOMPRESS
+ {
+ char compressed_name[4096];
+ //printf("name: '%s' len=%d\n", name_buffer, name_buffer_length);
+ pathcompress_compress_path(name_buffer, compressed_name);
+ //printf("comp: '%s'\n", compressed_name);
+ strcpy(name_buffer, compressed_name);
+ }
+#endif
+
if (chdir_flag)
{
if (chdir (name_buffer) < 0)
|