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
missing utmpx + who compile error on 0.8.8 #372
Comments
That command can't work because the function calls that would fill it out are stubs that return 0, but if the inability to build a command that doesn't work bothers you can I switch the stub struct to: struct utmpx { I just assumed people would switch the broken commands off on platforms that don't support posix? (Which has required everything but ut_host for over 20 years, and I confirmed freebsd and macos have ut_host.) |
P.S. The stub was there so "uptime" could work. It always reports 0 users, but should otherwise provide the rest of its information in the absence of utmpx.h. |
I've disable who for QNX for now since we don't support this header. Just thought I'd report a potential issue if the goal was to make things compile even if non functional. |
If there's an alternate API we can stick in portability.[ch] for qnx that's worth a look. Those two files exist to have if/else stanzas for various environments with special needs. But making a command build but not do anything useful just hides problems. |
QNX doesn't have this API or an alternative at all so there isn't anything we can add to portability. We're fine without using the who command. That's kind of why I liked the dependency before, it just disabled WHO even though it could have been enabled in the config. |
FYI if you'd like to submit a qnx config I can convert it to kconfig/qnx_miniconfig and add a make qnx_defconfig target. |
Thanks for the offer. QNX doesn't quite work exactly like other OSes in regards to some things so I usually have to adapt stuff anyway and maintaining the config is part of all of this. I don't want to burden the project even more by having you keep up with QNXisms since there's no way you can compile or test the changes with the multiple product releases we maintain in parallel. |
fwiw, the same is true for Android (which i work on, and where we definitely made OS changes to be "more POSIX" where it made sense, and had toybox portability workarounds where it didn't), but the toybox goal of "works out of the box at ToT on the current OS release [but if you want to run on older versions you might need a static binary]" is probably achievable? |
So the dependency on utmpx was removed but if one has the WHO command enabled, then you'll get these compile errors because the local defined structure is missing some fields.
toys/posix/who.c: In function 'who_main':
toys/posix/who.c:35:25: error: 'struct utmpx' has no member named 'ut_tv'; did you mean 'ut_type'?
time_t t = entry->ut_tv.tv_sec;
^~~~~
ut_type
toys/posix/who.c:39:40: error: 'struct utmpx' has no member named 'ut_user'
printf("%s\t%s\t%s (%s)\n", entry->ut_user, entry->ut_line,
^~
toys/posix/who.c:39:58: error: 'struct utmpx' has no member named 'ut_line'; did you mean 'ut_type'?
printf("%s\t%s\t%s (%s)\n", entry->ut_user, entry->ut_line,
^~~~~~~
ut_type
toys/posix/who.c:40:22: error: 'struct utmpx' has no member named 'ut_host'
toybuf, entry->ut_host);
^~
toys/posix/who.c: At top level:
The text was updated successfully, but these errors were encountered: