mcdope/pam_usb

`LC_ALL=c` cannot set locale archwiki

Closed this issue · 1 comments

Which version of pam_usb are you running?

0.8.4

Which distribution are you using?

archlinux

Which login manager and desktop environment are you using?

no login manager/DWL

What happened?

updating to 0.8.4 using the pkgbuild in the repo gives the error
sh: warning: setlocale: LC_ALL: cannot change locale (c): No such file or directory
This happens because on archwiki the locale is called C, not c. Fixing this is pretty easy:

Patch local.c with

198c198
< 	char loginctl_cmd[BUFSIZ] = "LC_ALL=c; LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1  \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p TTY | awk -F= '{print $2}'";
---
> 	char loginctl_cmd[BUFSIZ] = "LC_ALL=C; LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1  \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p TTY | awk -F= '{print $2}'";
230c230
< 	char loginctl_cmd[BUFSIZ] = "LC_ALL=c; LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1  \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p Remote | awk -F= '{print $2}'";
---
> 	char loginctl_cmd[BUFSIZ] = "LC_ALL=C; LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1  \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p Remote | awk -F= '{print $2}'";

and patch tmux.c with

48c48
<     sprintf(get_tmux_session_details_cmd, "LC_ALL=c; tmux -S \"%s\" list-clients -t \"\\$%s\"", tmux_socket_path, tmux_client_id);
---
>     sprintf(get_tmux_session_details_cmd, "LC_ALL=C; tmux -S \"%s\" list-clients -t \"\\$%s\"", tmux_socket_path, tmux_client_id);
102c102
<         if ((fp = popen("LC_ALL=c; w", "r")) == NULL)
---
>         if ((fp = popen("LC_ALL=C; w", "r")) == NULL)
146c146
< }
\ No newline at end of file
---
> }

Output of "pamusb-check --debug whoami"

* Authentication request for user "dhruva" (pamusb-check)
[src/local.c:275] Checking whether the caller (pamusb-check) is local or not...
[src/local.c:286] 	Checking pid 504120 (pamusb-check)...
[src/local.c:286] 	Checking pid 441019 (/usr/bin/zsh)...
[src/local.c:286] 	Checking pid 441000 (kitty)...
[src/local.c:286] 	Checking pid 440666 (dwl)...
[src/local.c:286] 	Checking pid 440664 (dbus-run-session)...
[src/local.c:286] 	Checking pid 440644 (-zsh)...
[src/local.c:286] 	Checking pid 440630 (login -- dhruva)...
[src/local.c:286] 	Checking pid      1 (/sbin/init)...
[src/local.c:327] 	Using DISPLAY :0 for utmp search
[src/local.c:053] 	No utmp entry found for tty ":0"
[src/local.c:341] 	Trying to get tty from display server
[src/local.c:351] 		Failed, no result while trying to get TTY from display server
[src/local.c:356] 	Trying to get tty by DISPLAY
[src/local.c:364] 		Failed, no result while searching utmp for display :0 owned by user dhruva
[src/local.c:380] 	Trying to check for remote access by loginctl
[src/local.c:244] 		loginctl considers this session to be remote: no
[src/local.c:385] 	loginctl says this session is local
[src/local.c:424] No remote access detected, seems to be local request - allowing.
[src/device.c:038] Searching for "Key" in the hardware database...
* Authentication device "Key" is connected.
* Performing one time pad verification...
[src/volume.c:098] Searching for volume with uuid 99A6-3BBC.
[src/volume.c:123] Found mount points: (null)
[src/volume.c:138] Found volume 99A6-3BBC.
[src/volume.c:044] Attempting to mount device /dev/sdb1.
[src/volume.c:058] Mounted device /dev/sdb1 to /run/media/dhruva/99A6-3BBC.
[src/pad.c:326] Loading device pad...
[src/pad.c:336] Loading system pad...
[src/pad.c:352] Pad match.
[src/pad.c:187] Checking whether pads are expired or not...
[src/pad.c:215] Pads were generated 2014 seconds ago, not updating.
[src/volume.c:189] Attempting to unmount /dev/sdb1 from /run/media/dhruva/99A6-3BBC.
[src/volume.c:202] Unmount succeeded.
* Access granted.

Output of "w"

15:03:19 up 18:08,  2 users,  load average: 0.72, 0.86, 0.76
USER     TTY       LOGIN@   IDLE   JCPU   PCPU  WHAT
dhruva             Sun20   32:52   0.00s  1.97s /usr/lib/systemd/systemd --user
dhruva   tty1      14:32   31:17   1:19    ?    /usr/lib/dconf-service

Output of "loginctl"

SESSION  UID USER   SEAT  LEADER CLASS   TTY  IDLE SINCE
      2 1000 dhruva -     1561   manager -    no   -
      5 1000 dhruva seat0 440630 user    tty1 no   -

2 sessions listed.

Thanks, fix merged.