Skip to content

Conversation

@bestander
Copy link
Member

Summary

fixes #2866

Test plan

I don't know 100% what I am doing here, it should fix he NPE but not sure if a switch to tar-fs broke something related to #1837

@Daniel15, @lawliet89 is this fix enough?

@lawliet89
Copy link
Contributor

lawliet89 commented Mar 10, 2017

I can't verify this until Monday.

What I did in #1837 was work around node-tar which tries to chown everything it untars to the original UID and GID that was stored in the tarball when the user is root. This fails if your root user is behind a user namespace and the GID and UID is outside of its permissible range.

So this setting of UID and GID to zero might not be necessary if tar-fs doesn't try to do that, or there is a way to get it not to do that.

Sorry I'm not familiar with the shape of the objects in tar-fs.

@bestander
Copy link
Member Author

Ok, I removed the root condition then, I pass dmode and fmode to tar-fs extraction, hopefully it means that access should be reset fine.
@lawliet89, would be great if you could verify this on Monday.

We probably should merge this PR because currently extraction fails for root users completely.

@lawliet89
Copy link
Contributor

lawliet89 commented Mar 13, 2017

I just checked and both of your commits cause #1750 and friends to resurface, that is if your root user is inside a user namespace.

verbose 8.944 Error: https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz: EINVAL: invalid

argument, chown '/usr/local/share/.cache/yarn/v1/npm-immutable-3.8.1-200807f11ab0f72710ea485542de088075f68cd2/contrib/cursor'
at Error (native)

error An unexpected error occurred: "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz: EINVAL: invalid argument, chown '/usr/local/share/.cache/yarn/v1/npm-immutable-3.8.1-200807f11ab0f72710ea485542de088075f68cd2/contrib/cursor'".

This fix works fine if you are not behind a user namespace, and I think it's correct because the entries themselves no longer have the uid or gid properties. They are now in the header.

The API for tar-fs allows us to map the header during extract. The header contains the UID and GID. I'll raise another PR to fix this.

EDIT: Please see #2898. There is actually no need to set the UID or GID -- just turn off chown.

@bestander
Copy link
Member Author

Fixed by #2898

@bestander bestander closed this Mar 13, 2017
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.

yarn-e2e/label=docker,os=ubuntu-14.04 #123 failed

2 participants