New: updwtmp(3) doesn't mention need for _GNU_SOURCE for updwtmpx
https://bugzilla.kernel.org/show_bug.cgi?id=216168
Bug ID: 216168
Summary: updwtmp(3) doesn't mention need for _GNU_SOURCE for
updwtmpx
Product: Documentation
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: man-pages
Assignee: [email protected]
Reporter: [email protected]
Regression: No
I think utmpxh's updwtmpx might need _GNU_SOURCE to be defined to be usable?
Noticed when investigating a warning when building gdm 42.0:
``` ../gdm-42.0/daemon/gdm-session-record.c:200:9: error: implicit declaration of function ‘updwtmpx’; did you mean ‘updwtmp’? [-Werror=implicit-function-declaration] updwtmpx (GDM_NEW_SESSION_RECORDS_FILE, &session_record); ```
... but:
``` #if defined(HAVE_UTMPX_H) #include <utmpx.h> #endif #if defined(HAVE_UTMP_H) #include <utmp.h> #endif ```
And config.h, set by Meson, contains HAVE_UTMPX_H, HAVE_UTMP_H, HAVE_UPDWTMP, HAVE_UPDWTMPX.
From looking at glibc-2.35's /usr/include/utmpx.h, I think it might need _GNU_SOURCE? It's guarded by __USE_GNU within glibc headers:
```
[..]
#ifdef __USE_GNU
/* Change name of the utmpx file to be examined.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int utmpxname (const char *__file);
[...]
/* Append entry UTMP to the wtmpx-like file WTMPX_FILE.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void updwtmpx (const char *__wtmpx_file,
const struct utmpx *__utmpx);
[...]
```Aside: a friend points out that NetBSD needs NETBSD_SOURCE defined for it too:
https://github.com/NetBSD/src/blob/6c9d506c6146a69f3807ce59b4c063792ef32829/include/utmpx.h#L143.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 216168] updwtmp(3) doesn't mention need for _GNU_SOURCE for updwtmpx
https://bugzilla.kernel.org/show_bug.cgi?id=216168
--- Comment #1 from Sam James ([email protected]) ---
FWIW, Gnulib indeed (as the man page hints) that it is a glibc extension:
https://www.gnu.org/software/gnulib/manual/gnulib.html#updwtmpx.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 216168] updwtmp(3) doesn't mention need for _GNU_SOURCE for updwtmpx
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=216168
--- Comment #2 from Sam James ([email protected]) ---
Sent patch to ML: https://marc.info/?l=linux-man&m=165603977710424&w=2.
Suppose the commit message should be more detailed but I'll wait for someone to tell me if this is even right first :)
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 216168] updwtmp(3) doesn't mention need for _GNU_SOURCE for updwtmpx
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=216168
Alejandro Colomar (man-pages) ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |[email protected]
Resolution|--- |DOCUMENTED--- Comment #3 from Alejandro Colomar (man-pages) ([email protected]) --- Hi Sam,
Sorry for the delay; I read your posts, but didn't have much time to reply. Yes, normally I'd ask for a more detailed commit message, but since it is very obvious to me that it's correct from this bugzilla report (and also from the glibc code), and there's a link to this issue in the commit, I think it's OK as is the patch.
Thanks!
Alex
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.