fastly / blockbuster

VCR cassette manager
MIT License
13 stars 3 forks source link

Allow using file names longer than 100 characters #19

Open lanej opened 5 years ago

lanej commented 5 years ago

POSIX tar does not allow file names longer 100 characters. GNU tar does allow for longer than 100 character filenames. ruby's zlib implementation matches the POSIX standard.

Many VCR cassette names use a combination of file name and test/example name which often greatly exceed 100 characters. This forces downstream developers to obfuscate filenames which make them harder to use. They also need to understand that blockbuster is using a specific method of compression which leaks implementation details downstream.

The easiest solution to this would be to write some sort of mapping for individual files from there hashsum to their real filename. This gets slightly more complicated when you consider deltas may re-write that mapping.

leklund commented 5 years ago

Yeah, it's not great and I've solved it in the past with VCR configuration like:

# 155 char limit on path, 100 char limit on name (https://github.com/rubygems/rubygems/blob/v3.0.3/lib/rubygems/package/tar_writer.rb#L311-L336)
cassette_name = "#{pathname[0..154]}/#{name[0..83]}-#{digest}"

The drawback of using a digest -> filename mapping in blockbuster is you lose the ability to manually untar the cassette file and inspect the individual cassettes. That might be better than the alternatives though.

Related: https://github.com/rubygems/rubygems/issues/1376

lanej commented 5 years ago

Ye ole POSIX vs GNU.

The reduction in traceability and discoverability is something I'd like to solve with this. Also, if there are lengthy cassettes then moving cassettes or copying cassettes to duplicate recordings can save significant time. Once you've manipulated the filename you need application knowledge to do it well. It goes from being a shell script to a ruby script with some copied configuration.

lanej commented 5 years ago

@leklund Alternatively, we could let the user choose the compression format. Zipfiles would allow for 2^16 filename lengths but you'd loose a few percentage points on archive size.