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

fix: per-user cache folders #22046

Merged

Conversation

aslushnikov
Copy link
Contributor

Fixes #21859

const cacheDir = process.env.PWTEST_CACHE_DIR || path.join(os.tmpdir(), 'playwright-transform-cache');

const DEFAULT_CACHE_DIR_WIN32 = path.join(os.tmpdir(), `playwright-transform-cache`);
const DEFAULT_CACHE_DIR_POSIX = path.join(os.tmpdir(), `playwright-transform-cache-` + os.userInfo().username);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure username is safe to use in file paths?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://unix.stackexchange.com/a/157431/323684 - seems to be safe on Debian. However, I added sanitization - just in case.

@aslushnikov aslushnikov merged commit bb6b442 into microsoft:main Mar 29, 2023
@aslushnikov aslushnikov deleted the separate-compilation-cache-by-username branch March 29, 2023 17:49
const cacheDir = process.env.PWTEST_CACHE_DIR || path.join(os.tmpdir(), 'playwright-transform-cache');

const DEFAULT_CACHE_DIR_WIN32 = path.join(os.tmpdir(), `playwright-transform-cache`);
const DEFAULT_CACHE_DIR_POSIX = path.join(os.tmpdir(), `playwright-transform-cache-` + sanitizeForFilePath(os.userInfo().username));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aslushnikov
I encountered some issue which caused by os.userInfo(). u may want to use the alternative what Cypress use.
cypress-io/cypress#17488

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an GitHub issue, thanks!

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.

[BUG] permission denied accessing '/tmp/playwright-transform-cache'
4 participants