-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chown: allow setting arbitrary numeric user ID #3438
Conversation
Haven't looked into it recently but as far as I remember yes. |
b01fe3f
to
86f1890
Compare
86f1890
to
b112f4c
Compare
I've updated this pull request to use the |
b112f4c
to
da49328
Compare
Hmm something's still not quite right:
|
Executive summary: I believe my change revealed an issue in the Details: Let's take a look at one of the failures, According to the logged messages, the test method first calls I think that before the change I'm proposing in this pull request, coreutils/tests/by-util/test_chown.rs Lines 404 to 409 in e5d9737
The panic is happening now because the command-line argument coreutils/src/uucore/src/lib/features/perms.rs Lines 150 to 155 in e5d9737
The assumption that a user ID always corresponds to a named user is incorrect. Here's an example of how $ touch f && sudo chown 12345 f && sudo chown --verbose 12345 f
ownership of 'f' retained as 12345 However, the username still appears in the verbose message even if it is given as a user ID in the argument: $ touch f && chown --verbose $(id -u) f
ownership of 'f' retained as jeffrey |
da49328
to
e7d1005
Compare
I added a commit that updates the |
It looks like my changes to
I'll diagnose them later this week. |
I'm trying to use
I think this is saying that it tried to run |
Could be Sorry I see three options to improve it:
Edit |
338233c
to
e9f7328
Compare
Update the `wrap_chown()` function to support user IDs and group IDs that do not correspond to named users or groups, respectively. Before this commit, the result from `uid2usr()` and `gid2grp()` calls were unwrapped because we assumed a user name or group name, respectively, existed. However, this is not always true: for example, running the command `sudo chown 12345 f` works even if there is no named user with ID 12345. This commit expands `wrap_chown()` to work even if no name exists for the user or group.
Update `chown` to allow setting the owner of a file to a numeric user ID regardless of whether a corresponding username exists on the system. For example, $ touch f && sudo chown 12345 f succeeds even though there is no named user with ID 12345. Fixes uutils#3380.
…environment" This reverts commit 291fb3a.
e9f7328
to
5713de4
Compare
Help needed: the test fails because it requires root privileges to change the owner of a file. I couldn't quite follow how the other tests in this file are accomplishing this. The test passes if you run it as root. Any recommendations for what to do about this? Just skip the test if the user is not root?This pull request updates
chown
to allow setting the owner of a file to a numeric user ID regardless of whether a corresponding username exists on the system.For example,
$ touch f && sudo chown 12345 f
succeeds even though there is no named user with ID 12345.
Fixes #3380.