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

Execution will fail on Windows if TMPDIR, TEMP or TMP refer to an invalid directory #9394

Open
joshcooper opened this issue Jun 13, 2024 · 1 comment
Labels
bug Something isn't working triaged Jira issue has been created for this

Comments

@joshcooper
Copy link
Contributor

Describe the Bug

This is a follow up to the issue described in #9385

Puppet::FileSystem::Uniquefile creates files relative to the current temp directory. It searches these environment variables (in order) TMPDIR, TMP or TEMP. If any of those are set and refer to a non-existent directory, then Uniquefile.new will raise, never falling back to later variables. On Windows, we redirect the child process' stdout to a Uniquefile.new However, this bug means execution can fail due to an errant temp related environment variable.

Expected Behavior

Puppet::FileSystem::Uniquefile should not raise in this situation. Also the code should be updated to take advantage of other improvements made to Tempfile, since Uniquefile was created.

Steps to Reproduce

After #9385 is fixed:

C:\Users\Administrator\puppet>set TMPDIR=c:\doesntexist
C:\Users\Administrator\puppet>bundle exec puppet resource exec c:/windows/system32/whoami.exe logoutput=true
Error: No such file or directory @ rb_file_s_stat - c:\doesntexist
Error: /Exec[c:/windows/system32/whoami.exe]/returns: change from 'notrun' to ['0'] failed: No such file or directory @ rb_file_s_stat - c:\doesntexist

Environment

  • Version 7.31.0, 8.6.0
  • Platform Windows

The bug has existed for a long time.

@joshcooper joshcooper added the bug Something isn't working label Jun 13, 2024
@tvpartytonight tvpartytonight added the triaged Jira issue has been created for this label Jun 18, 2024
Copy link

Migrated issue to PUP-12053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Jira issue has been created for this
Projects
None yet
Development

No branches or pull requests

2 participants