[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#64937: "who" reports funny dates
From: |
Bruno Haible |
Subject: |
Re: bug#64937: "who" reports funny dates |
Date: |
Tue, 08 Aug 2023 19:02:49 +0200 |
I wrote:
> > (1) The API of the readutmp module should provide unlimited-length
> > ut_user,
> > ut_host etc. fields always. No more #ifdef UT_USER_SIZE.
> > (2) The readutmp module should use a runtime 'if' rather than a
> > compile-time
> > #if, in order to dispatch between the systemd backend and the
> > file-based
> > backend.
> >
> > I'll work on (1) today.
(1) done through the following patch.
It does not break coreutils. But coreutils can now be simplified through the
attached 0001-maint-Simplify-after-gnulib-changed.patch .
2023-08-08 Bruno Haible <bruno@clisp.org>
readutmp: Return entries with unbounded strings on all platforms.
Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00165.html>.
* m4/readutmp.m4 (gl_READUTMP): Test also whether struct utmp has an
ut_tv member, and whether struct utmp and struct utmpx have an
ut_session member.
* lib/readutmp.h (struct gl_utmp): Define always. Add ut_exit field.
(HAVE_GL_UTMP): Remove macro.
(UT_USER, UT_TIME_MEMBER, UT_PID, UT_TYPE_EQ, UT_TYPE_NOT_DEFINED,
UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT, STRUCT_UTMP): Define w.r.t.
struct gl_utmp.
(UT_USER_SIZE, UT_ID_SIZE, UT_LINE_SIZE, UT_HOST_SIZE): Define to -1
always.
(getutent): Remove declaration.
(HAVE_STRUCT_XTMP_UT_EXIT): Remove unused macro.
(HAVE_STRUCT_XTMP_UT_ID, HAVE_STRUCT_XTMP_UT_PID,
HAVE_STRUCT_XTMP_UT_HOST): Change to match the way coreutils uses these
macros.
* lib/readutmp.c (UT_USER, UT_TIME_MEMBER, UT_PID, UT_TYPE_EQ,
UT_TYPE_NOT_DEFINED, IS_USER_PROCESS, UT_EXIT_E_TERMINATION,
UT_EXIT_E_EXIT, UT_USER_SIZE, UT_ID_SIZE, UT_LINE_SIZE, UT_HOST_SIZE):
Define w.r.t. struct utmpx or struct utmp.
(extract_trimmed_name): Don't use UT_USER or UT_USER_SIZE here.
(desirable_utmp_entry): Don't use UT_TIME_MEMBER or UT_USER here.
(struct utmp_alloc): Define always.
(add_utmp): Likewise. Add user_len, id_len, line_len, host_len,
termination, exit arguments. Don't require that user, id, line, host are
NUL-terminated. Assume user and host are non-NULL.
(finish_utmp): New function, extracted from read_utmp.
(read_utmp) [READUTMP_USE_SYSTEMD]: Update add_utmp invocations. Pass a
non-NULL user and a non-NULL host. Call finish_utmp.
(getutent): Move declaration from readutmp.h to here.
(copy_utmp_entry): Remove function.
(read_utmp) [UTMP_NAME_FUNCTION]: Replace variables n_read, n_alloc,
utmp with a 'struct utmp_alloc'. Use 'struct utmpx32' from
copy_utmp_entry here. Invoke add_utmp and finish_utmp.
(read_utmp) [!UTMP_NAME_FUNCTION]: Replace variables n_read, n_alloc,
utmp with a 'struct utmp_alloc'. Invoke add_utmp and finish_utmp.
* NEWS: Mention the API change.
0001-readutmp-Return-entries-with-unbounded-strings-on-al.patch
Description: Text Data
0001-maint-Simplify-after-gnulib-changed.patch
Description: Text Data
- Re: bug#64937: "who" reports funny dates, (continued)
- Re: bug#64937: "who" reports funny dates, Bruno Haible, 2023/08/08
- Message not available
- Re: bug#64937: "who" reports funny dates, Thorsten Kukuk, 2023/08/04
- Re: bug#64937: "who" reports funny dates, Paul Eggert, 2023/08/06
- Re: bug#64937: "who" reports funny dates, Paul Eggert, 2023/08/06
- Message not available
- Re: bug#64937: "who" reports funny dates, Thorsten Kukuk, 2023/08/06
- Re: bug#64937: "who" reports funny dates, Paul Eggert, 2023/08/06
- Message not available
- Re: bug#64937: "who" reports funny dates, Thorsten Kukuk, 2023/08/06
- Re: bug#64937: "who" reports funny dates, Paul Eggert, 2023/08/06
- Re: bug#64937: "who" reports funny dates, Bruno Haible, 2023/08/07
- Re: bug#64937: "who" reports funny dates, Paul Eggert, 2023/08/07
- Re: bug#64937: "who" reports funny dates,
Bruno Haible <=
- Re: bug#64937: "who" reports funny dates, Paul Eggert, 2023/08/08
- Re: bug#64937: "who" reports funny dates, Bruno Haible, 2023/08/08
- Message not available
- Re: bug#64937: "who" reports funny dates, Thorsten Kukuk, 2023/08/08
- Re: bug#64937: "who" reports funny dates, Bruno Haible, 2023/08/08
- Message not available
- Re: bug#64937: "who" reports funny dates, Thorsten Kukuk, 2023/08/08
- Re: bug#64937: "who" reports funny dates, Robert Pluim, 2023/08/08
- Re: bug#64937: "who" reports funny dates, Bruno Haible, 2023/08/08
- Re: bug#64937: "who" reports funny dates, Robert Pluim, 2023/08/08
- Message not available
- Re: bug#64937: "who" reports funny dates, Thorsten Kukuk, 2023/08/08
- Re: bug#64937: "who" reports funny dates, Bruno Haible, 2023/08/08