This bug is pretty annoying. Portable/in car/standalone MP3 CD players 
can't read the Rock Ridge data and rely on Joliet data only, so it
is very important to get the Joliet data right.

This is a long-standing bug, which has probably been in mkisofs for a
decade and has clearly been inherited by genisoimage. It has annoyed me
on numerous occasions; far too many album tracks have been skipped
as a result of exceeding the 64 byte limit. I have had enough.

I attach a patch to fix it. The patch detects filenames that exceed 
the 64 byte limit and truncates the body of the filename only, 
rather than the body plus the extension. Rock Ridge data is unaffected. 

-- 
Jack Whitham
j...@cs.york.ac.uk

--- cdrkit-1.1.11-deb/genisoimage/joliet.c      2008-05-25 21:21:29.000000000 
+0100
+++ cdrkit-1.1.11-work/genisoimage/joliet.c     2011-06-19 20:04:12.000000000 
+0100
@@ -951,10 +951,45 @@
                        } else
 #endif /* APPLE_HYB */
                        {
+                char * name = s_entry1->name;
+
+                /* Check for truncation of the name */
+                int name_8_len = strlen(name);
+                if (name_8_len > jlen) {
+                    int i, j, k;
+                    for (i = name_8_len - 1; (i > 0) 
+                            && (name[i] != '.'); i--) {}
+
+                    if ((i > 0) && (name[i] == '.')
+                    && (i != (name_8_len - 1))) {
+                        /* There is an extension and it should be relocated
+                         * to the end of the truncated form. Copy name. */
+                        name = alloca(name_8_len + 1);
+                        strcpy(name, s_entry1->name);
+
+                        j = jlen - (name_8_len - i);
+                        if (j >= 0) {
+                            /* Move name[i : name_8_len] to name[j : jlen] */
+                            while (i < name_8_len) {
+                                name[j] = name[i];
+                                i++; j++;
+                            }
+                            name[jlen] = '\0';
+                        }
+
+                        /* Check that the name size is still correct */
+                        if (joliet_strlen(name, in_nls) != cvt_len) {
+                            fprintf(stderr,
+                            "Fatal Joliet goof - relocating the extension "
+                            "changed the size of an entry.\n");
+                            exit(1);
+                        }
+                    }
+                }
                                convert_to_unicode(
                                        (Uchar *) directory_buffer+dir_index,
                                        cvt_len,
-                                       s_entry1->name, in_nls);
+                                       name, in_nls);
                        }
                        dir_index += cvt_len;
                }

Reply via email to