diff --git a/debian/changelog b/debian/changelog index 36d6516..05d7c9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +util-linux (2.40.4-3deepin8) unstable; urgency=medium + + * fix lscpu wrong at Phytium. + * revert fix var/run/utmp don't be updated after logout/login + + -- xinpeng.wang Thu, 19 Jun 2025 17:50:42 +0800 + util-linux (2.40.4-3deepin7) unstable; urgency=medium * feat: add sw64 support diff --git a/debian/patches/debian/login-turn-on-utmp-writing.patch b/debian/patches/debian/login-turn-on-utmp-writing.patch deleted file mode 100644 index 2ddf17d..0000000 --- a/debian/patches/debian/login-turn-on-utmp-writing.patch +++ /dev/null @@ -1,95 +0,0 @@ -Index: util-linux/login-utils/login.c -=================================================================== ---- util-linux.orig/login-utils/login.c -+++ util-linux/login-utils/login.c -@@ -1076,6 +1076,62 @@ static void loginpam_session(struct logi - } - - /* -+ * Clean up utmp entry when user logs out. -+ */ -+static void log_out_utmp(struct login_context *cxt) -+{ -+ struct utmpx ut = { 0 }; -+ struct utmpx *utp = NULL; -+ struct timeval tv = { 0 }; -+ -+ utmpxname(_PATH_UTMP); -+ setutxent(); -+ -+ /* Find the entry to clean up - search by pid first */ -+ while ((utp = getutxent())) -+ if (utp->ut_pid == cxt->pid && utp->ut_type == USER_PROCESS) -+ break; -+ -+ /* If we can't find by pid, try by line */ -+ if (utp == NULL && cxt->tty_name) { -+ setutxent(); -+ ut.ut_type = USER_PROCESS; -+ str2memcpy(ut.ut_line, cxt->tty_name, sizeof(ut.ut_line)); -+ utp = getutxline(&ut); -+ } -+ -+ /* If we can't find by pid and line, try by id */ -+ if (utp == NULL && cxt->tty_number) { -+ setutxent(); -+ ut.ut_type = USER_PROCESS; -+ str2memcpy(ut.ut_id, cxt->tty_number, sizeof(ut.ut_id)); -+ utp = getutxid(&ut); -+ } -+ -+ if (utp) { -+ /* Copy the existing entry and modify it for logout */ -+ memcpy(&ut, utp, sizeof(ut)); -+ -+ /* Clear the username to indicate logout */ -+ memset(ut.ut_user, 0, sizeof(ut.ut_user)); -+ -+ /* Mark as dead process */ -+ ut.ut_type = DEAD_PROCESS; -+ -+ /* Update timestamp */ -+ gettimeofday(&tv, NULL); -+ ut.ut_tv.tv_sec = tv.tv_sec; -+ ut.ut_tv.tv_usec = tv.tv_usec; -+ -+ /* Update utmp and wtmp */ -+ pututxline(&ut); -+ updwtmpx(_PATH_WTMP, &ut); -+ } -+ -+ endutxent(); -+} -+ -+/* - * Detach the controlling terminal, fork, restore syslog stuff, and create - * a new session. - */ -@@ -1118,6 +1174,9 @@ static void fork_session(struct login_co - if (child_pid < 0) { - warn(_("fork failed")); - -+ /* Clean up utmp record before exit on fork failure */ -+ log_out_utmp(cxt); -+ - pam_setcred(cxt->pamh, PAM_DELETE_CRED); - pam_end(cxt->pamh, pam_close_session(cxt->pamh, 0)); - sleepexit(EXIT_FAILURE); -@@ -1140,6 +1199,9 @@ static void fork_session(struct login_co - while (wait(NULL) == -1 && errno == EINTR) ; - openlog("login", LOG_ODELAY, LOG_AUTHPRIV); - -+ /* Clean up utmp record before exit on fork failure */ -+ log_out_utmp(cxt); -+ - pam_setcred(cxt->pamh, PAM_DELETE_CRED); - pam_end(cxt->pamh, pam_close_session(cxt->pamh, 0)); - exit(EXIT_SUCCESS); -@@ -1494,6 +1556,7 @@ int main(int argc, char **argv) - endpwent(); - - log_audit(&cxt, 1); -+ log_utmp(&cxt); - - chown_tty(&cxt); - diff --git a/debian/patches/series b/debian/patches/series index 28fa4e5..c2caa69 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -25,5 +25,5 @@ upstream-master/fallocate-forbid-posix-with-special-options.patch upstream-master/lib-colors-fix-fallback-to-system-directory.patch debian/usec-umac-adapt.patch uniontech-backward-lsblk.patch -debian/login-turn-on-utmp-writing.patch add-sunway-support.patch +uniontech-fix-arm-lscpu-modename.patch diff --git a/debian/patches/uniontech-fix-arm-lscpu-modename.patch b/debian/patches/uniontech-fix-arm-lscpu-modename.patch new file mode 100644 index 0000000..d9f7d94 --- /dev/null +++ b/debian/patches/uniontech-fix-arm-lscpu-modename.patch @@ -0,0 +1,14 @@ +Index: util-linux/sys-utils/lscpu-arm.c +=================================================================== +--- util-linux.orig/sys-utils/lscpu-arm.c 2025-06-19 16:54:39.000000000 +0800 ++++ util-linux/sys-utils/lscpu-arm.c 2025-06-19 17:27:52.072178100 +0800 +@@ -311,7 +311,8 @@ + { 0x66, faraday_part, "Faraday" }, + { 0x69, intel_part, "Intel" }, + { 0x6d, ms_part, "Microsoft" }, +- { 0x70, ft_part, "Phytium" }, ++ /* The parsing logic of phytium CPU is wrong. Use the value in /proc/cpuinfo directly. */ ++ { 0x70, NULL, "Phytium" }, + { 0xc0, ampere_part, "Ampere" }, + { -1, unknown_part, "unknown" }, + };