git: 79674f5097cf - 2024Q1 - x11/lightdm: Fix ttyv numbering logic
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Feb 2024 19:05:12 UTC
The branch 2024Q1 has been updated by madpilot: URL: https://cgit.FreeBSD.org/ports/commit/?id=79674f5097cfec61c7e981ede019bb449f6e28e6 commit 79674f5097cfec61c7e981ede019bb449f6e28e6 Author: Guido Falsi <madpilot@FreeBSD.org> AuthorDate: 2024-02-26 19:00:03 +0000 Commit: Guido Falsi <madpilot@FreeBSD.org> CommitDate: 2024-02-26 19:04:59 +0000 x11/lightdm: Fix ttyv numbering logic Adapt code from wlroots to correctly generate ttyv device names for numbers beyond 9. Upstream pull request: https://github.com/canonical/lightdm/pull/343 PR: 277114 Obtained from: https://github.com/swaywm/wlroots/commit/fc6c0ca12e941d5d7d567834bff3ab7df9447001 (inspired by) MFH: 2024Q1 (cherry picked from commit c88dffc0c8b6f2c82a522d8eb2dcd2b49e9a4015) --- x11/lightdm/Makefile | 2 +- x11/lightdm/files/patch-src_x-server.c | 60 ++++++++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/x11/lightdm/Makefile b/x11/lightdm/Makefile index cdbe7bb7d5f5..5139df1403f2 100644 --- a/x11/lightdm/Makefile +++ b/x11/lightdm/Makefile @@ -1,6 +1,6 @@ PORTNAME= lightdm PORTVERSION= 1.32.0 -PORTREVISION= 3 +PORTREVISION= 5 CATEGORIES= x11 MASTER_SITES= https://github.com/canonical/${PORTNAME}/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/ diff --git a/x11/lightdm/files/patch-src_x-server.c b/x11/lightdm/files/patch-src_x-server.c index 394789feaa3f..514215b861ab 100644 --- a/x11/lightdm/files/patch-src_x-server.c +++ b/x11/lightdm/files/patch-src_x-server.c @@ -1,15 +1,63 @@ ---- src/x-server.c.orig 2018-08-30 00:28:55 UTC +--- src/x-server.c.orig 2019-08-04 22:29:55 UTC +++ src/x-server.c -@@ -152,10 +152,10 @@ x_server_connect_session (DisplayServer *display_serve +@@ -152,13 +152,60 @@ x_server_connect_session (DisplayServer *display_serve g_autofree gchar *tty_text = NULL; g_autofree gchar *vt_text = NULL; -- tty_text = g_strdup_printf ("/dev/tty%d", vt); -+ tty_text = g_strdup_printf ("/dev/ttyv%d", vt - 1); ++#ifdef __FreeBSD__ ++ char vty_num32[6]; ++ int num; ++ const int base = 32; ++ size_t offset = 0; ++ ++ num = vt - 1; ++ ++ if (num == 0) { ++ vty_num32[offset++] = '0'; ++ vty_num32[offset] = '\0'; ++ } else { ++ for (int remaning = num; remaning > 0; remaning /= base, offset++) { ++ if (offset + 1 >= 6) { ++ g_error ("tty number buffer too small"); ++ goto error; ++ } ++ ++ const int value = remaning % base; ++ if (value >= 10) { ++ vty_num32[offset] = 'a' + value - 10; ++ } else { ++ vty_num32[offset] = '0' + value; ++ } ++ } ++ ++ for (size_t i = 0; i < offset / 2; i++) { ++ const size_t p1 = i; ++ const size_t p2 = offset - 1 - i; ++ const char tmp = vty_num32[p1]; ++ vty_num32[p1] = vty_num32[p2]; ++ vty_num32[p2] = tmp; ++ } ++ ++ vty_num32[offset] = '\0'; ++ } ++ ++ tty_text = g_strdup_printf ("/dev/ttyv%s", vty_num32); ++#else + tty_text = g_strdup_printf ("/dev/tty%d", vt); ++#endif session_set_tty (session, tty_text); -- vt_text = g_strdup_printf ("%d", vt); -+ vt_text = g_strdup_printf ("%d", vt - 1); ++#ifdef __FreeBSD__ ++ vt_text = g_strdup_printf ("%d", num); ++#else + vt_text = g_strdup_printf ("%d", vt); ++#endif session_set_env (session, "XDG_VTNR", vt_text); } else ++#ifdef __FreeBSD__ ++error: ++#endif + l_debug (session, "Not setting XDG_VTNR"); + + session_set_env (session, "DISPLAY", x_server_get_address (X_SERVER (display_server)));