Skip to content
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

musl build fails with --disable-pututline #299

Open
M95D opened this issue May 2, 2024 · 4 comments
Open

musl build fails with --disable-pututline #299

M95D opened this issue May 2, 2024 · 4 comments

Comments

@M95D
Copy link
Contributor

M95D commented May 2, 2024

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.

@mkj
Copy link
Owner

mkj commented May 2, 2024

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

@M95D
Copy link
Contributor Author

M95D commented May 2, 2024

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.

@mkj
Copy link
Owner

mkj commented May 2, 2024

Could be useful on other old Unixes, or BSDs perhaps?

@M95D M95D closed this as completed May 2, 2024
@M95D
Copy link
Contributor Author

M95D commented May 9, 2024

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?

@M95D M95D reopened this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants