From: Mariusz Mazur Date: Sun, 1 Jun 2003 13:11:14 +0000 (+0000) Subject: - updated silo patch (based on patch from Debian). X-Git-Tag: cdrtools-2_01a16-1~4 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fcdrtools.git;a=commitdiff_plain;h=3536726cd6e288a58c69b266daa45fd93583f96f - updated silo patch (based on patch from Debian). - goto kloczek Changed files: cdrtools-silo.patch -> 1.3 --- diff --git a/cdrtools-silo.patch b/cdrtools-silo.patch index 0cbd4b0..fa4adf3 100644 --- a/cdrtools-silo.patch +++ b/cdrtools-silo.patch @@ -1,34 +1,34 @@ ---- cdrtools-2.01/mkisofs/Makefile.orig Sat Mar 1 23:44:58 2003 -+++ cdrtools-2.01/mkisofs/Makefile Mon Mar 10 20:59:39 2003 +--- cdrtools-2.00.3/mkisofs/Makefile 2002-12-07 21:42:32.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/Makefile 2002-12-27 20:24:53.000000000 +0100 @@ -41,7 +41,7 @@ getopt.c getopt1.c \ scsi.c \ scsi_cdr.c cd_misc.c \ - modes.c \ + modes.c silo.c \ - apple.c volume.c desktop.c mac_label.c stream.c \ + apple.c volume.c desktop.c mac_label.c \ ifo_read.c dvd_file.c dvd_reader.c HFILES= apple.h bootinfo.h config.h defaults.h diskmbr.h exclude.h \ ---- cdrtools-1.10/mkisofs/defaults.h -+++ cdrtools-1.10/mkisofs/defaults.h -@@ -22,6 +22,10 @@ - #define VOLUME_ID_DEFAULT "CDROM" - #define BOOT_CATALOG_DEFAULT "boot.catalog" - #define BOOT_IMAGE_DEFAULT NULL -+#define SILO_BOOT_IMAGE_DEFAULT "boot/second.b" -+#define SILO_BOOTBLOCK_DEFAULT "boot/cd.b" -+#define SILO_CONF_FILE_DEFAULT "/etc/silo.conf" -+ - #ifdef APPLE_HYB - #define APPLE_TYPE_DEFAULT "TEXT" - #define APPLE_CREATOR_DEFAULT "unix" ---- cdrtools-1.10/mkisofs/mkisofs.8 -+++ cdrtools-1.10/mkisofs/mkisofs.8 -@@ -1272,6 +1280,25 @@ - .B \&.m\&kisofsrc +--- cdrtools-2.00.3/mkisofs/mkisofs.8 2002-12-24 16:39:31.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/mkisofs.8 2002-12-27 20:24:53.000000000 +0100 +@@ -456,6 +456,13 @@ + .IR gid . + Specifying this option automatically enables Rock Ridge extensions. + .TP ++.BI \-F " root_directory ++Follow symbolic links which point outside specified ++.I root_directory ++when generating the filesystem. This allows a symlink farm structure, ++where symlinks inside the base directory stay symlinks, but symlinks ++outside the base directory become real files on the CD. ++.TP + .B \-gui + Switch the behaviour for a GUI. This currently makes the output more verbose + but may have other effects in future. +@@ -919,6 +926,25 @@ with SYSI=system_id. If specified in both places, the command line version is used. -+.TP + .TP +.BI \-s " silo_conf_file +Specifies the path and filename of the SILO configuration file to be +used when making a "SILO" bootable CD. The pathname must be relative to the @@ -47,31 +47,39 @@ +The default is +.I boot/cd.b +The boot image must come from SILO 0.8.7 and higher. - .TP ++.TP .B \-T Generate a file TRANS.TBL in each directory on the CDROM, which can be used ---- cdrtools-2.01/mkisofs/mkisofs.c.orig Sun Mar 2 17:28:33 2003 -+++ cdrtools-2.01/mkisofs/mkisofs.c Mon Mar 10 21:21:18 2003 -@@ -98,6 +98,7 @@ + on non-Rock Ridge capable systems to help establish the correct file names. +--- cdrtools-2.00.3/mkisofs/mkisofs.c 2002-12-07 20:59:41.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/mkisofs.c 2002-12-27 20:24:53.000000000 +0100 +@@ -94,12 +94,14 @@ + int use_genboot = 0; + int use_RockRidge = 0; + int use_Joliet = 0; ++int use_silo = 0; + int jlen = JMAX; /* maximum Joliet file name length */ int verbose = 1; int debug = 0; int gui = 0; -+int use_silo = 0; int all_files = 1; /* New default is to include all files */ int follow_links = 0; ++int follow_links_sensible = 0; #ifdef IS_CYGWIN -@@ -133,6 +134,10 @@ + int cache_inodes = 0;/* Do not cache inodes on Cygwin by default */ + #else +@@ -133,6 +135,10 @@ char *boot_catalog = BOOT_CATALOG_DEFAULT; char *boot_image = BOOT_IMAGE_DEFAULT; char *genboot_image = BOOT_IMAGE_DEFAULT; -+char *silo_boot_image = SILO_BOOT_IMAGE_DEFAULT; -+char *silo_bootblock = SILO_BOOTBLOCK_DEFAULT; -+char *silo_conf_file = SILO_CONF_FILE_DEFAULT; -+ ++char *silo_boot_image = SILO_BOOT_IMAGE_DEFAULT; ++char *silo_bootblock = SILO_BOOTBLOCK_DEFAULT; ++char *silo_conf_file = SILO_CONF_FILE_DEFAULT; ++char follow_links_base[PATH_MAX]; int ucs_level = 3; /* We now have Unicode tables so use level 3 */ int volume_set_size = 1; int volume_sequence_number = 1; -@@ -408,6 +413,8 @@ +@@ -403,6 +409,8 @@ #endif /* APPLE_HYB */ @@ -80,7 +88,7 @@ static int save_pname = 0; static const struct ld_option ld_options[] = -@@ -440,6 +447,8 @@ +@@ -435,6 +443,8 @@ '\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH}, {{"sparc-boot", required_argument, NULL, 'B'}, 'B', "FILES", "Set sparc boot image names", ONE_DASH}, @@ -89,83 +97,122 @@ {{"generic-boot", required_argument, NULL, 'G'}, 'G', "FILE", "Set generic boot image name", ONE_DASH}, {{"sparc-label", required_argument, NULL, OPTION_SPARCLABEL}, -@@ -548,7 +557,10 @@ - { {"sort", required_argument, NULL, OPTION_SORT}, +@@ -453,6 +463,8 @@ + '\0', "mode", "Make the mode of all plain files this mode.", ONE_DASH}, + {{"follow-links", no_argument, NULL, 'f'}, + 'f', NULL, "Follow symbolic links", ONE_DASH}, ++ {{"follow-outside-links", required_argument, NULL, 'F'}, ++ 'F', NULL, "Follow symbolic links which point outside the CD base directory", ONE_DASH }, + {{"gid", required_argument, NULL, OPTION_GID}, + '\0', "gid", "Make the group owner of all files this gid.", + ONE_DASH}, +@@ -544,6 +556,11 @@ '\0', "FILE", "Sort file content locations according to rules in FILE" , ONE_DASH }, #endif /* SORTING */ -- + + { {"silo-conf-file", required_argument, NULL, 's'}, -+ 's', "FILE", "Set name of SILO configuration file on the CD", ONE_DASH }, ++ 's', "FILE", "Set name of SILO configuration file on the CD", ONE_DASH }, + { {"silo-bootblock", required_argument, NULL, 'S'}, -+ 'S', "FILE", "Set SILO first stage bootblock image name", ONE_DASH }, ++ 'S', "FILE", "Set SILO first stage bootblock image name", ONE_DASH }, ++ {{"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT}, '\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH}, - {{"stream-file-name", required_argument, NULL, OPTION_STREAM_FILE_NAME}, -@@ -1362,6 +1374,34 @@ + {{"sysid", required_argument, NULL, OPTION_SYSID}, +@@ -1150,7 +1167,7 @@ + int hfs_ct = 0; + char *root_info = 0; + #endif /* APPLE_HYB */ +- ++ char old_dir[PATH_MAX]; + + #ifdef __EMX__ + /* This gives wildcard expansion with Non-Posix shells with EMX */ +@@ -1352,6 +1369,34 @@ #endif } break; -+ case OPTION_SILO_BOOT: -+ use_silo++; -+ silo_boot_image = optarg; /* pathname of the boot image on cd */ -+ if (silo_boot_image == NULL) { -+ fprintf(stderr,"Required boot image pathname missing\n"); -+ exit(1); -+ } -+ break; -+ case 'S': -+ use_silo++; -+ silo_bootblock = optarg; /* pathname of the boot image on cd */ -+ if (silo_bootblock == NULL) { -+ fprintf(stderr,"Required bootblock pathname missing\n"); -+ exit(1); -+ } -+ break; -+ case 's': -+ use_silo++; -+ silo_conf_file = optarg; /* pathname of the boot image on cd */ -+ if (silo_conf_file == NULL) { -+ fprintf(stderr,"Required SILO config file pathname missing\n"); -+ exit(1); -+ } -+ if (*silo_conf_file != '/') { -+ fprintf(stderr,"SILO config file pathname must start with /\n"); -+ exit(1); -+ } -+ break; ++ case OPTION_SILO_BOOT: ++ use_silo++; ++ silo_boot_image = optarg; /* pathname of the boot image on cd */ ++ if (silo_boot_image == NULL) { ++ fprintf(stderr,"Required boot image pathname missing\n"); ++ exit(1); ++ } ++ break; ++ case 'S': ++ use_silo++; ++ silo_bootblock = optarg; /* pathname of the boot image on cd */ ++ if (silo_bootblock == NULL) { ++ fprintf(stderr,"Required bootblock pathname missing\n"); ++ exit(1); ++ } ++ break; ++ case 's': ++ use_silo++; ++ silo_conf_file = optarg; /* pathname of the boot image on cd */ ++ if (silo_conf_file == NULL) { ++ fprintf(stderr,"Required SILO config file pathname missing\n"); ++ exit(1); ++ } ++ if (*silo_conf_file != '/') { ++ fprintf(stderr,"SILO config file pathname must start with /\n"); ++ exit(1); ++ } ++ break; case OPTION_ABSTRACT: abstract = optarg; if (strlen(abstract) > 37) { -@@ -3004,7 +3044,10 @@ +@@ -1446,6 +1491,20 @@ + "Warning: -follow-links does not always work correctly; be careful.\n"); + #endif + break; ++ case 'F': ++ follow_links_sensible++; ++ if(getcwd (old_dir, PATH_MAX)) { ++ chdir (optarg); ++ if(!getcwd (follow_links_base, PATH_MAX)) { ++ perror("getcwd"); ++ exit(1); ++ } ++ chdir (old_dir); ++ } else { ++ perror("getcwd"); ++ exit(1); ++ } ++ break; + case 'l': + full_iso9660_filenames++; + break; +@@ -2967,7 +3026,10 @@ outputlist_insert(&sunlabel_desc); if (use_genboot) outputlist_insert(&genboot_desc); -- outputlist_insert(&startpad_desc); -+ if (use_silo) -+ outputlist_insert(&silo_desc); +- outputlist_insert(&padblock_desc); ++ if (use_silo) ++ outputlist_insert(&silo_desc); + else + outputlist_insert(&padblock_desc); /* PVD for disc. */ outputlist_insert(&voldesc_desc); ---- cdrtools-2.01/mkisofs/mkisofs.h.orig Fri Feb 28 01:30:36 2003 -+++ cdrtools-2.01/mkisofs/mkisofs.h Mon Mar 10 21:22:48 2003 -@@ -167,6 +167,7 @@ +--- cdrtools-2.00.3/mkisofs/mkisofs.h 2002-12-07 20:59:42.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/mkisofs.h 2002-12-27 20:24:53.000000000 +0100 +@@ -169,6 +169,7 @@ extern struct output_fragment *out_tail; - extern struct output_fragment startpad_desc; + extern struct output_fragment padblock_desc; +extern struct output_fragment silo_desc; extern struct output_fragment voldesc_desc; - extern struct output_fragment xvoldesc_desc; extern struct output_fragment joliet_desc; -@@ -268,8 +269,15 @@ + extern struct output_fragment torito_desc; +@@ -265,8 +266,15 @@ struct directory_entry *s_entry; unsigned int pad; off_t off; +#ifdef __STDC__ -+ int (*filter)(char *, int, int); ++ int (*filter)(char *, int, int); +#else -+ int (*filter)(); ++ int (*filter)(); +#endif }; @@ -174,7 +221,16 @@ struct eltorito_boot_entry_info { struct eltorito_boot_entry_info *next; char *boot_image; -@@ -616,6 +624,9 @@ +@@ -323,6 +331,8 @@ + extern int dirmode_to_use; + extern int new_dir_mode; + extern int follow_links; ++extern int follow_links_sensible; ++extern char follow_links_base[]; + extern int cache_inodes; + extern int verbose; + extern int debug; +@@ -619,6 +629,9 @@ extern char *boot_catalog; extern char *boot_image; extern char *genboot_image; @@ -184,12 +240,12 @@ extern int ucs_level; extern int volume_set_size; extern int volume_sequence_number; ---- cdrtools-1.10/mkisofs/silo.c -+++ cdrtools-1.10/mkisofs/silo.c +--- cdrtools-2.00.3/mkisofs/silo.c 1970-01-01 01:00:00.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/silo.c 2002-12-27 20:24:53.000000000 +0100 @@ -0,0 +1,255 @@ +/* + * Program silo.c - Handle SILO bootable iso9660 CD-ROMs. -+ * ++ * + + Copyright (C) 1999 Jakub Jelinek . + @@ -228,39 +284,39 @@ +#endif /* O_BINARY */ + +struct sun_disklabel { -+ char info[128]; /* Informative text string */ -+ char spare0[14]; ++ char info[128]; /* Informative text string */ ++ char spare0[14]; + struct sun_info { -+ char spare1; -+ char id; -+ char spare2; -+ char flags; ++ char spare1; ++ char id; ++ char spare2; ++ char flags; + } infos[8]; -+ char spare1[246]; /* Boot information etc. */ -+ char rspeed[2]; /* 722 - Disk rotational speed */ -+ char pcylcount[2]; /* 722 - Physical cylinder count */ -+ char sparecyl[2]; /* 722 - extra sects per cylinder */ -+ char spare2[4]; /* More magic... */ -+ char ilfact[2]; /* 722 - Interleave factor */ -+ char ncyl[2]; /* 722 - Data cylinder count */ -+ char nacyl[2]; /* 722 - Alt. cylinder count */ -+ char ntrks[2]; /* 722 - Tracks per cylinder */ -+ char nsect[2]; /* 722 - Sectors per track */ -+ char spare3[4]; /* Even more magic... */ ++ char spare1[246]; /* Boot information etc. */ ++ char rspeed[2]; /* 722 - Disk rotational speed */ ++ char pcylcount[2]; /* 722 - Physical cylinder count */ ++ char sparecyl[2]; /* 722 - extra sects per cylinder */ ++ char spare2[4]; /* More magic... */ ++ char ilfact[2]; /* 722 - Interleave factor */ ++ char ncyl[2]; /* 722 - Data cylinder count */ ++ char nacyl[2]; /* 722 - Alt. cylinder count */ ++ char ntrks[2]; /* 722 - Tracks per cylinder */ ++ char nsect[2]; /* 722 - Sectors per track */ ++ char spare3[4]; /* Even more magic... */ + struct sun_partition { -+ char start_cylinder[4]; /* 732 */ -+ char num_sectors[4]; /* 732 */ ++ char start_cylinder[4]; /* 732 */ ++ char num_sectors[4]; /* 732 */ + } partitions[8]; -+ char magic[2]; /* 722 - Magic number */ -+ char csum[2]; /* 722 - Label xor'd checksum */ ++ char magic[2]; /* 722 - Magic number */ ++ char csum[2]; /* 722 - Label xor'd checksum */ + struct bootblock_header { -+ char magic[4]; /* 732 */ -+ char aout[20]; -+ char siloid[8]; -+ char insn[16]; -+ char extent[4]; /* 732 */ -+ char size[4]; /* 732 */ -+ char text[2048-512-56]; ++ char magic[4]; /* 732 */ ++ char aout[20]; ++ char siloid[8]; ++ char insn[16]; ++ char extent[4]; /* 732 */ ++ char size[4]; /* 732 */ ++ char text[2048-512-56]; + } bootblock; +}; + @@ -281,21 +337,21 @@ +static int silo_filter(char * buffer, int size, int offset) +{ + if (offset < 0x808 + sizeof(silo_info) -+ && offset + size > 0x808) ++ && offset + size > 0x808) + { -+ int i; -+ if (offset < 0x808) -+ { -+ offset = 0x808 - offset; -+ size -= offset; -+ buffer += offset; -+ offset = 0; -+ } -+ else -+ offset -= 0x808; -+ i = sizeof(silo_info) - offset; -+ if (i > size) i = size; -+ memcpy (buffer, ((char *)&silo_info) + offset, i); ++ int i; ++ if (offset < 0x808) ++ { ++ offset = 0x808 - offset; ++ size -= offset; ++ buffer += offset; ++ offset = 0; ++ } ++ else ++ offset -= 0x808; ++ i = sizeof(silo_info) - offset; ++ if (i > size) i = size; ++ memcpy (buffer, ((char *)&silo_info) + offset, i); + } + return 0; +} @@ -304,79 +360,79 @@ +{ + struct directory_entry * de; + struct directory_entry * de2; -+ struct deferred_write * dwpnt; ++ struct deferred_write * dwpnt; + int bootblock, i, should_write; -+ struct sun_disklabel silo_bb; -+ ++ struct sun_disklabel silo_bb; ++ + memset (&silo_bb, 0, sizeof (silo_bb)); -+ ++ + if (*silo_bootblock == '/') silo_bootblock++; + if (*silo_boot_image == '/') silo_boot_image++; + + /* -+ * search from root of iso fs to find boot catalog ++ * search from root of iso fs to find boot catalog + */ + de2 = search_tree_file(root, silo_bootblock); -+ if (!de2) ++ if (!de2) + { -+ fprintf(stderr,"Uh oh, I cant find the SILO bootblock!\n"); -+ exit(1); ++ fprintf(stderr,"Uh oh, I cant find the SILO bootblock!\n"); ++ exit(1); + } + + /* + * now read it from disk + */ + bootblock = open(de2->whole_name, O_RDWR | O_BINARY); -+ if (bootblock == -1) ++ if (bootblock == -1) + { -+ fprintf(stderr,"Error opening SILO bootblock for reading.\n"); -+ perror(""); -+ exit(1); ++ fprintf(stderr,"Error opening SILO bootblock for reading.\n"); ++ perror(""); ++ exit(1); + } -+ ++ + if (read (bootblock, (char *)&silo_bb.bootblock, 1024) != 1024) + { -+ fprintf(stderr,"Error reading SILO bootblock.\n"); -+ perror(""); -+ exit(1); ++ fprintf(stderr,"Error reading SILO bootblock.\n"); ++ perror(""); ++ exit(1); + } + + close (bootblock); + + if (get_732 (silo_bb.bootblock.magic) != 0x01030107 -+ || strncmp (silo_bb.bootblock.siloid, "SILO", 4) -+ || silo_bb.bootblock.siloid[5] != '.' -+ || silo_bb.bootblock.siloid[4] < '0' -+ || silo_bb.bootblock.siloid[4] > '9' -+ || silo_bb.bootblock.siloid[6] < '0' -+ || silo_bb.bootblock.siloid[6] > '9' -+ || silo_bb.bootblock.siloid[7] < '0' -+ || silo_bb.bootblock.siloid[7] > '9') ++ || strncmp (silo_bb.bootblock.siloid, "SILO", 4) ++ || silo_bb.bootblock.siloid[5] != '.' ++ || silo_bb.bootblock.siloid[4] < '0' ++ || silo_bb.bootblock.siloid[4] > '9' ++ || silo_bb.bootblock.siloid[6] < '0' ++ || silo_bb.bootblock.siloid[6] > '9' ++ || silo_bb.bootblock.siloid[7] < '0' ++ || silo_bb.bootblock.siloid[7] > '9') + { -+ fprintf(stderr,"Error: the file %s is not a valid SILO bootblock.\n", silo_bootblock); -+ perror(""); -+ exit(1); ++ fprintf(stderr,"Error: the file %s is not a valid SILO bootblock.\n", silo_bootblock); ++ perror(""); ++ exit(1); + } -+ ++ + /* Check version number. Only SILO 0.87 and up is valid. */ + if (silo_bb.bootblock.siloid[4] == '0' -+ && (silo_bb.bootblock.siloid[6] < '8' -+ || (silo_bb.bootblock.siloid[6] == '8' -+ && silo_bb.bootblock.siloid[7] <= '6'))) ++ && (silo_bb.bootblock.siloid[6] < '8' ++ || (silo_bb.bootblock.siloid[6] == '8' ++ && silo_bb.bootblock.siloid[7] <= '6'))) + { -+ fprintf(stderr,"Error: SILO bootblock is too old. Must be at least 0.8.7.\n"); -+ perror(""); -+ exit(1); ++ fprintf(stderr,"Error: SILO bootblock is too old. Must be at least 0.8.7.\n"); ++ perror(""); ++ exit(1); + } + + /* -+ * search from root of iso fs to find boot catalog ++ * search from root of iso fs to find boot catalog + */ + de = search_tree_file(root, silo_boot_image); -+ if (!de) ++ if (!de) + { -+ fprintf(stderr,"Uh oh, I cant find the SILO boot image!\n"); -+ exit(1); ++ fprintf(stderr,"Uh oh, I cant find the SILO boot image!\n"); ++ exit(1); + } + + /* @@ -388,9 +444,9 @@ + */ + for (dwpnt = dw_head; dwpnt; dwpnt = dwpnt->next) + { -+ if (!dwpnt->name) continue; -+ if (!strcmp (dwpnt->name, de->whole_name)) -+ dwpnt->filter = silo_filter; ++ if (!dwpnt->name) continue; ++ if (!strcmp (dwpnt->name, de->whole_name)) ++ dwpnt->filter = silo_filter; + } + + set_732 (silo_bb.bootblock.extent, de->starting_block); @@ -405,8 +461,8 @@ + silo_bb.spare0[3] = 1; + silo_bb.spare0[13] = 8; + for (i = 0; i < 8; i++) { -+ silo_bb.infos[i].id = 0x83; -+ silo_bb.infos[i].flags = 0x18; ++ silo_bb.infos[i].id = 0x83; ++ silo_bb.infos[i].flags = 0x18; + } + set_732 (silo_bb.spare1 + 14, 0x600ddeee); + set_722 (silo_bb.rspeed, 0x15e); @@ -418,8 +474,8 @@ + set_732 (silo_bb.partitions[0].num_sectors, should_write); + set_722 (silo_bb.magic, 0xdabe); + for (i = 0; i < 510; i+=2) { -+ silo_bb.csum[0] ^= silo_bb.info[i]; -+ silo_bb.csum[1] ^= silo_bb.info[i+1]; ++ silo_bb.csum[0] ^= silo_bb.info[i]; ++ silo_bb.csum[1] ^= silo_bb.info[i+1]; + } + + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); @@ -427,7 +483,7 @@ + + for(i=1; i<16; i++) + { -+ xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); ++ xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); + } + + memset (&silo_info, 0, sizeof(silo_info)); @@ -437,13 +493,149 @@ + silo_info.conf_file[259] = '\0'; + + last_extent_written += 16; -+ ++ + return 0; +} + +struct output_fragment silo_desc = {NULL, silo_size, NULL, silo_write}; ---- cdrtools-1.10/mkisofs/vms.c -+++ cdrtools-1.10/mkisofs/vms.c +--- cdrtools-2.00.3/mkisofs/tree.c 2002-12-07 21:40:47.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/tree.c 2002-12-27 20:24:53.000000000 +0100 +@@ -84,6 +84,7 @@ + int scan_directory_tree __PR((struct directory *this_dir, + char *path, + struct directory_entry *de)); ++static int check_dirlevel __PR((char *name)); + #ifdef APPLE_HYB + int insert_file_entry __PR((struct directory *this_dir, + char *whole_path, +@@ -1322,6 +1323,34 @@ + return 1; + } + ++/* check_dirlevel: returns 1 if ++ * name is below the tree of follow_links_base */ ++static int ++check_dirlevel(name) ++ char *name; ++{ ++ char old[256] = {0,}, buf[256] = {0,}, b2[256], *c; ++ ++ strcpy (b2, name); ++ c = strrchr (b2, '/'); ++ if (c) { ++ *c = '\0'; ++ getcwd (old, 256); ++ chdir (b2); ++ getcwd (buf, 256); ++ chdir (old); ++ ++ if (!strncmp (buf, follow_links_base, ++ strlen (follow_links_base))) { ++ return 1; ++ } else { ++ return 0; ++ } ++ } ++ ++ return 1; ++} ++ + + /* + * Function: insert_file_entry +@@ -1366,6 +1395,8 @@ + int htype = TYPE_NONE; + + #endif /* APPLE_HYB */ ++ char link_buf[256]; ++ int do_follow_links = 0; + + status = stat_filter(whole_path, &statbuf); + +@@ -1401,7 +1432,35 @@ + * is in use, it is easy, we let RR describe the file. If + * not, then we punt the file. + */ +- if ((status || !follow_links)) { ++ /* First check for the sensible follow_links option */ ++ if (follow_links_sensible) { ++ /* Where does the link point to? */ ++ memset (link_buf, 0, 256); ++ readlink (whole_path, link_buf, 255); ++ if (check_dirlevel (link_buf)) { ++ /* Treat it as a symlink */ ++ if (!use_RockRidge) { ++ fprintf(stderr, "Ignoring symlink %s (which wouldn't be followed)\n", ++ whole_path); ++ } else { ++ do_follow_links = 0; ++ if (status) { ++ status = 0; ++ statbuf.st_size = 0; ++ STAT_INODE(statbuf) = UNCACHED_INODE; ++ statbuf.st_dev = (dev_t) UNCACHED_DEVICE; ++ statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG; ++ } ++ } ++ } else { ++ /* Follow the link */ ++ do_follow_links = 1; ++ } ++ } ++ else if (!follow_links_sensible) ++ do_follow_links = follow_links; ++ ++ if((status || !do_follow_links)) { + if (use_RockRidge) { + status = 0; + statbuf.st_size = (off_t)0; +@@ -1410,7 +1469,7 @@ + statbuf.st_mode = + (statbuf.st_mode & ~S_IFMT) | S_IFREG; + } else { +- if (follow_links) { ++ if (do_follow_links) { + #ifdef USE_LIBSCHILY + /* XXX errno may be wrong! */ + errmsg("Unable to stat file %s - ignoring and continuing.\n", +@@ -1443,7 +1502,7 @@ + * time we have seen this, then make this seem as if there was + * no symlink there in the first place + */ +- if (follow_links ++ if (do_follow_links + && S_ISDIR(statbuf.st_mode)) { + if (strcmp(short_name, ".") + && strcmp(short_name, "..")) { +@@ -1478,7 +1537,7 @@ + * For non-directories, we just copy the stat information over + * so we correctly include this file. + */ +- if (follow_links ++ if (do_follow_links + && !S_ISDIR(statbuf.st_mode)) { + lstatbuf = statbuf; + } +@@ -1487,7 +1546,7 @@ + * Add directories to the cache so that we don't waste space even if + * we are supposed to be following symlinks. + */ +- if (follow_links ++ if (do_follow_links + && strcmp(short_name, ".") + && strcmp(short_name, "..") + && S_ISDIR(statbuf.st_mode)) { +@@ -1537,7 +1596,7 @@ + * Add this so that we can detect directory loops with hard links. + * If we are set up to follow symlinks, then we skip this checking. + */ +- if (!follow_links ++ if (!do_follow_links + && S_ISDIR(lstatbuf.st_mode) + && strcmp(short_name, ".") + && strcmp(short_name, "..")) { +--- cdrtools-2.00.3/mkisofs/vms.c 2000-12-05 15:25:10.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/vms.c 2002-12-27 20:24:53.000000000 +0100 @@ -288,7 +288,7 @@ extern unsigned int last_extent_written; @@ -453,27 +645,26 @@ { int status, i; -@@ -296,10 +296,12 @@ +@@ -296,10 +296,11 @@ int count; int use; int remain; -+ int offset = 0; ++ int offset = 0; - open_file(filename); ++ open_file(dwpnt->name); - remain = size; -+ open_file(dwpnt->name); -+ + remain = dwpnt->size; while (remain > 0) { use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT * SECTOR_SIZE : remain); -@@ -308,11 +310,14 @@ +@@ -308,11 +309,14 @@ rab->rab$l_ubf = buffer; rab->rab$w_usz = sizeof(buffer); status = sys$read(rab); + if (dwpnt->filter) -+ (* dwpnt->filter)(buffer, use, offset); ++ (* dwpnt->filter)(buffer, use, offset); fwrite(buffer, 1, use, outfile); last_extent_written += use / SECTOR_SIZE; if ((last_extent_written % 1000) < use / SECTOR_SIZE) @@ -483,9 +674,9 @@ }; close_file(rab); ---- cdrtools-2.01/mkisofs/write.c.orig Fri Feb 28 01:32:13 2003 -+++ cdrtools-2.01/mkisofs/write.c Mon Mar 10 21:27:06 2003 -@@ -77,10 +77,10 @@ +--- cdrtools-2.00.3/mkisofs/write.c 2002-12-23 15:16:45.000000000 +0100 ++++ cdrtools-2.00.3/mkisofs/write.c 2002-12-27 20:24:53.000000000 +0100 +@@ -86,10 +86,10 @@ FILE *file)); static int assign_directory_addresses __PR((struct directory *node)); #ifdef APPLE_HYB @@ -498,16 +689,18 @@ FILE *outfile)); #endif static void write_files __PR((FILE *outfile)); -@@ -297,7 +297,7 @@ +@@ -303,8 +303,8 @@ static struct deferred_write mac_boot; #endif /* APPLE_HYB */ -static struct deferred_write *dw_head = NULL, +- *dw_tail = NULL; +struct deferred_write *dw_head = NULL, - *dw_tail = NULL; ++ *dw_tail = NULL; unsigned int last_extent_written = 0; -@@ -354,16 +354,14 @@ + static Uint path_table_index; +@@ -360,16 +360,14 @@ #ifdef APPLE_HYB static void @@ -515,7 +708,7 @@ - char *filename; - unsigned int size; +write_one_file(dwpnt, outfile, off) -+ struct deferred_write *dwpnt; ++ struct deferred_write *dwpnt; FILE *outfile; off_t off; #else @@ -524,19 +717,19 @@ - char *filename; - unsigned int size; +write_one_file(dwpnt, outfile) -+ struct deferred_write *dwpnt; ++ struct deferred_write *dwpnt; FILE *outfile; #endif /* APPLE_HYB */ { -@@ -379,18 +377,18 @@ +@@ -385,18 +383,18 @@ FILE *infile; int remain; int use; -+ int offset; ++ int offset; - - if ((infile = fopen(filename, "rb")) == NULL) { -+ if ((infile = fopen(dwpnt->name, "rb")) == NULL) { ++ if ((infile = fopen(dwpnt->name, "rb")) == NULL) { #ifdef USE_LIBSCHILY - comerr("cannot open '%s'\n", filename); + comerr("cannot open '%s'\n", dwpnt->name); @@ -552,18 +745,17 @@ #endif exit(1); #endif -@@ -398,8 +396,8 @@ +@@ -404,7 +402,8 @@ #ifdef APPLE_HYB fseek(infile, off, SEEK_SET); #endif /* APPLE_HYB */ - remain = size; -- + remain = dwpnt->size; -+ offset = 0; ++ offset = 0; + while (remain > 0) { use = (remain > SECTOR_SIZE * NSECT - 1 ? - NSECT * SECTOR_SIZE : remain); -@@ -408,13 +406,16 @@ +@@ -414,13 +413,16 @@ memset(buffer, 0, use); if (fread(buffer, 1, use, infile) == 0) { #ifdef USE_LIBSCHILY @@ -575,14 +767,14 @@ exit(1); #endif } -+ if (dwpnt->filter) -+ (* dwpnt->filter)(buffer, use, offset); ++ if (dwpnt->filter) ++ (* dwpnt->filter)(buffer, use, offset); xfwrite(buffer, 1, use, outfile); -+ offset += use; ++ offset += use; last_extent_written += use / SECTOR_SIZE; #if 0 if ((last_extent_written % 1000) < use / SECTOR_SIZE) { -@@ -474,13 +475,12 @@ +@@ -480,13 +482,13 @@ } else { #ifdef VMS @@ -591,15 +783,15 @@ #else #ifdef APPLE_HYB - write_one_file(dwpnt->name, dwpnt->size, outfile, -- dwpnt->off); -+ write_one_file(dwpnt, outfile,dwpnt->off); ++ write_one_file(dwpnt, outfile, + dwpnt->off); #else - write_one_file(dwpnt->name, dwpnt->size, outfile); + write_one_file(dwpnt, outfile); #endif /* APPLE_HYB */ #endif free(dwpnt->name); -@@ -1145,6 +1145,7 @@ +@@ -1151,6 +1153,7 @@ dwpnt->next = NULL; dwpnt->size = s_entry->size; dwpnt->extent = last_extent; @@ -607,7 +799,7 @@ set_733((char *) s_entry->isorec.extent, last_extent); s_entry->starting_block = last_extent; -@@ -1716,8 +1717,7 @@ +@@ -1722,8 +1725,7 @@ /* write out HFS boot block */ if (mac_boot.name)