Closed wpcarro closed 4 years ago
Hi, thanks for the report!
I noticed that lorri info
gives you "lorri version: 1". We've now released version 1.0 to the nixos-unstable
and nixos-19.09
release channels. I don't know how you installed lorri, but if it isn't too much hassle, perhaps you could upgrade lorri and try again?
With version 1.0, I get my correct user name from whoami
from within a lorri direnv directory, a lorri shell
(and also nix-shell
, just to be sure).
Possibly related is https://github.com/target/lorri/blob/b2f1fe218ab95ce7c89c4b35644d01c4c1f1b21d/src/ops/direnv/envrc.bash#L129
@curiousleo - thank you for responding.
I'm using a computer with lorri version: 1.0
, and whoami
still returns an error.
lorri version: 1.0
gc roots exist, shell_gc_root: "/home/wpcarro/.cache/lorri/gc_roots/2a79f5b753b5de1aecbeba294ec5c3e7/gc_
root/shell_gc_root"```
Inside of a directory that lorri manages:
> which whoami
/nix/store/d7hlkykjjqs3f200jnmjm1y2hzgvbqa8-coreutils-8.31/bin/whoami
> whoami
whoami: cannot find name for user ID 646587
Outside of this directory:
> which whoami
/usr/bin/whoami
> whoami
wpcarro
Can you think of any workarounds? This is breaking some functions in my editor that depend on whoami
working.
When I strace whoami
:
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0
sendto(3, "\2\0\0\0\v\0\0\0\7\0\0\0passwd\0", 19, MSG_NOSIGNAL, NULL, 0) = 19
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=3, revents=POLLIN|POLLHUP}])
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="passwd\0", iov_len=7}, {iov_base="\310O\3\0\0\0\0\0", iov_len=8}], msg_iovlen=2, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[4]}], msg_controllen=20, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 15
mmap(NULL, 217032, PROT_READ, MAP_SHARED, 4, 0) = 0x7fa22358c000
close(4) = 0
close(3) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x9), ...}) = 0
write(1, "philip\n", 7philip
So it’s querying the socket of ncsd (instead of opening passwd directly). Does it do the same on your Debian system?
Ping
@Profpatsch - Sorry for the delay. Looks like whoami
attempts to read from nscd
, but fails.
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=396, ...}) = 0
read(3, "# $Id: //depot/google3/googledat"..., 4096) = 396
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=396, ...}) = 0 read(3, "# $Id: //depot/google3/googledat"..., 4096) = 396
Now it really depends on how nsswitch (man nsswitch.conf
) is configured in the Google distribution. cc @tazjin maybe‽ idk.
This is likely not an issue with lorri. I'll talk to @wpcarro on work chat.
Cool, closing.
Also wtf, why is the Google distro uname -a
lying that it’s Debian?
Describe the bug
When I'm in a directory in which lorri has been initialized and I run the command
whoami
, it printswhoami: cannot find name for user ID
and exits with a1
status code.To Reproduce Steps to reproduce the behavior:
cd path/to/lorri/dir
whoami
prints error messagecd path/to/non-lorri/dir
whoami
returnswpcarro
Expected behavior
I expect
whoami
to exit with a non-zero code.Metadata
Additional context
I'm not sure if this is the intended behavior of
lorri
. If it is, I apologize for the noise. Thank you for making this project; I'm certainly enjoying it.