1 Patch for version 3.01, taken from upstream at
2 https://sourceforge.net/projects/cdrtools/files/cdrtools-3.01-fix-20151126-mkisofs-isoinfo.patch
4 --- cdrtools-3.01.orig/mkisofs/diag/isoinfo.c 2015-07-22 20:36:45.000000000 +0000
5 +++ cdrtools-3.01/mkisofs/diag/isoinfo.c 2015-11-17 19:35:40.000000000 +0000
7 -/* @(#)isoinfo.c 1.95 15/07/22 joerg */
8 +/* @(#)isoinfo.c 1.100 15/11/17 joerg */
9 #include <schily/mconfig.h>
11 static UConst char sccsid[] =
12 - "@(#)isoinfo.c 1.95 15/07/22 joerg";
13 + "@(#)isoinfo.c 1.100 15/11/17 joerg";
16 * File isodump.c - dump iso9660 directory information.
17 @@ -148,8 +148,10 @@ LOCAL char er_id[256];
18 LOCAL int su_version = 0;
19 LOCAL int rr_version = 0;
20 LOCAL int aa_version = 0;
21 +LOCAL int cl_extent = 0;
22 LOCAL int ucs_level = 0;
23 LOCAL BOOL iso9660_inodes = FALSE;
27 LOCAL findn_t *find_node; /* syntaxtree from find_parse() */
28 @@ -208,6 +210,9 @@ LOCAL void extract __PR((char *rootname
29 LOCAL void extract_file __PR((int f,
30 struct iso_directory_record * idr,
32 +LOCAL void parse_cl_dir __PR((struct iso_directory_record *idr,
34 +LOCAL BOOL parse_de __PR((struct iso_directory_record *idr));
35 LOCAL void parse_dir __PR((char * rootname, int extent, int len));
36 LOCAL void usage __PR((int excode));
37 EXPORT int main __PR((int argc, char *argv[]));
38 @@ -459,7 +464,6 @@ parse_rr(pnt, len, cont_flag)
44 int cont_extent, cont_offset, cont_size;
46 @@ -469,7 +473,7 @@ parse_rr(pnt, len, cont_flag)
50 - cont_extent = cont_offset = cont_size = 0;
51 + cl_extent = cont_extent = cont_offset = cont_size = 0;
55 @@ -714,6 +718,7 @@ struct todo
58 LOCAL struct todo *todo_idr = NULL;
59 +LOCAL struct todo **todo_pp = &todo_idr;
61 LOCAL char *months[12] = {"Jan", "Feb", "Mar", "Apr",
63 @@ -962,8 +967,14 @@ static BOOL isfirst = TRUE;
67 - fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
68 fchownat(AT_FDCWD, fname, fstat_buf.st_uid, fstat_buf.st_gid, AT_SYMLINK_NOFOLLOW);
69 + if (myuid != 0 && S_ISDIR(fstat_buf.st_mode)) {
71 + * Temporary hack until we have a dirstack like star.
73 + fstat_buf.st_mode |= S_IWUSR;
75 + fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
76 times[0].tv_sec = fstat_buf.st_atime;
77 times[0].tv_nsec = stat_ansecs(&fstat_buf);
78 times[1].tv_sec = fstat_buf.st_mtime;
79 @@ -1001,6 +1012,143 @@ extract_file(f, idr, fname)
85 +parse_cl_dir(idr, extent)
86 + struct iso_directory_record *idr;
89 + char cl_name_buf[256*3];
91 + strlcpy(cl_name_buf, name_buf, sizeof (cl_name_buf));
93 + readsecs(extent - sector_offset, idr, 1);
95 + lseek(fileno(infile), ((off_t)(extent - sector_offset)) << 11, SEEK_SET);
96 + read(fileno(infile), idr, 2048);
99 + if (parse_de(idr) && use_rock)
101 + strlcpy(name_buf, cl_name_buf, sizeof (name_buf));
106 + struct iso_directory_record *idr;
110 + if (idr->length[0] == 0)
112 + memset(&fstat_buf, 0, sizeof (fstat_buf));
114 + name_buf[0] = xname[0] = 0;
115 + fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
116 + if (idr->flags[0] & 2)
117 + fstat_buf.st_mode |= S_IFDIR;
119 + fstat_buf.st_mode |= S_IFREG;
120 + if (idr->name_len[0] == 1 && idr->name[0] == 0)
121 + strcpy(name_buf, ".");
122 + else if (idr->name_len[0] == 1 && idr->name[0] == 1)
123 + strcpy(name_buf, "..");
125 + switch (ucs_level) {
130 + * Unicode name. Convert as best we can.
134 + name_buf[0] = '\0';
136 + if (use_iconv(unls)) {
138 + char *to = name_buf;
140 + for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
141 + char *ibuf = (char *)&idr->name[j*2];
142 + size_t isize = 2; /* UCS-2 character size */
145 + if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
146 + (char **)&to, &osize) == -1) {
147 + int err = geterrno();
149 + if ((err == EINVAL || err == EILSEQ) &&
163 + for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
166 + unichar = (idr->name[j*2] & 0xFF) * 256 +
167 + (idr->name[j*2+1] & 0xFF);
170 + * Get the backconverted char
173 + uc = sic_uni2c(unls, unichar);
175 + uc = unichar > 255 ? '_' : unichar;
177 + name_buf[j] = uc ? uc : '_';
179 + name_buf[j] = '\0';
184 + * Normal non-Unicode name.
186 + strncpy(name_buf, idr->name, idr->name_len[0]);
187 + name_buf[idr->name_len[0]] = 0;
191 + * Don't know how to do these yet. Maybe they are the same
192 + * as one of the above.
197 + memcpy(date_buf, idr->date, 9);
199 + * Always first set up time stamps and file modes from
200 + * ISO-9660. This is used as a fallback in case that
201 + * there is no related Rock Ridge based data.
203 + fstat_buf.st_atime =
204 + fstat_buf.st_mtime =
205 + fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
206 + fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
209 + fstat_buf.st_nlink = 1;
210 + fstat_buf.st_ino = 0;
211 + fstat_buf.st_uid = 0;
212 + fstat_buf.st_gid = 0;
213 + if (iso9660_inodes) {
214 + fstat_buf.st_ino = (unsigned long)
215 + isonum_733((unsigned char *)idr->extent);
221 parse_dir(rootname, extent, len)
223 @@ -1012,12 +1160,13 @@ parse_dir(rootname, extent, len)
224 struct iso_directory_record * idr;
225 struct iso_directory_record didr;
228 + unsigned char cl_buffer[2048];
229 unsigned char flags = 0;
238 @@ -1039,115 +1188,23 @@ static int nlen = 0;
241 idr = (struct iso_directory_record *) &buffer[i];
242 - if (idr->length[0] == 0) break;
243 - memset(&fstat_buf, 0, sizeof (fstat_buf));
245 - name_buf[0] = xname[0] = 0;
246 - fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
247 - if (idr->flags[0] & 2)
248 - fstat_buf.st_mode |= S_IFDIR;
250 - fstat_buf.st_mode |= S_IFREG;
251 - if (idr->name_len[0] == 1 && idr->name[0] == 0)
252 - strcpy(name_buf, ".");
253 - else if (idr->name_len[0] == 1 && idr->name[0] == 1)
254 - strcpy(name_buf, "..");
256 - switch (ucs_level) {
261 - * Unicode name. Convert as best we can.
266 - name_buf[0] = '\0';
268 - if (use_iconv(unls)) {
270 - char *to = name_buf;
272 - for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
273 - char *ibuf = (char *)&idr->name[j*2];
274 - size_t isize = 2; /* UCS-2 character size */
277 - if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
278 - (char **)&to, &osize) == -1) {
279 - int err = geterrno();
281 - if ((err == EINVAL || err == EILSEQ) &&
295 - for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
298 - unichar = (idr->name[j*2] & 0xFF) * 256 +
299 - (idr->name[j*2+1] & 0xFF);
302 - * Get the backconverted char
305 - uc = sic_uni2c(unls, unichar);
307 - uc = unichar > 255 ? '_' : unichar;
308 + if (idr->length[0] == 0)
312 + rr_flags = dump_rr(idr);
314 - name_buf[j] = uc ? uc : '_';
316 - name_buf[j] = '\0';
320 + if (rr_flags & RR_FLAG_CL) {
322 - * Normal non-Unicode name.
323 + * Need to reparse the child link
324 + * but note that we parse "CL/."
325 + * so we get no usable file name.
327 - strncpy(name_buf, idr->name, idr->name_len[0]);
328 - name_buf[idr->name_len[0]] = 0;
332 - * Don't know how to do these yet. Maybe they are the same
333 - * as one of the above.
337 + idr = (struct iso_directory_record *) cl_buffer;
338 + parse_cl_dir(idr, cl_extent);
339 + } else if (rr_flags & RR_FLAG_RE)
340 + goto cont; /* skip rr_moved */
342 - memcpy(date_buf, idr->date, 9);
344 - * Always first set up time stamps and file modes from
345 - * ISO-9660. This is used as a fallback in case that
346 - * there is no related Rock Ridge based data.
348 - fstat_buf.st_atime =
349 - fstat_buf.st_mtime =
350 - fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
351 - fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
354 - fstat_buf.st_nlink = 1;
355 - fstat_buf.st_ino = 0;
356 - fstat_buf.st_uid = 0;
357 - fstat_buf.st_gid = 0;
358 - if (iso9660_inodes) {
359 - fstat_buf.st_ino = (unsigned long)
360 - isonum_733((unsigned char *)idr->extent);
365 (idr->flags[0] & 2) != 0 &&
366 idr->name_len[0] == 1 &&
367 @@ -1170,30 +1227,30 @@ static int nlen = 0;
370 if ((idr->flags[0] & 2) != 0 &&
371 - (idr->name_len[0] != 1 ||
372 + ((rr_flags & RR_FLAG_CL) ||
373 + idr->name_len[0] != 1 ||
374 (idr->name[0] != 0 && idr->name[0] != 1))) {
376 * This is a plain directory (neither "xxx/."
378 * Add this directory to the todo list.
382 - while (td->next != NULL)
384 - td->next = (struct todo *) malloc(sizeof (*td));
387 - todo_idr = td = (struct todo *) malloc(sizeof (*td));
389 + td = (struct todo *) malloc(sizeof (*td));
391 + comerr(_("No memory.\n"));
393 td->extent = isonum_733((unsigned char *)idr->extent);
394 td->length = isonum_733((unsigned char *)idr->size);
395 td->name = (char *) malloc(strlen(rootname)
396 + strlen(name_buf) + 2);
397 + if (td->name == NULL)
398 + comerr(_("No memory.\n"));
399 strcpy(td->name, rootname);
400 strcat(td->name, name_buf);
401 strcat(td->name, "/");
404 + todo_pp = &td->next;
406 if (xtract && strcmp(xtract, n) == 0) {
407 extract_file(STDOUT_FILENO, idr, "stdout");
408 @@ -1253,6 +1310,7 @@ static int nlen = 0;
409 if ((idr->flags[0] & ISO_MULTIEXTENT) == 0)
414 if (i > 2048 - offsetof(struct iso_directory_record, name[0])) break;
416 @@ -1381,12 +1439,13 @@ main(argc, argv)
419 printf(_("isoinfo %s (%s-%s-%s) Copyright (C) 1993-1999 %s (C) 1999-2015 %s\n"),
422 HOST_CPU, HOST_VENDOR, HOST_OS,
424 _("Joerg Schilling"));
431 --- cdrtools-3.01.orig/mkisofs/udf.c 2013-04-24 20:45:18.000000000 +0000
432 +++ cdrtools-3.01/mkisofs/udf.c 2015-11-25 22:07:30.000000000 +0000
434 -/* @(#)udf.c 1.42 13/04/24 Copyright 2001-2013 J. Schilling */
435 +/* @(#)udf.c 1.43 15/11/25 Copyright 2001-2015 J. Schilling */
436 #include <schily/mconfig.h>
438 static UConst char sccsid[] =
439 - "@(#)udf.c 1.42 13/04/24 Copyright 2001-2013 J. Schilling";
440 + "@(#)udf.c 1.43 15/11/25 Copyright 2001-2015 J. Schilling";
443 * udf.c - UDF support for mkisofs
445 * Written by Ben Rudiak-Gould (2001).
447 - * Copyright 2001-2013 J. Schilling.
448 + * Copyright 2001-2015 J. Schilling.
451 * This program is free software; you can redistribute it and/or modify
452 @@ -98,7 +98,7 @@ static UConst char sccsid[] =
453 extern int use_sparcboot;
455 extern struct directory *root;
456 -extern time_t begun;
457 +extern struct timeval tv_begun;
459 static unsigned lba_main_seq;
460 static unsigned lba_main_seq_copy;
461 @@ -110,7 +110,7 @@ static unsigned lba_end_anchor_vol_desc;
462 static unsigned num_udf_files;
463 static unsigned num_udf_directories;
465 -static unsigned volume_set_id[2];
466 +static unsigned volume_set_id[2] = { 0, 0 };
468 #define UDF_MAIN_SEQ_LENGTH (16)
469 #define UDF_INTEG_SEQ_LENGTH (2)
470 @@ -723,7 +723,7 @@ set_primary_vol_desc(buf, lba)
471 /*pvd->volume_abstract;*/
472 /*pvd->volume_copyright_notice;*/
473 /*pvd->application_ident;*/
474 - set_timestamp_from_time_t(&pvd->recording_date_and_time, begun);
475 + set_timestamp_from_time_t(&pvd->recording_date_and_time, tv_begun.tv_sec);
476 set_impl_ident(&pvd->impl_ident);
477 set_tag(&pvd->desc_tag, UDF_TAGID_PRIMARY_VOLUME_DESC, lba, 512);
479 @@ -831,7 +831,7 @@ set_logical_vol_integrity_desc(buf, lba)
480 udf_logical_volume_integrity_desc *lvid =
481 (udf_logical_volume_integrity_desc *)buf;
483 - set_timestamp_from_time_t(&lvid->recording_date, begun);
484 + set_timestamp_from_time_t(&lvid->recording_date, tv_begun.tv_sec);
485 set32(&lvid->integrity_type, UDF_INTEGRITY_TYPE_CLOSE);
486 /*lvid->next_integrity_extent;*/
487 set64(&lvid->logical_volume_contents_use.unique_id,
488 @@ -859,7 +859,7 @@ set_file_set_desc(buf, rba)
490 udf_file_set_desc *fsd = (udf_file_set_desc *)buf;
492 - set_timestamp_from_time_t(&fsd->recording_date_and_time, begun);
493 + set_timestamp_from_time_t(&fsd->recording_date_and_time, tv_begun.tv_sec);
494 set16(&fsd->interchange_level, 3);
495 set16(&fsd->maximum_interchange_level, 3);
496 set32(&fsd->character_set_list, 1);
497 @@ -1986,8 +1986,10 @@ udf_main_seq_write(out)
498 * volume_set_id needs to be set to a (64-bit) "unique" number.
499 * This will have to do for now.
501 - volume_set_id[0] = begun;
502 - volume_set_id[1] = (unsigned)clock(); /* XXX Maybe non-portable */
503 + if (volume_set_id[0] == 0) {
504 + volume_set_id[0] = tv_begun.tv_sec;
505 + volume_set_id[1] = (unsigned)tv_begun.tv_usec;
508 memset(buf, 0, sizeof (buf));
509 set_primary_vol_desc(buf, last_extent_written++);
510 --- cdrtools-3.01.orig/mkisofs/mkisofs.c 2015-01-01 14:19:51.000000000 +0000
511 +++ cdrtools-3.01/mkisofs/mkisofs.c
512 @@ -69 +69 @@ int path_ind;
513 -char version_string[] = VERSION;
514 +char version_string[] = "3.01-fix-20151126";