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

Postinstall.js leaves tmp directory around #8

Open
perrinjerome opened this issue Dec 12, 2019 · 2 comments
Open

Postinstall.js leaves tmp directory around #8

perrinjerome opened this issue Dec 12, 2019 · 2 comments

Comments

@perrinjerome
Copy link

I know it's minor, but that temporary directory created here is not removed

if (!await fsExists(tmpDir)) {
await fsMkdir(tmpDir);
}

@perrinjerome
Copy link
Author

A bit more context on how it was a problem for us, when running on linux by several unix users. Once a first user installs, this creates this file that only this user can modify:

$ ls -asl /tmp/vscode-ripgrep-cache-1.5.7/ripgrep-v11.0.1-2-x86_64-unknown-linux-musl.tar.gz
1908 -rw-r--r-- 1 slapuser8 slapuser8 1953516 Sep 24 01:09 /tmp/vscode-ripgrep-cache-1.5.7/ripgrep-v11.0.1-2-x86_64-unknown-linux-musl.tar.gz

After this, if another unix user tries to install, this fail with:

Finding release for v11.0.1-2
GET https://api.github.com/repos/microsoft/ripgrep-prebuilt/releases/tags/v11.0.1-2
Downloading from https://api.github.com/repos/microsoft/ripgrep-prebuilt/releases/assets/13800816
Downloading to /tmp/vscode-ripgrep-cache-1.5.7/ripgrep-v11.0.1-2-x86_64-unknown-linux-musl.tar.gz
Download options: {"headers":{"user-agent":"vscode-ripgrep","accept":"application/octet-stream"}}
events.js:167
    throw er; // Unhandled 'error' event
    ^

Error: EACCES: permission denied, open '/tmp/vscode-ripgrep-cache-1.5.7/ripgrep-v11.0.1-2-x86_64-unknown-linux-musl.tar.gz'
Emitted 'error' event at:
    at fs.open (internal/fs/streams.js:250:12)
    at FSReqWrap.oncomplete (fs.js:145:20)

We workaround by setting TMPDIR environment variable to different directories per users, but if this postinstall script could delete this file and folder it would be better I feel.

@ghost
Copy link

ghost commented Jun 10, 2023

Tired

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

No branches or pull requests

1 participant