-
Notifications
You must be signed in to change notification settings - Fork 382
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
Unable to configure user name #5231
Comments
Thanks for reporting. Does the issue also occur with jj v0.24? |
Weird, I can't immediately reproduce it. What does Update: Yuya's comment below is probably more relevant. |
Oh, do you have invalid (or maybe empty) name in your /etc/passwd entry? The old behavior was to fall back to "Unknown" or something. If that's common, the change should be reverted. As a workaround, please add |
No, it seems to work fine with version v.024.
I can't see anything obviously invalid in
Thanks, this seems to work. |
Can you run these commands? I expect the pwd entry would be missing, but I have no idea why. (Is it some container environment?) $ id -u # check uid
1000
$ python3 -c 'import pwd; print(pwd.getpwuid(1000))' # get pwd entry for the uid (replace 1000 with the number printed above)
pwd.struct_passwd(pw_name=...) |
… obtained It's not super important that operation log has a valid user/host name. Let's allow invalid system configuration. In jj 0.24.0, invalid hostname was panic, and invalid username was mapped to "Unknown". Fixes jj-vcs#5231
It's my work machine, there is some integration with active directory set up, but it's not a container environment. The output looks like this:
|
I'm not pretty sure, but the released binary doesn't use the system libc?, and it doesn't handle nsswitch properly? |
I've tried a simple example: fn main() {
let username = whoami::fallible::username();
println!("I am {username:?}");
} Compiled for musl:
Compiled for system libc: cargo run --target x86_64-unknown-linux-gnu
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Running `target/x86_64-unknown-linux-gnu/debug/whomai_repro`
I am Ok("tiwalun") So it seems that |
The error message has a difference between |
To be precise, musl wouldn't fully support name service switch. Local /etc/passwd works, but sssd wouldn't? #5232 will partially revert the change. I'll send a separate PR to add a fallback to |
If jj is compiled against musl libc, not all name services are available, and getpwuid() can return null even if the system is configured properly. That's the problem reported as jj-vcs#5231. Suppose operation.username exists mainly for logging/tracing purposes, it should be better to include something less reliable than leaving the field empty. This patch also removes TODO comment about empty hostname/username. It's unlikely that the hostname is invalid (as that would cause panic on older jj versions), and $USER would probably be set on Unix.
If jj is compiled against musl libc, not all name services are available, and getpwuid() can return null even if the system is configured properly. That's the problem reported as jj-vcs#5231. Suppose operation.username exists mainly for logging/tracing purposes, it should be better to include something less reliable than leaving the field empty. This patch also removes TODO comment about empty hostname/username. It's unlikely that the hostname is invalid (as that would cause panic on older jj versions), and $USER would probably be set on Unix.
I guess this will be fixed by the PR, but just wanted to add that perhaps this came up for me as I'm using systemd-homed (no entry in the /etc/passwd entry). |
If jj is compiled against musl libc, not all name services are available, and getpwuid() can return null even if the system is configured properly. That's the problem reported as jj-vcs#5231. Suppose operation.username exists mainly for logging/tracing purposes, it should be better to include something less reliable than leaving the field empty. This patch also removes TODO comment about empty hostname/username. It's unlikely that the hostname is invalid (as that would cause panic on older jj versions), and $USER would probably be set on Unix.
If jj is compiled against musl libc, not all name services are available, and getpwuid() can return null even if the system is configured properly. That's the problem reported as #5231. Suppose operation.username exists mainly for logging/tracing purposes, it should be better to include something less reliable than leaving the field empty. This patch also removes TODO comment about empty hostname/username. It's unlikely that the hostname is invalid (as that would cause panic on older jj versions), and $USER would probably be set on Unix.
Description
I've just downloaded jujutsu on a new machine, but I'm unable to configure the username, or to interact with the config in any way. All operations involving config (
jj config
) seem to return an error about an invalid type or value.Steps to Reproduce the Problem
cargo binstall --strategies crate-meta-data jj-cli
jj config set --user user.name "Martin von Zweigbergk"
The steps were performed on a machine where jujutsu was not installed, so no existing config was present.
Expected Behavior
I can set the username
Actual Behavior
The following error message is shown:
I've tried setting the user name manually in ~/.config/jj/config.toml, but that doesn't seem to make a difference.
Specifications
The text was updated successfully, but these errors were encountered: