kdomanski / iso9660

A go library for reading and creating ISO9660 images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow setting dCharacters / cloud-init support

rck opened this issue · comments

Hi kdomanski,

thanks for writing this useful library. I tried to use it in combination with cloud-init, but there files are named user-data, and meta-data. '-' is not in the valid set for dCharacters, which is perfectly fine, because it simply is not a valid char according to the iso9660 spec. On the other hand it is also known that many platforms are pretty relaxed when it comes to actual implementations. Adding '-' to the dCharacters worked fine on Linux.

Would you accept a patch that adds a SetdCharacters() to ImageWriter?

Hi @rck ,
I took a closer look at the ECMA-119 spec.

So turns out that actually names can be either d-chars (which are a bit strict) or d1-chars which are defined as "subject to agreement between the originator and the recipient of the volume". Another look at how Linux kernel handles the filenames in its isofs module shows that there's probably no reason to be strict at all. In the end the image creator will be responsible if the image is unreadable by the other end, right?

With that in mind, I added commit 4e37820 which extends the permitted charset. In addition 00eb28a I forced lowercase (instead of uppercase) names, since that's how Linux likes them too.

Does that enable your usecase?

Hi @kdomanski,

yes, with the extended d1 charset it now works perfectly fine for my use case. I'm very sure the first commit alone was already good enough for me. AFAIK showing the file names lower case is just a Linux thing (other OSes might do the same, did not check), so probably I would not have made any uppercase/lowercase transformations as long as it is in d1, but what do I know :D

Thanks, rck