source: clfs-sysroot/patches/file-5.00-fixes-2.patch@ b526bf9

Last change on this file since b526bf9 was f3547a3, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Add new compressors patches to file texinfo and man. Also add the file fixes patch.

  • Property mode set to 100644
File size: 5.2 KB
RevLine 
[f3547a3]1Submitted by: Jim Gifford (jim at cross-lfs dot org)
2Date: 2009-03-01
3Initial Package Version: 5.00
4Upstream Status: Already Applied
5Origin: Jim Gifford
6Description: Fixes Various Build Issues in File
7 Localization Fixes
8
9diff -Naur file-5.00.orig/magic/Magdir/msdos file-5.00/magic/Magdir/msdos
10--- file-5.00.orig/magic/Magdir/msdos 2008-12-12 13:04:45.000000000 -0800
11+++ file-5.00/magic/Magdir/msdos 2009-03-01 23:24:12.209606649 -0800
12@@ -294,22 +294,37 @@
13 >10 string >\x23
14 >>10 string !\x2e
15 >>>17 string <\x5B
16->>>>10 string x \b, name: %.8s
17-#UDMA.SYS KEYB.SYS CMD640X2.SYS
18+>>>>10 string CMD640X2.SYS \b, name: %.8s
19+#UDMA.SYS
20 >10 string <\x41
21 >>12 string >\x40
22 >>>10 string !$
23->>>>12 string x \b, name: %.8s
24-#BTCDROM.SYS ASPICD.SYS
25+>>>>12 string UDMA.SYS \b, name: %.8s
26+#CMD640X2.SYS
27+>10 string <\x41
28+>>12 string >\x40
29+>>>10 string !$
30+>>>>12 string CMD640X2.SYS \b, name: %.8s
31+#KEYB.SYS
32+>10 string <\x41
33+>>12 string >\x40
34+>>>10 string !$
35+>>>>12 string KEYB.SYS \b, name: %.8s
36+#BTCDROM.SYS
37+>22 string >\x40
38+>>22 string <\x5B
39+>>>23 string <\x5B
40+>>>>22 string BTCDROM.SYS \b, name: %.8s
41+#ASPICD.SYS
42 >22 string >\x40
43 >>22 string <\x5B
44 >>>23 string <\x5B
45->>>>22 string x \b, name: %.8s
46+>>>>22 string ASPICD.SYS \b, name: %.8s
47 #ATAPICD.SYS
48 >76 string \0
49 >>77 string >\x40
50 >>>77 string <\x5B
51->>>>77 string x \b, name: %.8s
52+>>>>77 string ATAPICD.SYS \b, name: %.8s
53 # test too generic ?
54 0 byte 0x8c DOS executable (COM)
55 # updated by Joerg Jenderek at Oct 2008
56diff -Naur file-5.00.orig/src/cdf.c file-5.00/src/cdf.c
57--- file-5.00.orig/src/cdf.c 2009-02-03 12:27:51.000000000 -0800
58+++ file-5.00/src/cdf.c 2009-03-01 23:26:11.953279788 -0800
59@@ -239,7 +239,9 @@
60 cdf_unpack_header(h, buf);
61 cdf_swap_header(h);
62 if (h->h_magic != CDF_MAGIC) {
63- DPRINTF(("Bad magic 0x%x != 0x$x\n", h->h_magic, CDF_MAGIC));
64+ DPRINTF(("Bad magic 0x%llx != 0x%llx\n",
65+ (unsigned long long)h->h_magic,
66+ (unsigned long long)CDF_MAGIC));
67 errno = EFTYPE;
68 return -1;
69 }
70@@ -539,10 +541,11 @@
71 if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
72 break;
73
74+ /* If the it is not there, just fake it; some docs don't have it */
75 if (i == dir->dir_len) {
76- DPRINTF(("Cannot find root storage node\n"));
77- errno = EFTYPE;
78- return -1;
79+ scn->sst_tab = NULL;
80+ scn->sst_len = 0;
81+ return 0;
82 }
83 d = &dir->dir_tab[i];
84
85diff -Naur file-5.00.orig/src/readcdf.c file-5.00/src/readcdf.c
86--- file-5.00.orig/src/readcdf.c 2009-02-03 12:27:51.000000000 -0800
87+++ file-5.00/src/readcdf.c 2009-03-01 23:26:11.953279788 -0800
88@@ -75,9 +75,23 @@
89 if (len > 1) {
90 s = info[i].pi_str.s_buf;
91 if (NOTMIME(ms)) {
92- if (file_printf(ms, ", %s: %.*s", buf,
93- len, s) == -1)
94- return -1;
95+ char vbuf[1024];
96+ size_t j;
97+ for (j = 0; j < sizeof(vbuf) && len--;
98+ j++, s++) {
99+ if (*s == '\0')
100+ break;
101+ if (isprint((unsigned char)*s))
102+ vbuf[j] = *s;
103+ }
104+ if (j == sizeof(vbuf))
105+ --j;
106+ vbuf[j] = '\0';
107+ if (vbuf[0]) {
108+ if (file_printf(ms, ", %s: %s",
109+ buf, vbuf) == -1)
110+ return -1;
111+ }
112 } else if (info[i].pi_id ==
113 CDF_PROPERTY_NAME_OF_APPLICATION) {
114 if (strstr(s, "Word"))
115@@ -115,7 +129,10 @@
116 case CDF_CLIPBOARD:
117 break;
118 default:
119- file_error(ms, 0, "Internal parsing error");
120+#ifndef EFTYPE /* XXX: vapier: copied from cdf.c for now ... */
121+#define EFTYPE EINVAL
122+#endif
123+ errno = EFTYPE;
124 return -1;
125 }
126 }
127@@ -188,6 +205,7 @@
128 cdf_stream_t sst, scn;
129 cdf_dir_t dir;
130 int i;
131+ const char *expn = "";
132 (void)&nbytes;
133 (void)&buf;
134
135@@ -200,7 +218,7 @@
136 #endif
137
138 if (cdf_read_sat(fd, &h, &sat) == -1) {
139- file_error(ms, errno, "Can't read SAT");
140+ expn = "Can't read SAT";
141 return -1;
142 }
143 #ifdef CDF_DEBUG
144@@ -208,7 +226,7 @@
145 #endif
146
147 if ((i = cdf_read_ssat(fd, &h, &sat, &ssat)) == -1) {
148- file_error(ms, errno, "Can't read SAT");
149+ expn = "Can't read SSAT";
150 goto out1;
151 }
152 #ifdef CDF_DEBUG
153@@ -216,12 +234,12 @@
154 #endif
155
156 if ((i = cdf_read_dir(fd, &h, &sat, &dir)) == -1) {
157- file_error(ms, errno, "Can't read directory");
158+ expn = "Can't read directory";
159 goto out2;
160 }
161
162 if ((i = cdf_read_short_stream(fd, &h, &sat, &dir, &sst)) == -1) {
163- file_error(ms, errno, "Cannot read short stream");
164+ expn = "Cannot read short stream";
165 goto out3;
166 }
167
168@@ -230,19 +248,14 @@
169 #endif
170 if ((i = cdf_read_summary_info(fd, &h, &sat, &ssat, &sst, &dir, &scn))
171 == -1) {
172- /* Some files don't have summary info! */
173-#ifdef notyet
174- file_error(ms, errno, "Can't read summary_info");
175-#else
176- i = 0;
177-#endif
178+ expn = "";
179 goto out4;
180 }
181 #ifdef CDF_DEBUG
182 cdf_dump_summary_info(&h, &scn);
183 #endif
184 if ((i = cdf_file_summary_info(ms, &scn)) == -1)
185- file_error(ms, errno, "Can't expand summary_info");
186+ expn = "Can't expand summary_info";
187 free(scn.sst_tab);
188 out4:
189 free(sst.sst_tab);
190@@ -252,5 +265,13 @@
191 free(ssat.sat_tab);
192 out1:
193 free(sat.sat_tab);
194+ if (i != 1) {
195+ if (file_printf(ms, "CDF V2 Document") == -1)
196+ return -1;
197+ if (*expn)
198+ if (file_printf(ms, ", corrupt: %s", expn) == -1)
199+ return -1;
200+ i = 1;
201+ }
202 return i;
203 }
Note: See TracBrowser for help on using the repository browser.