I was not particularly happy with mkisofs's Joliet's handling of
filenames longer than 64 characters.  Unlike the ISO9660 filesystem
code, the Joliet code just truncates the filename to 64 characters with
no regard for filename extension.  This makes my MP3 collection much
more difficult to burn to CD. :-P I've attached a patch to kluge the
problem.

This extension munging probably belongs in the Joliet's filename
collision resolution code, but I couldn't find any such device...

-- 
Daniel J. Peng
                                        /"\
                                        \ / ASCII Ribbon Campaign
Who is John Galt?                        X  Against Outlook & HTML Mail
                                        / \ http://www.thebackrow.net/

Remove me from this land of slaves,
Where all are fools, and all are knaves,
Where every knave and fool is bought, 
Yet kindly sells himself for nought;
                -- Jonathan Swift
diff -r -u cdrecord-1.9/mkisofs/joliet.c cdrecord-1.9-dan/mkisofs/joliet.c
--- cdrecord-1.9/mkisofs/joliet.c       Thu Feb 15 23:54:00 2001
+++ cdrecord-1.9-dan/mkisofs/joliet.c   Fri Feb 16 00:01:19 2001
@@ -111,7 +111,7 @@
 
 static void    convert_to_unicode      __PR((unsigned char *buffer,
                                                int size, char *source));
-static int     joliet_strlen           __PR((const char *string));
+static int     joliet_strlen           __PR((char *string));
 static void    get_joliet_vol_desc     __PR((struct iso_primary_descriptor 
*jvol_desc));
 static void    assign_joliet_directory_addresses __PR((struct directory *node));
 static void    build_jpathlist         __PR((struct directory *node));
@@ -237,9 +237,12 @@
  */
 static int
 joliet_strlen(string)
-       const char      *string;
+       char    *string;
 {
        int             rtn;
+       char            *dot;
+       int             extension_length;
+       char            extension[128];
 
        rtn = strlen(string) << 1;
 
@@ -250,6 +253,16 @@
         * the maximum length is 128 bytes, or 64 unicode characters.
         */
        if (rtn > 0x80) {
+               fprintf(stderr,"Joliet: Munging %s",string);
+               dot = strrchr(string, '.');
+               if (dot != NULL) {
+                       strncpy(extension,dot,128);
+                       extension[127] = '\0';
+                       extension_length = strlen(extension);
+                       strncpy(string + 64 - 
+extension_length,extension,extension_length + 1);
+               }
+               string[64] = '\0';
+               fprintf(stderr," to %s\n", string);
                rtn = 0x80;
        }
        return rtn;

Reply via email to