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

Replace chdir to /var/empty with secure creation of tempdir and later removal #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Replace chdir to /var/empty with secure creation of tempdir and later removal #58

wants to merge 3 commits into from

Conversation

zeridon
Copy link

@zeridon zeridon commented Feb 25, 2014

Replace chdir("/var/empty") with chdir(emptydir) where emptydir is securely created by tempfile module. After actions complete the dis is removed with shutil.rmtree.

This way the code becomes a bit more portable and not so dependant on specific dir existence (LXC being one of the cases, ubuntu the other, and my specific case the third)

PS: The diff is a bit confusing but in reality the chdir call (and some code after it which i believe is protected by it) is wrapped in

  try:
    ....
  finally:
    try:
    ....
    except:

@raymontag
Copy link
Owner

Looks like a good solution to get rid of the /var/empty-thing! I'll test it today or tomorrow.

@zeridon
Copy link
Author

zeridon commented Aug 12, 2015

Did you have any chance to test this.

@raymontag
Copy link
Owner

Oh sorry I've totally forgotten this. Will test it after work.

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.

2 participants