musl build fails with --disable-pututline
Musl doesn't support utmp/wtmp, according to their FAQ, but I wanted to see if dropbear could write utmp/wtmp anyway.
First I patched musl include/paths.h to define a real path to utmp/wtmp:
-#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_UTMP "/var/run/utmp"
-#define _PATH_WTMP "/dev/null/wtmp"
+#define _PATH_WTMP "/var/log/wtmp"
Then I tried building Dropbear with --disable-pututline --disable-pututxline, because these functions in musl are stubs. I get this error:
src/loginrec.c: In function 'utmp_write_direct':
src/loginrec.c:691:15: warning: implicit declaration of function 'ttyslot' [-Wimplicit-function-declaration]
691 | tty = ttyslot(); /* seems only to work for /dev/ttyp? style names */
| ^~~~~~~
Is this a bug? Thanks.
ttyslot() is another legacy function so musl haven't implemented it. I guess "direct" isn't a from-scratch implementation. loginrec is all sorts of handling for legacy Unices, so I haven't touched it much (it comes from OpenSSH)
DESCRIPTION
The legacy function ttyslot() returns the index of the current user’s entry in some file.
Now "What file?" you ask. Well, let’s first look at some history.
Ancient history
There used to be a file /etc/ttys in UNIX V6, that was read by the init(1) program to find out what to do with
...
Ancient history (2)
On the other hand, there is the file /etc/utmp listing the people currently logged in. It is maintained by
So... musl doesn't have ttyslot(), uclibc and dietlibc don't have ttyslot either, dropbear doesn't add it with --disable-pututline, and on glibc there's no need for --disable-pututline, because pututline() works. Why would anyone use --disable-pututline, then?
Is there any plan on making utmp work on musl? Thanks.
Could be useful on other old Unixes, or BSDs perhaps?
I did some searching. I coudn't find any.
- OpenBSD and all other common BSDs support login and pututline
- macOS supports login and pututxline
- minix supports login and pututline
So... is there a plan to make utmp work on musl?