Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to create temp files in the zip file directory #432

Closed
wants to merge 1 commit into from
Closed

Add an option to create temp files in the zip file directory #432

wants to merge 1 commit into from

Conversation

samsonjs
Copy link

@samsonjs samsonjs commented Feb 6, 2020

Before zip files were created in the system temporary directory they
were created in the same directory as the zip file. This adds an option
to have the same behaviour as before by passing in
use_system_temp_dir: false as an option to Zip.open, which passes
that down to Zip::StreamableStream.

See #411 for discussion leading up to this PR.

I didn't see an obvious way to test that Zip::File passes the option down to Zip::StreamableStream but am happy to add such a test with a bit of direction from the core maintainers.

Before zip files were created in the system temporary directory they
were created in the same directory as the zip file. This adds an option
to have the same behaviour as before by passing in
`use_system_temp_dir: false` as an option to `Zip.open`, which passes
that down to `Zip::StreamableStream`.
@hainesr
Copy link
Member

hainesr commented Feb 6, 2020

Just as a sanity check: are we sure that this option should be in File and not at the top level?

@jdleesmiller
Copy link
Member

Thanks for the PR, and sorry to hear that this change caused a problem.

I think there are a few other options here:

  • You can put /tmp on another partition. I think that is a fairly common approach when large a large scratch space is required.

  • Ruby's Dir::tmpdir respects the TMPDIR environment variable, so you could point ruby's tmpdir at a location on your larger volume:

    # on mac with ruby 2.6.3
    $ ruby -r tempfile -e 'puts Tempfile.new.path'
    /var/folders/xq/6tgxlyhx2yz8qk1mq575qg1m0000gn/T/20200208-46464-1vib46p
    $ TMPDIR=. ruby -r tempfile -e 'puts Tempfile.new.path'
    /Users/john/20200208-46480-oal377
    

Would one of those help?

@samsonjs
Copy link
Author

Thanks a lot for the suggestions @jdleesmiller. We just deployed the TMPDIR solution to our staging environment and it's working great, so I'll close this PR. Really appreciate you taking the time to help us out.

@samsonjs samsonjs closed this Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants