-
-
Notifications
You must be signed in to change notification settings - Fork 140
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(cache): use process.geteuid()
for virtual users
#355
Conversation
src/utils/transform/cache.ts
Outdated
*/ | ||
function cacheDirectoryName(): string { | ||
const { geteuid } = process; | ||
if (geteuid === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized this might not exist on Windows.
I'm currently refactoring the tests to be lighter so I can bring back Windows. Will hold this until then.
process.geteuid()
for virtual users
Windows doesn't seem to support |
What about
I don't know when that might happen, but you could default to a random |
What's wrong with using node-cachedir? |
https://github.com/LinusU/node-cachedir/blob/1d8619a927cfc6cafb4543ed3ce46bc6558be99f/index.js#L5 > sudo -u nobody node -e "console.log(path.join(os.homedir(), '.cache'))"
/.cache Unfortunately, that isn't going to help for your "virtual user" environments (or any user where a |
How about using Works on all platforms and collisions are very unlikely. Or is there an implicit need to reuse the folder for the same user? |
Yes, your proposal is equivalent to |
On Linux, each user needs its own cache directory so it has the correct permissions to write to it. I'm not sure if this is a problem on Windows, but I rather keep the behavior consistent and also because the organization makes sense. Do yall know if there's a way for me to test in the Linux virtual user environment? Hard to address it when I can't test the changes.
This defeats the point of the cache. (Module caching already happens inside Node). The cache is shared across multiple runs per user so it needs to be deterministic. |
I think on windows you always have a distinct username. So Posix -> uid, Windows/Other -> username.replace(/\W+/g, '_') |
You could use a docker container for that. |
The bug reported returned an You could reproduce that in a number of ways, but if you're not careful, you might break your test system. |
@privatenumber Did you close this PR by accident? |
Oops, looks like it closed as a side-effect of auto-deletion happening on a merged PR. The reopen button is disabled for me—I think because it's your PR. Would you mind re-opening it? |
I cannot because you closed it. |
Fixes #352