]> git.pld-linux.org Git - packages/cdrtools.git/blame - cdrtools-mkisofs-fix.patch
- added official mkisofs fix release for 3.01
[packages/cdrtools.git] / cdrtools-mkisofs-fix.patch
CommitLineData
d2ae3f65
MK
1--- cdrtools-3.01.orig/mkisofs/diag/isoinfo.c 2015-07-22 20:36:45.000000000 +0000
2+++ cdrtools-3.01/mkisofs/diag/isoinfo.c 2015-11-17 19:35:40.000000000 +0000
3@@ -1,8 +1,8 @@
4-/* @(#)isoinfo.c 1.95 15/07/22 joerg */
5+/* @(#)isoinfo.c 1.100 15/11/17 joerg */
6 #include <schily/mconfig.h>
7 #ifndef lint
8 static UConst char sccsid[] =
9- "@(#)isoinfo.c 1.95 15/07/22 joerg";
10+ "@(#)isoinfo.c 1.100 15/11/17 joerg";
11 #endif
12 /*
13 * File isodump.c - dump iso9660 directory information.
14@@ -148,8 +148,10 @@ LOCAL char er_id[256];
15 LOCAL int su_version = 0;
16 LOCAL int rr_version = 0;
17 LOCAL int aa_version = 0;
18+LOCAL int cl_extent = 0;
19 LOCAL int ucs_level = 0;
20 LOCAL BOOL iso9660_inodes = FALSE;
21+LOCAL uid_t myuid;
22
23 #ifdef USE_FIND
24 LOCAL findn_t *find_node; /* syntaxtree from find_parse() */
25@@ -208,6 +210,9 @@ LOCAL void extract __PR((char *rootname
26 LOCAL void extract_file __PR((int f,
27 struct iso_directory_record * idr,
28 char *fname));
29+LOCAL void parse_cl_dir __PR((struct iso_directory_record *idr,
30+ int extent));
31+LOCAL BOOL parse_de __PR((struct iso_directory_record *idr));
32 LOCAL void parse_dir __PR((char * rootname, int extent, int len));
33 LOCAL void usage __PR((int excode));
34 EXPORT int main __PR((int argc, char *argv[]));
35@@ -459,7 +464,6 @@ parse_rr(pnt, len, cont_flag)
36 int slen;
37 int xlen;
38 int ncount;
39- int cl_extent;
40 int pl_extent;
41 int cont_extent, cont_offset, cont_size;
42 int flag1, flag2;
43@@ -469,7 +473,7 @@ parse_rr(pnt, len, cont_flag)
44
45 symlinkname[0] = 0;
46
47- cont_extent = cont_offset = cont_size = 0;
48+ cl_extent = cont_extent = cont_offset = cont_size = 0;
49
50 ncount = 0;
51 flag1 = -1;
52@@ -714,6 +718,7 @@ struct todo
53 };
54
55 LOCAL struct todo *todo_idr = NULL;
56+LOCAL struct todo **todo_pp = &todo_idr;
57
58 LOCAL char *months[12] = {"Jan", "Feb", "Mar", "Apr",
59 "May", "Jun", "Jul",
60@@ -962,8 +967,14 @@ static BOOL isfirst = TRUE;
61 close(f);
62 return;
63 setmode:
64- fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
65 fchownat(AT_FDCWD, fname, fstat_buf.st_uid, fstat_buf.st_gid, AT_SYMLINK_NOFOLLOW);
66+ if (myuid != 0 && S_ISDIR(fstat_buf.st_mode)) {
67+ /*
68+ * Temporary hack until we have a dirstack like star.
69+ */
70+ fstat_buf.st_mode |= S_IWUSR;
71+ }
72+ fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
73 times[0].tv_sec = fstat_buf.st_atime;
74 times[0].tv_nsec = stat_ansecs(&fstat_buf);
75 times[1].tv_sec = fstat_buf.st_mtime;
76@@ -1001,6 +1012,143 @@ extract_file(f, idr, fname)
77 }
78 }
79
80+
81+LOCAL void
82+parse_cl_dir(idr, extent)
83+ struct iso_directory_record *idr;
84+ int extent;
85+{
86+ char cl_name_buf[256*3];
87+
88+ strlcpy(cl_name_buf, name_buf, sizeof (cl_name_buf));
89+#ifdef USE_SCG
90+ readsecs(extent - sector_offset, idr, 1);
91+#else
92+ lseek(fileno(infile), ((off_t)(extent - sector_offset)) << 11, SEEK_SET);
93+ read(fileno(infile), idr, 2048);
94+#endif
95+
96+ if (parse_de(idr) && use_rock)
97+ dump_rr(idr);
98+ strlcpy(name_buf, cl_name_buf, sizeof (name_buf));
99+}
100+
101+LOCAL BOOL
102+parse_de(idr)
103+ struct iso_directory_record *idr;
104+{
105+ unsigned char uc;
106+
107+ if (idr->length[0] == 0)
108+ return (FALSE);
109+ memset(&fstat_buf, 0, sizeof (fstat_buf));
110+ found_rr = 0;
111+ name_buf[0] = xname[0] = 0;
112+ fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
113+ if (idr->flags[0] & 2)
114+ fstat_buf.st_mode |= S_IFDIR;
115+ else
116+ fstat_buf.st_mode |= S_IFREG;
117+ if (idr->name_len[0] == 1 && idr->name[0] == 0)
118+ strcpy(name_buf, ".");
119+ else if (idr->name_len[0] == 1 && idr->name[0] == 1)
120+ strcpy(name_buf, "..");
121+ else {
122+ switch (ucs_level) {
123+ case 3:
124+ case 2:
125+ case 1:
126+ /*
127+ * Unicode name. Convert as best we can.
128+ */
129+ {
130+ int j;
131+ name_buf[0] = '\0';
132+#ifdef USE_ICONV
133+ if (use_iconv(unls)) {
134+ int u;
135+ char *to = name_buf;
136+
137+ for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
138+ char *ibuf = (char *)&idr->name[j*2];
139+ size_t isize = 2; /* UCS-2 character size */
140+ size_t osize = 4;
141+
142+ if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
143+ (char **)&to, &osize) == -1) {
144+ int err = geterrno();
145+
146+ if ((err == EINVAL || err == EILSEQ) &&
147+ osize == 4) {
148+ *to = '_';
149+ u += 1;
150+ to++;
151+ }
152+ } else {
153+ u += 4 - osize;
154+ to = &name_buf[u];
155+ }
156+ }
157+ j = u;
158+ } else
159+#endif
160+ for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
161+ UInt16_t unichar;
162+
163+ unichar = (idr->name[j*2] & 0xFF) * 256 +
164+ (idr->name[j*2+1] & 0xFF);
165+
166+ /*
167+ * Get the backconverted char
168+ */
169+ if (unls)
170+ uc = sic_uni2c(unls, unichar);
171+ else
172+ uc = unichar > 255 ? '_' : unichar;
173+
174+ name_buf[j] = uc ? uc : '_';
175+ }
176+ name_buf[j] = '\0';
177+ }
178+ break;
179+ case 0:
180+ /*
181+ * Normal non-Unicode name.
182+ */
183+ strncpy(name_buf, idr->name, idr->name_len[0]);
184+ name_buf[idr->name_len[0]] = 0;
185+ break;
186+ default:
187+ /*
188+ * Don't know how to do these yet. Maybe they are the same
189+ * as one of the above.
190+ */
191+ exit(1);
192+ }
193+ }
194+ memcpy(date_buf, idr->date, 9);
195+ /*
196+ * Always first set up time stamps and file modes from
197+ * ISO-9660. This is used as a fallback in case that
198+ * there is no related Rock Ridge based data.
199+ */
200+ fstat_buf.st_atime =
201+ fstat_buf.st_mtime =
202+ fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
203+ fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
204+ S_IRGRP|S_IXGRP |
205+ S_IROTH|S_IXOTH;
206+ fstat_buf.st_nlink = 1;
207+ fstat_buf.st_ino = 0;
208+ fstat_buf.st_uid = 0;
209+ fstat_buf.st_gid = 0;
210+ if (iso9660_inodes) {
211+ fstat_buf.st_ino = (unsigned long)
212+ isonum_733((unsigned char *)idr->extent);
213+ }
214+ return (TRUE);
215+}
216+
217 LOCAL void
218 parse_dir(rootname, extent, len)
219 char *rootname;
220@@ -1012,12 +1160,13 @@ parse_dir(rootname, extent, len)
221 struct iso_directory_record * idr;
222 struct iso_directory_record didr;
223 struct stat dstat;
224- unsigned char uc;
225+ unsigned char cl_buffer[2048];
226 unsigned char flags = 0;
227 Llong size = 0;
228 int sextent = 0;
229 int rlen;
230 int blen;
231+ int rr_flags = 0;
232 static char *n = 0;
233 static int nlen = 0;
234
235@@ -1039,115 +1188,23 @@ static int nlen = 0;
236 i = 0;
237 while (1 == 1) {
238 idr = (struct iso_directory_record *) &buffer[i];
239- if (idr->length[0] == 0) break;
240- memset(&fstat_buf, 0, sizeof (fstat_buf));
241- found_rr = 0;
242- name_buf[0] = xname[0] = 0;
243- fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
244- if (idr->flags[0] & 2)
245- fstat_buf.st_mode |= S_IFDIR;
246- else
247- fstat_buf.st_mode |= S_IFREG;
248- if (idr->name_len[0] == 1 && idr->name[0] == 0)
249- strcpy(name_buf, ".");
250- else if (idr->name_len[0] == 1 && idr->name[0] == 1)
251- strcpy(name_buf, "..");
252- else {
253- switch (ucs_level) {
254- case 3:
255- case 2:
256- case 1:
257- /*
258- * Unicode name. Convert as best we can.
259- */
260- {
261- int j;
262-
263- name_buf[0] = '\0';
264-#ifdef USE_ICONV
265- if (use_iconv(unls)) {
266- int u;
267- char *to = name_buf;
268-
269- for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
270- char *ibuf = (char *)&idr->name[j*2];
271- size_t isize = 2; /* UCS-2 character size */
272- size_t osize = 4;
273-
274- if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
275- (char **)&to, &osize) == -1) {
276- int err = geterrno();
277-
278- if ((err == EINVAL || err == EILSEQ) &&
279- osize == 4) {
280- *to = '_';
281- u += 1;
282- to++;
283- }
284- } else {
285- u += 4 - osize;
286- to = &name_buf[u];
287- }
288- }
289- j = u;
290- } else
291-#endif
292- for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
293- UInt16_t unichar;
294-
295- unichar = (idr->name[j*2] & 0xFF) * 256 +
296- (idr->name[j*2+1] & 0xFF);
297-
298- /*
299- * Get the backconverted char
300- */
301- if (unls)
302- uc = sic_uni2c(unls, unichar);
303- else
304- uc = unichar > 255 ? '_' : unichar;
305+ if (idr->length[0] == 0)
306+ break;
307+ parse_de(idr);
308+ if (use_rock) {
309+ rr_flags = dump_rr(idr);
310
311- name_buf[j] = uc ? uc : '_';
312- }
313- name_buf[j] = '\0';
314- }
315- break;
316- case 0:
317+ if (rr_flags & RR_FLAG_CL) {
318 /*
319- * Normal non-Unicode name.
320+ * Need to reparse the child link
321+ * but note that we parse "CL/."
322+ * so we get no usable file name.
323 */
324- strncpy(name_buf, idr->name, idr->name_len[0]);
325- name_buf[idr->name_len[0]] = 0;
326- break;
327- default:
328- /*
329- * Don't know how to do these yet. Maybe they are the same
330- * as one of the above.
331- */
332- exit(1);
333- }
334+ idr = (struct iso_directory_record *) cl_buffer;
335+ parse_cl_dir(idr, cl_extent);
336+ } else if (rr_flags & RR_FLAG_RE)
337+ goto cont; /* skip rr_moved */
338 }
339- memcpy(date_buf, idr->date, 9);
340- /*
341- * Always first set up time stamps and file modes from
342- * ISO-9660. This is used as a fallback in case that
343- * there is no related Rock Ridge based data.
344- */
345- fstat_buf.st_atime =
346- fstat_buf.st_mtime =
347- fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
348- fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
349- S_IRGRP|S_IXGRP |
350- S_IROTH|S_IXOTH;
351- fstat_buf.st_nlink = 1;
352- fstat_buf.st_ino = 0;
353- fstat_buf.st_uid = 0;
354- fstat_buf.st_gid = 0;
355- if (iso9660_inodes) {
356- fstat_buf.st_ino = (unsigned long)
357- isonum_733((unsigned char *)idr->extent);
358- }
359- if (use_rock)
360- dump_rr(idr);
361 if (Xtract &&
362 (idr->flags[0] & 2) != 0 &&
363 idr->name_len[0] == 1 &&
364@@ -1170,30 +1227,30 @@ static int nlen = 0;
365 n[rlen] = '\0';
366
367 if ((idr->flags[0] & 2) != 0 &&
368- (idr->name_len[0] != 1 ||
369+ ((rr_flags & RR_FLAG_CL) ||
370+ idr->name_len[0] != 1 ||
371 (idr->name[0] != 0 && idr->name[0] != 1))) {
372 /*
373 * This is a plain directory (neither "xxx/."
374 * nor "xxx/..").
375 * Add this directory to the todo list.
376 */
377- td = todo_idr;
378- if (td != NULL) {
379- while (td->next != NULL)
380- td = td->next;
381- td->next = (struct todo *) malloc(sizeof (*td));
382- td = td->next;
383- } else {
384- todo_idr = td = (struct todo *) malloc(sizeof (*td));
385- }
386+ td = (struct todo *) malloc(sizeof (*td));
387+ if (td == NULL)
388+ comerr(_("No memory.\n"));
389 td->next = NULL;
390 td->extent = isonum_733((unsigned char *)idr->extent);
391 td->length = isonum_733((unsigned char *)idr->size);
392 td->name = (char *) malloc(strlen(rootname)
393 + strlen(name_buf) + 2);
394+ if (td->name == NULL)
395+ comerr(_("No memory.\n"));
396 strcpy(td->name, rootname);
397 strcat(td->name, name_buf);
398 strcat(td->name, "/");
399+
400+ *todo_pp = td;
401+ todo_pp = &td->next;
402 } else {
403 if (xtract && strcmp(xtract, n) == 0) {
404 extract_file(STDOUT_FILENO, idr, "stdout");
405@@ -1253,6 +1310,7 @@ static int nlen = 0;
406 if ((idr->flags[0] & ISO_MULTIEXTENT) == 0)
407 size = 0;
408 }
409+ cont:
410 i += buffer[i];
411 if (i > 2048 - offsetof(struct iso_directory_record, name[0])) break;
412 }
413@@ -1381,12 +1439,13 @@ main(argc, argv)
414 usage(0);
415 if (prvers) {
416 printf(_("isoinfo %s (%s-%s-%s) Copyright (C) 1993-1999 %s (C) 1999-2015 %s\n"),
417- VERSION,
418+ "3.02a02",
419 HOST_CPU, HOST_VENDOR, HOST_OS,
420 _("Eric Youngdale"),
421 _("Joerg Schilling"));
422 exit(0);
423 }
424+ myuid = getuid();
425 #ifdef USE_FIND
426 if (do_find) {
427 finda_t fa;
428--- cdrtools-3.01.orig/mkisofs/udf.c 2013-04-24 20:45:18.000000000 +0000
429+++ cdrtools-3.01/mkisofs/udf.c 2015-11-25 22:07:30.000000000 +0000
430@@ -1,15 +1,15 @@
431-/* @(#)udf.c 1.42 13/04/24 Copyright 2001-2013 J. Schilling */
432+/* @(#)udf.c 1.43 15/11/25 Copyright 2001-2015 J. Schilling */
433 #include <schily/mconfig.h>
434 #ifndef lint
435 static UConst char sccsid[] =
436- "@(#)udf.c 1.42 13/04/24 Copyright 2001-2013 J. Schilling";
437+ "@(#)udf.c 1.43 15/11/25 Copyright 2001-2015 J. Schilling";
438 #endif
439 /*
440 * udf.c - UDF support for mkisofs
441 *
442 * Written by Ben Rudiak-Gould (2001).
443 *
444- * Copyright 2001-2013 J. Schilling.
445+ * Copyright 2001-2015 J. Schilling.
446 */
447 /*
448 * This program is free software; you can redistribute it and/or modify
449@@ -98,7 +98,7 @@ static UConst char sccsid[] =
450 extern int use_sparcboot;
451
452 extern struct directory *root;
453-extern time_t begun;
454+extern struct timeval tv_begun;
455
456 static unsigned lba_main_seq;
457 static unsigned lba_main_seq_copy;
458@@ -110,7 +110,7 @@ static unsigned lba_end_anchor_vol_desc;
459 static unsigned num_udf_files;
460 static unsigned num_udf_directories;
461
462-static unsigned volume_set_id[2];
463+static unsigned volume_set_id[2] = { 0, 0 };
464
465 #define UDF_MAIN_SEQ_LENGTH (16)
466 #define UDF_INTEG_SEQ_LENGTH (2)
467@@ -723,7 +723,7 @@ set_primary_vol_desc(buf, lba)
468 /*pvd->volume_abstract;*/
469 /*pvd->volume_copyright_notice;*/
470 /*pvd->application_ident;*/
471- set_timestamp_from_time_t(&pvd->recording_date_and_time, begun);
472+ set_timestamp_from_time_t(&pvd->recording_date_and_time, tv_begun.tv_sec);
473 set_impl_ident(&pvd->impl_ident);
474 set_tag(&pvd->desc_tag, UDF_TAGID_PRIMARY_VOLUME_DESC, lba, 512);
475 }
476@@ -831,7 +831,7 @@ set_logical_vol_integrity_desc(buf, lba)
477 udf_logical_volume_integrity_desc *lvid =
478 (udf_logical_volume_integrity_desc *)buf;
479
480- set_timestamp_from_time_t(&lvid->recording_date, begun);
481+ set_timestamp_from_time_t(&lvid->recording_date, tv_begun.tv_sec);
482 set32(&lvid->integrity_type, UDF_INTEGRITY_TYPE_CLOSE);
483 /*lvid->next_integrity_extent;*/
484 set64(&lvid->logical_volume_contents_use.unique_id,
485@@ -859,7 +859,7 @@ set_file_set_desc(buf, rba)
486 {
487 udf_file_set_desc *fsd = (udf_file_set_desc *)buf;
488
489- set_timestamp_from_time_t(&fsd->recording_date_and_time, begun);
490+ set_timestamp_from_time_t(&fsd->recording_date_and_time, tv_begun.tv_sec);
491 set16(&fsd->interchange_level, 3);
492 set16(&fsd->maximum_interchange_level, 3);
493 set32(&fsd->character_set_list, 1);
494@@ -1986,8 +1986,10 @@ udf_main_seq_write(out)
495 * volume_set_id needs to be set to a (64-bit) "unique" number.
496 * This will have to do for now.
497 */
498- volume_set_id[0] = begun;
499- volume_set_id[1] = (unsigned)clock(); /* XXX Maybe non-portable */
500+ if (volume_set_id[0] == 0) {
501+ volume_set_id[0] = tv_begun.tv_sec;
502+ volume_set_id[1] = (unsigned)tv_begun.tv_usec;
503+ }
504
505 memset(buf, 0, sizeof (buf));
506 set_primary_vol_desc(buf, last_extent_written++);
507--- cdrtools-3.01.orig/mkisofs/mkisofs.c 2015-01-01 14:19:51.000000000 +0000
508+++ cdrtools-3.01/mkisofs/mkisofs.c
509@@ -69 +69 @@ int path_ind;
510-char version_string[] = VERSION;
511+char version_string[] = "3.01-fix-20151126";
This page took 0.645963 seconds and 4 git commands to generate.