summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-adelie@skarnet.org>2023-08-30 15:12:59 +0000
committerZach van Rijn <me@zv.io>2023-09-15 10:28:33 +0000
commit2a7cad63e8b8677d3da9042d151ad38326348c06 (patch)
treeb0aa21b0f6bf9eeb819ca43f57ac96efb3d29ca5
parent4d290403fcae001bca45154271f4b344e503e57e (diff)
downloadpackages-2a7cad63e8b8677d3da9042d151ad38326348c06.tar.gz
packages-2a7cad63e8b8677d3da9042d151ad38326348c06.tar.bz2
packages-2a7cad63e8b8677d3da9042d151ad38326348c06.tar.xz
packages-2a7cad63e8b8677d3da9042d151ad38326348c06.zip
system/util-linux: fix default paths for utmps
utmp is a mess everywhere, properly cleaning it up would be a herculean task. Instead, here, we just change the hardcoded assumptions into other hardcoded assumptions that work for us.
-rw-r--r--system/util-linux/0000-utmps-paths.patch59
-rw-r--r--system/util-linux/APKBUILD6
2 files changed, 63 insertions, 2 deletions
diff --git a/system/util-linux/0000-utmps-paths.patch b/system/util-linux/0000-utmps-paths.patch
new file mode 100644
index 000000000..861e38ff3
--- /dev/null
+++ b/system/util-linux/0000-utmps-paths.patch
@@ -0,0 +1,59 @@
+diff -rNU3 util-linux-2.38.1.old/include/pathnames.h util-linux-2.38.1/include/pathnames.h
+--- util-linux-2.38.1.old/include/pathnames.h 2022-08-04 08:21:36.041638477 +0000
++++ util-linux-2.38.1/include/pathnames.h 2023-08-30 15:08:07.990025756 +0000
+@@ -67,9 +67,10 @@
+ # define _PATH_TMP "/tmp/"
+ #endif
+
+-#ifndef _PATH_BTMP
+-# define _PATH_BTMP "/var/log/btmp"
+-#endif
++#undef _PATH_WTMP
++#define _PATH_WTMP "/var/log/wtmpd/wtmp"
++#undef _PATH_BTMP
++#define _PATH_BTMP "/var/log/wtmpd/btmp"
+
+ #define _PATH_ISSUE_FILENAME "issue"
+ #define _PATH_ISSUE_DIRNAME _PATH_ISSUE_FILENAME ".d"
+diff -rNU3 util-linux-2.38.1.old/login-utils/login.c util-linux-2.38.1/login-utils/login.c
+--- util-linux-2.38.1.old/login-utils/login.c 2022-05-11 08:13:10.903531622 +0000
++++ util-linux-2.38.1/login-utils/login.c 2023-08-30 14:57:20.930021550 +0000
+@@ -71,6 +71,9 @@
+ # include <libaudit.h>
+ #endif
+
++#include <utmps/config.h>
++#include <utmps/utmps.h>
++
+ #include "c.h"
+ #include "pathnames.h"
+ #include "strutils.h"
+@@ -623,7 +626,8 @@
+ sizeof(ut.ut_addr_v6));
+ }
+
+- updwtmpx(_PATH_BTMP, &ut);
++ // updwtmpx(_PATH_BTMP, &ut);
++ utmps_updwtmpx_g("/run/utmps/.btmpd-socket", &ut, 0);
+ }
+
+ #ifdef HAVE_LIBAUDIT
+@@ -731,7 +735,7 @@
+ struct utmpx *utp = NULL;
+ struct timeval tv = { 0 };
+
+- utmpxname(_PATH_UTMP);
++ // utmpxname(_PATH_UTMP);
+ setutxent();
+
+ /* Find pid in utmp.
+@@ -794,7 +798,8 @@
+ pututxline(&ut);
+ endutxent();
+
+- updwtmpx(_PATH_WTMP, &ut);
++ // updwtmpx(_PATH_WTMP, &ut);
++ utmps_updwtmpx_g("/run/utmps/.wtmpd-socket", &ut, 0);
+ }
+
+ static void log_syslog(struct login_context *cxt)
diff --git a/system/util-linux/APKBUILD b/system/util-linux/APKBUILD
index 2cda4fc68..2ce26cd75 100644
--- a/system/util-linux/APKBUILD
+++ b/system/util-linux/APKBUILD
@@ -9,7 +9,7 @@ case $pkgver in
*.*) _v=$pkgver;;
esac
-pkgrel=0
+pkgrel=1
pkgdesc="Official Linux system management utilities"
url="https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"
arch="all"
@@ -31,6 +31,7 @@ provides="sfdisk=$pkgver-r$pkgrel cfdisk=$pkgver-r$pkgrel
libfdisk=$pkgver-r$pkgrel"
source="https://www.kernel.org/pub/linux/utils/$pkgname/v${_v}/$pkgname-$pkgver.tar.xz
ttydefaults.h
+ 0000-utmps-paths.patch
"
prepare() {
@@ -99,4 +100,5 @@ libmount() {
}
sha512sums="07f11147f67dfc6c8bc766dfc83266054e6ede776feada0566b447d13276b6882ee85c6fe53e8d94a17c03332106fc0549deca3cf5f2e92dda554e9bc0551957 util-linux-2.38.1.tar.xz
-876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h"
+876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h
+b1d992b58af516bd4c19dfa3f7df2680f4d0c31608fd20b5ae5eab23138df00666a8b1895d8d19d8afb66ce5f535f04a1ce81b248ae69b1f68c991d6549e6726 0000-utmps-paths.patch"