diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
| commit | b590c8d7572b727d565cc0b8ff660d43569845de (patch) | |
| tree | 06f7a4102ea4e845df8b66660f252920d52952f9 /app-misc/screen | |
| parent | 24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff) | |
| download | baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip | |
Adding metadata
Diffstat (limited to 'app-misc/screen')
| -rw-r--r-- | app-misc/screen/Manifest | 2 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.3.0-no-utempter.patch | 14 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.9.1-add-missing-pty.h-header.patch | 18 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46802.patch | 141 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46804.patch | 126 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46805.patch | 119 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.9.1-hurd-path-max.patch | 41 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-4.9.1-utmp-exit.patch | 43 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-5.0.0-utmp-musl.patch | 13 | ||||
| -rw-r--r-- | app-misc/screen/files/screen-5.0.1-texi.patch | 27 | ||||
| -rw-r--r-- | app-misc/screen/files/screenrc | 353 | ||||
| -rw-r--r-- | app-misc/screen/metadata.xml | 39 | ||||
| -rw-r--r-- | app-misc/screen/screen-4.9.1-r2.ebuild | 153 | ||||
| -rw-r--r-- | app-misc/screen/screen-5.0.1.ebuild | 141 | ||||
| -rw-r--r-- | app-misc/screen/screen-9999.ebuild | 141 |
15 files changed, 1371 insertions, 0 deletions
diff --git a/app-misc/screen/Manifest b/app-misc/screen/Manifest new file mode 100644 index 000000000000..7888a666521b --- /dev/null +++ b/app-misc/screen/Manifest @@ -0,0 +1,2 @@ +DIST screen-4.9.1.tar.gz 1040785 BLAKE2B 27d9c100bc1f747e39e109a4957702388d943c7d3b75b4c59dfc3894456d5249257742106fb24cf6f07a36764db0a1c5f7e0a44123edda1c570d771d7f46c638 SHA512 1f278313528815f4246bb162ced611c5d77321d11055e8d853168dc804c75d5f78568056a23e46db0640e1605e5cad4a5ce05e95e50cf02bb322cb6f57e5a126 +DIST screen-5.0.1.tar.gz 897507 BLAKE2B ce8478718903ea4f9f7d5de2c77008cee304fef1065f3d564844844cb3ba7acb88bfe2cda051cecee0f034b19ea4e52a0fcc1549f9339eac33e7748ab59cd0f5 SHA512 9bda35689d73a816515df30f50101531cf3af8906cb47f086d1f97c464cb729f4ee6e3d4aca220acc4c6125d81e923ee3a11fb3a85fe6994002bf1e0f3cc46fb diff --git a/app-misc/screen/files/screen-4.3.0-no-utempter.patch b/app-misc/screen/files/screen-4.3.0-no-utempter.patch new file mode 100644 index 000000000000..e11be5b11e61 --- /dev/null +++ b/app-misc/screen/files/screen-4.3.0-no-utempter.patch @@ -0,0 +1,14 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -878,11 +878,6 @@ + #include <utmp.h> + #endif + ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST)) +-AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no) +-if test "$have_utempter" = yes; then +- AC_DEFINE(HAVE_UTEMPTER) +- LIBS="$LIBS -lutempter" +-fi + + dnl + dnl **** loadav **** diff --git a/app-misc/screen/files/screen-4.9.1-add-missing-pty.h-header.patch b/app-misc/screen/files/screen-4.9.1-add-missing-pty.h-header.patch new file mode 100644 index 000000000000..4e39cd947c01 --- /dev/null +++ b/app-misc/screen/files/screen-4.9.1-add-missing-pty.h-header.patch @@ -0,0 +1,18 @@ +https://bugs.gentoo.org/953896 + +pty.h is necessary on some Linux, but it isn't in POSIX, so it breaks +systems like macOS, *BSD, HPUX, AIX and Solaris. Basically everywhere +not-Linux, so add guard to only apply on Linux. + +--- a/pty.c ++++ b/pty.c +@@ -29,6 +29,9 @@ + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> ++#if defined(__linux__) || defined(__linux) || defined(linux) || defined(__GNU__) ++#include <pty.h> ++#endif + #include <signal.h> + + #if defined(__OpenBSD__) diff --git a/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46802.patch b/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46802.patch new file mode 100644 index 000000000000..c43380ce0de6 --- /dev/null +++ b/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46802.patch @@ -0,0 +1,141 @@ +Adapted from https://git.savannah.gnu.org/cgit/screen.git/patch/?id=049b26b22e197ba3be9c46e5c193032e01a4724a + +From 049b26b22e197ba3be9c46e5c193032e01a4724a Mon Sep 17 00:00:00 2001 +From: Matthias Gerstner <matthias.gerstner@suse.de> +Date: Mon, 12 May 2025 15:15:38 +0200 +Subject: fix CVE-2025-46802: attacher.c - prevent temporary 0666 mode on PTYs + +This temporary chmod of the PTY to mode 0666 is most likely a remnant of +past times, before the PTY file descriptor was passed to the target +session via the UNIX domain socket. + +This chmod() causes a race condition during which any other user in the +system can open the PTY for reading and writing, and thus allows PTY +hijacking. + +Simply remove this logic completely. +--- + attacher.c | 27 --------------------------- + screen.c | 19 ------------------- + 2 files changed, 46 deletions(-) + +diff --git a/attacher.c b/attacher.c +index c35ae7a..16b151e 100644 +--- a/attacher.c ++++ b/attacher.c +@@ -73,7 +73,6 @@ extern int MasterPid, attach_fd; + #ifdef MULTIUSER + extern char *multi; + extern int multiattach, multi_uid, own_uid; +-extern int tty_mode, tty_oldmode; + # ifndef USE_SETEUID + static int multipipe[2]; + # endif +@@ -160,9 +159,6 @@ int how; + + if (pipe(multipipe)) + Panic(errno, "pipe"); +- if (chmod(attach_tty, 0666)) +- Panic(errno, "chmod %s", attach_tty); +- tty_oldmode = tty_mode; + eff_uid = -1; /* make UserContext fork */ + real_uid = multi_uid; + if ((ret = UserContext()) <= 0) +@@ -174,11 +170,6 @@ int how; + Panic(errno, "UserContext"); + close(multipipe[1]); + read(multipipe[0], &dummy, 1); +- if (tty_oldmode >= 0) +- { +- chmod(attach_tty, tty_oldmode); +- tty_oldmode = -1; +- } + ret = UserStatus(); + #ifdef LOCK + if (ret == SIG_LOCK) +@@ -224,9 +215,6 @@ int how; + xseteuid(multi_uid); + xseteuid(own_uid); + #endif +- if (chmod(attach_tty, 0666)) +- Panic(errno, "chmod %s", attach_tty); +- tty_oldmode = tty_mode; + } + # endif /* USE_SETEUID */ + #endif /* MULTIUSER */ +@@ -423,13 +411,6 @@ int how; + ContinuePlease = 0; + # ifndef USE_SETEUID + close(multipipe[1]); +-# else +- xseteuid(own_uid); +- if (tty_oldmode >= 0) +- if (chmod(attach_tty, tty_oldmode)) +- Panic(errno, "chmod %s", attach_tty); +- tty_oldmode = -1; +- xseteuid(real_uid); + # endif + } + #endif +@@ -505,14 +486,6 @@ AttacherFinit SIGDEFARG + close(s); + } + } +-#ifdef MULTIUSER +- if (tty_oldmode >= 0) +- { +- if (setuid(own_uid)) +- Panic(errno, "setuid"); +- chmod(attach_tty, tty_oldmode); +- } +-#endif + exit(0); + SIGRETURN; + } +diff --git a/screen.c b/screen.c +index 7653cd1..1a23e1a 100644 +--- a/screen.c ++++ b/screen.c +@@ -230,8 +230,6 @@ char *multi_home; + int multi_uid; + int own_uid; + int multiattach; +-int tty_mode; +-int tty_oldmode = -1; + #endif + + char HostName[MAXSTR]; +@@ -1009,9 +1007,6 @@ int main(int ac, char** av) + + /* ttyname implies isatty */ + SetTtyname(true, &st); +-#ifdef MULTIUSER +- tty_mode = (int)st.st_mode & 0777; +-#endif + + fl = fcntl(0, F_GETFL, 0); + if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR) +@@ -2170,20 +2165,6 @@ DEFINE_VARARGS_FN(Panic) + if (D_userpid) + Kill(D_userpid, SIG_BYE); + } +-#ifdef MULTIUSER +- if (tty_oldmode >= 0) { +- +-# ifdef USE_SETEUID +- if (setuid(own_uid)) +- xseteuid(own_uid); /* may be a loop. sigh. */ +-# else +- setuid(own_uid); +-# endif +- +- debug1("Panic: changing back modes from %s\n", attach_tty); +- chmod(attach_tty, tty_oldmode); +- } +-#endif + eexit(1); + } + +-- +cgit v1.1 + diff --git a/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46804.patch b/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46804.patch new file mode 100644 index 000000000000..6d013db44272 --- /dev/null +++ b/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46804.patch @@ -0,0 +1,126 @@ +Adapted from https://git.savannah.gnu.org/cgit/screen.git/patch/?id=e0eef5aac453fa98a2664416a56c50ad1d00cb30 + +From e0eef5aac453fa98a2664416a56c50ad1d00cb30 Mon Sep 17 00:00:00 2001 +From: Matthias Gerstner <matthias.gerstner@suse.de> +Date: Mon, 12 May 2025 15:26:11 +0200 +Subject: fix CVE-2025-46804: avoid file existence test information leaks + +In setuid-root context the current error messages give away whether +certain paths not accessible by the real user exist and what type they +have. To prevent this only output generic error messages in setuid-root +context. + +In some situations, when an error is pertaining a directory and the +directory is owner by the real user then we can still output more +detailed diagnostics. + +This change can lead to less helpful error messages when Screen is +install setuid-root. More complex changes would be needed to avoid this +(e.g. only open the `SocketPath` with raised privileges when +multi-attach is requested). + +There might still be lingering some code paths that allow such +information leaks, since `SocketPath` is a global variable that is used +across the code base. The majority of issues should be caught with this +fix, however. +--- + screen.c | 45 ++++++++++++++++++++++++++++++++++----------- + socket.c | 9 +++++++-- + 2 files changed, 41 insertions(+), 13 deletions(-) + +diff --git a/screen.c b/screen.c +index 1a23e1a..6eec151 100644 +--- a/screen.c ++++ b/screen.c +@@ -1122,15 +1122,28 @@ int main(int ac, char** av) + #endif + } + +- if (stat(SockPath, &st) == -1) +- Panic(errno, "Cannot access %s", SockPath); +- else +- if (!S_ISDIR(st.st_mode)) ++ if (stat(SockPath, &st) == -1) { ++ if (eff_uid == real_uid) { ++ Panic(errno, "Cannot access %s", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } else if (!S_ISDIR(st.st_mode)) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "%s is not a directory.", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + #ifdef MULTIUSER + if (multi) { +- if ((int)st.st_uid != multi_uid) +- Panic(0, "%s is not the owner of %s.", multi, SockPath); ++ if ((int)st.st_uid != multi_uid) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { ++ Panic(0, "%s is not the owner of %s.", multi, SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + } + else + #endif +@@ -1144,9 +1157,13 @@ int main(int ac, char** av) + Panic(0, "You are not the owner of %s.", SockPath); + #endif + } +- +- if ((st.st_mode & 0777) != 0700) +- Panic(0, "Directory %s must have mode 700.", SockPath); ++ if ((st.st_mode & 0777) != 0700) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { ++ Panic(0, "Directory %s must have mode 700.", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + if (SockMatch && index(SockMatch, '/')) + Panic(0, "Bad session name '%s'", SockMatch); + SockName = SockPath + strlen(SockPath) + 1; +@@ -1184,8 +1201,14 @@ int main(int ac, char** av) + else + exit(9 + (fo || oth ? 1 : 0) + fo); + } +- if (fo == 0) +- Panic(0, "No Sockets found in %s.\n", SockPath); ++ if (fo == 0) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { ++ Panic(0, "No Sockets found in %s.\n", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } ++ + Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SockPath); + eexit(0); + } +diff --git a/socket.c b/socket.c +index 54d8cb8..6c3502f 100644 +--- a/socket.c ++++ b/socket.c +@@ -169,8 +169,13 @@ bool *is_sock; + xsetegid(real_gid); + #endif + +- if ((dirp = opendir(SockPath)) == 0) +- Panic(errno, "Cannot opendir %s", SockPath); ++ if ((dirp = opendir(SockPath)) == 0) { ++ if (eff_uid == real_uid) { ++ Panic(errno, "Cannot opendir %s", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + + slist = 0; + slisttail = &slist; +-- +cgit v1.1 + diff --git a/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46805.patch b/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46805.patch new file mode 100644 index 000000000000..a7bb6d3ae74b --- /dev/null +++ b/app-misc/screen/files/screen-4.9.1-fix_CVE-2025-46805.patch @@ -0,0 +1,119 @@ +Adapted from https://git.savannah.gnu.org/cgit/screen.git/patch/?id=161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4 + +From 161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4 Mon Sep 17 00:00:00 2001 +From: Matthias Gerstner <matthias.gerstner@suse.de> +Date: Mon, 12 May 2025 15:38:19 +0200 +Subject: fix CVE-2025-46805: socket.c - don't send signals with root + privileges + +The CheckPid() function was introduced to address CVE-2023-24626, to +prevent sending SIGCONT and SIGHUP to arbitrary PIDs in the system. This +fix still suffers from a TOCTOU race condition. The client can replace +itself by a privileged process, or try to cycle PIDs until a privileged +process receives the original PID. + +To prevent this, always send signals using the real privileges. Keep +CheckPid() for error diagnostics. If sending the actual signal fails +later on then there will be no more error reporting. + +It seems the original bugfix already introduced a regression when +attaching to another's user session that is not owned by root. In this +case the target sessions runs with real uid X, while for sending a +signal to the `pid` provided by the client real uid Y (or root +privileges) are required. + +This is hard to properly fix without this regression. On Linux pidfds +could be used to allow safely sending signals to other PIDs as root +without involving race conditions. In this case the client PID should +also be obtained via the UNIX domain socket's SO_PEERCRED option, +though. +--- + socket.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/socket.c b/socket.c +index 6c3502f..d6621fa 100644 +--- a/socket.c ++++ b/socket.c +@@ -831,6 +831,11 @@ int pid; + return UserStatus(); + } + ++static void KillUnpriv(pid_t pid, int sig) { ++ UserContext(); ++ UserReturn(kill(pid, sig)); ++} ++ + #ifdef hpux + /* + * From: "F. K. Bruner" <napalm@ugcs.caltech.edu> +@@ -916,14 +921,14 @@ struct win *wi; + { + Msg(errno, "Could not perform necessary sanity checks on pts device."); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + if (strcmp(ttyname_in_ns, m->m_tty)) + { + Msg(errno, "Attach: passed fd does not match tty: %s - %s!", ttyname_in_ns, m->m_tty[0] != '\0' ? m->m_tty : "(null)"); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + /* m->m_tty so far contains the actual name of the pts device in the +@@ -940,19 +945,19 @@ struct win *wi; + { + Msg(errno, "Attach: passed fd does not match tty: %s - %s!", m->m_tty, myttyname ? myttyname : "NULL"); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + } + else if ((i = secopen(m->m_tty, O_RDWR | O_NONBLOCK, 0)) < 0) + { + Msg(errno, "Attach: Could not open %s!", m->m_tty); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + #ifdef MULTIUSER + if (attach) +- Kill(pid, SIGCONT); ++ KillUnpriv(pid, SIGCONT); + #endif + + #if defined(ultrix) || defined(pyr) || defined(NeXT) +@@ -965,7 +970,7 @@ struct win *wi; + { + write(i, "Attaching from inside of screen?\n", 33); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + Msg(0, "Attach msg ignored: coming from inside."); + return -1; + } +@@ -976,7 +981,7 @@ struct win *wi; + { + write(i, "Access to session denied.\n", 26); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + Msg(0, "Attach: access denied for user %s.", user); + return -1; + } +@@ -1294,7 +1299,7 @@ ReceiveMsg() + Msg(0, "Query attempt with bad pid(%d)!", m.m.command.apid); + } + else { +- Kill(m.m.command.apid, ++ KillUnpriv(m.m.command.apid, + (queryflag >= 0) + ? SIGCONT + : SIG_BYE); /* Send SIG_BYE if an error happened */ +-- +cgit v1.1 + diff --git a/app-misc/screen/files/screen-4.9.1-hurd-path-max.patch b/app-misc/screen/files/screen-4.9.1-hurd-path-max.patch new file mode 100644 index 000000000000..46aa8a4abd2f --- /dev/null +++ b/app-misc/screen/files/screen-4.9.1-hurd-path-max.patch @@ -0,0 +1,41 @@ +https://salsa.debian.org/debian/screen/-/raw/master/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch?ref_type=heads + +Description: Set PATH_MAX to 4096 if undefined + Fixes FTBFS since 4.4.0 on GNU/Hurd. Updated to add one more occurrence for 4.5.0. +Author: Axel Beckert <abe@debian.org> +Bug: https://savannah.gnu.org/bugs/?50089 +Last-Updated: 2017-01-18 + +--- a/tty.sh ++++ b/tty.sh +@@ -1526,6 +1526,13 @@ + return 0; + } + ++/* ++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd ++ */ ++ ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif + + int CheckTtyname (char *tty) + { +--- a/screen.h ++++ b/screen.h +@@ -109,6 +109,13 @@ + # define DEFAULT_BUFFERFILE "/tmp/screen-exchange" + #endif + ++/* ++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd ++ */ ++ ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif + + #if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) + # define HPUX_LTCHARS_HACK + diff --git a/app-misc/screen/files/screen-4.9.1-utmp-exit.patch b/app-misc/screen/files/screen-4.9.1-utmp-exit.patch new file mode 100644 index 000000000000..71c726b352db --- /dev/null +++ b/app-misc/screen/files/screen-4.9.1-utmp-exit.patch @@ -0,0 +1,43 @@ +From 2f1b9dfe03133c9b77ea450aed088d65128dc547 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <amade@asmblr.net> +Date: Tue, 5 Apr 2016 12:47:08 +0200 +Subject: [PATCH] check if we have ut_exit in utmpx struct + +--- a/acconfig.h ++++ b/acconfig.h +@@ -430,6 +430,11 @@ + */ + #undef BUGGYGETLOGIN + ++/* ++ * Define if your utmpx has ut_exit struct ++ */ ++#undef HAVE_UT_EXIT ++ + /* + * If your system has the calls setreuid() and setregid(), + * define HAVE_SETREUID. Otherwise screen will use a forked process to +--- a/configure.ac ++++ b/configure.ac +@@ -438,6 +438,10 @@ AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1, + AC_NOTE(- skipping check because we are cross compiling; assuming fifo implementation is ok)) + rm -f /tmp/conftest* + fi ++AC_CHECKING(ut_exit) ++AC_TRY_COMPILE([ ++#include <utmpx.h> ++],[struct utmpx u; u.ut_exit.e_exit;], AC_DEFINE(HAVE_UT_EXIT)) + + dnl + dnl **** SOCKET tests **** +--- a/utmp.c ++++ b/utmp.c +@@ -607,7 +607,7 @@ makedead(u) + struct utmp *u; + { + u->ut_type = DEAD_PROCESS; +-#if (!defined(linux) || defined(EMPTY)) && !defined(__CYGWIN__) ++#if defined(HAVE_UT_EXIT) + u->ut_exit.e_termination = 0; + u->ut_exit.e_exit = 0; + #endif diff --git a/app-misc/screen/files/screen-5.0.0-utmp-musl.patch b/app-misc/screen/files/screen-5.0.0-utmp-musl.patch new file mode 100644 index 000000000000..de3d2fb71840 --- /dev/null +++ b/app-misc/screen/files/screen-5.0.0-utmp-musl.patch @@ -0,0 +1,13 @@ + +Patch from: https://github.com/void-linux/void-packages/commit/0f6da07 + +--- a/utmp.c ++++ b/utmp.c +@@ -30,6 +30,7 @@ + + #include "utmp.h" + ++#include <signal.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h>
\ No newline at end of file diff --git a/app-misc/screen/files/screen-5.0.1-texi.patch b/app-misc/screen/files/screen-5.0.1-texi.patch new file mode 100644 index 000000000000..2d10b1faf2a1 --- /dev/null +++ b/app-misc/screen/files/screen-5.0.1-texi.patch @@ -0,0 +1,27 @@ +https://cgit.git.savannah.gnu.org/cgit/screen.git/commit/?h=screen-v5&id=7333452aa52d61a170b1fc199869ea6059849058 + +From 7333452aa52d61a170b1fc199869ea6059849058 Mon Sep 17 00:00:00 2001 +From: Holger Hoffstätte <holger@applied-asynchrony.com> +Date: Thu, 15 May 2025 13:54:44 +0200 +Subject: Fix: unescaped @ in email address + +bug#67126 +--- + doc/screen.texinfo | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/screen.texinfo b/doc/screen.texinfo +index b3568b9..76d0588 100644 +--- a/doc/screen.texinfo ++++ b/doc/screen.texinfo +@@ -5940,7 +5940,7 @@ of @code{Screen} which you are using. Also include in your message the + hardware and operating system, the compiler used to compile, a + description of the bug behavior, and the conditions that triggered the + bug. In case of security issue please send an mail to +-@w{@samp{alexander_naumov@opensuse.org}}. ++@w{@samp{alexander_naumov@@opensuse.org}}. + + @node Availability, , Reporting Bugs, Bugs + @section Availability +-- +cgit v1.2.3 diff --git a/app-misc/screen/files/screenrc b/app-misc/screen/files/screenrc new file mode 100644 index 000000000000..2616b47cf522 --- /dev/null +++ b/app-misc/screen/files/screenrc @@ -0,0 +1,353 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# +# /etc/screenrc +# +# This is the system wide screenrc. +# +# You can use this file to change the default behavior of screen system wide +# or copy it to ~/.screenrc and use it as a starting point for your own +# settings. +# +# Commands in this file are used to set options, bind screen functions to +# keys, redefine terminal capabilities, and to automatically establish one or +# more windows at the beginning of your screen session. +# +# This is not a comprehensive list of options, look at the screen manual for +# details on everything that you can put in this file. +# +# + +# ============================================================================== +# SCREEN SETTINGS +# ============================================================================== + +# ESCAPE - the COMMAND CHARACTER +# =============================================================== +# escape ^aa # default +# escape ^^^^ # suggested binding (Control-^) for Emacs users + + +# PASSWORD +# =============================================================== +# This commands sets the *internal* password for the screen session. +# WARNING!! If this is set then a "lock" command will only let you in to the +# session after you enter the user's account password and then *also* +# the internal password for that session. This gives additional safety but, +# if you forget the internal password then you cannot resume your session. +# Use :password to generate a password +# password ODSJQf.4IJN7E # "1234" + + +# VARIABLES +# =============================================================== +# No annoying audible bell, using "visual bell" +# vbell on # default: off +# vbell_msg " -- Bell,Bell!! -- " # default: "Wuff,Wuff!!" + +# Automatically detach on hangup. + autodetach on # default: on + +# Don't display the copyright page + startup_message off # default: on + +# Affects the copying of text regions + crlf off # default: off + +# Enable/disable multiuser mode. Standard screen operation is singleuser. +# In multiuser mode the commands acladd, aclchg, aclgrp and acldel can be used +# to enable (and disable) other user accessing this screen session. +# Requires suid-root. + multiuser off + +# Change default scrollback value for new windows + defscrollback 1000 # default: 100 + +# Define the time that all windows monitored for silence should +# wait before displaying a message. Default 30 seconds. + silencewait 15 # default: 30 + +# bufferfile: The file to use for commands +# "readbuf" ('<') and "writebuf" ('>'): + bufferfile $HOME/.screen_exchange +# +# hardcopydir: The directory which contains all hardcopies. +# hardcopydir ~/.hardcopy +# hardcopydir ~/.screen +# +# shell: Default process started in screen's windows. +# Makes it possible to use a different shell inside screen +# than is set as the default login shell. +# If begins with a '-' character, the shell will be started as a login shell. +# shell zsh +# shell bash +# shell ksh + shell -$SHELL + +# shellaka '> |tcsh' +# shelltitle '$ |bash' + +# emulate .logout message + pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." + +# caption always " %w --- %c:%s" +# caption always "%3n %t%? @%u%?%? [%h]%?%=%c" + +# advertise hardstatus support to $TERMCAP +# termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\' + +# set every new windows hardstatus line to somenthing descriptive +# defhstatus "screen: ^En (^Et)" + +# don't kill window after the process died +# zombie "^[" + +# ignore displays that block on output +defnonblock on + +# XTERM TWEAKS +# =============================================================== + +# xterm understands both im/ic and doesn't have a status line. +# Note: Do not specify im and ic in the real termcap/info file as +# some programs (e.g. vi) will not work anymore. + termcap xterm* hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l + terminfo xterm* hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l + +# 80/132 column switching must be enabled for ^AW to work +# change init sequence to not switch width + termcapinfo xterm* Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l + +# Make the output buffer large for (fast) xterms. +# termcapinfo xterm* OL=10000 + termcapinfo xterm* OL=100 + +# tell screen that xterm can switch to dark background and has function +# keys. + termcapinfo xterm* 'VR=\E[?5h:VN=\E[?5l' + termcapinfo xterm* 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' + termcapinfo xterm* 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~' + +# special xterm hardstatus: use the window title. + termcapinfo xterm* 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' + +#terminfo xterm 'vb=\E[?5h$<200/>\E[?5l' + termcapinfo xterm* 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l' + +# emulate part of the 'K' charset + termcapinfo xterm* 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' + +# xterm-52 tweaks: +# - uses background color for delete operations + termcapinfo xterm* be + +# Do not use xterm's alternative window buffer, it breaks scrollback (see bug #61195) + termcapinfo xterm*|xs ti@:te=\E[2J + +# WYSE TERMINALS +# =============================================================== + +#wyse-75-42 must have flow control (xo = "terminal uses xon/xoff") +#essential to have it here, as this is a slow terminal. + termcapinfo wy75-42 xo:hs@ + +# New termcap sequences for cursor application mode. + termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J + + +# OTHER TERMINALS +# =============================================================== + +# make hp700 termcap/info better + termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' + +# Extend the vt100 desciption by some sequences. + termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC + terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC + termcapinfo linux C8 +# old rxvt versions also need this +# termcapinfo rxvt C8 + + +# KEYBINDINGS +# ============================================================== +# The "bind" command assign keys to (internal) commands +# SCREEN checks all the keys you type; you type the key +# which is known as the "command character" then SCREEN +# eats this key, too, and checks whether this key is +# "bound" to a command. If so then SCREEN will execute it. +# +# The command "bind" allows you to chose which keys +# will be assigned to the commands. +# +# Some commands are bound to several keys - +# usually to both some letter and its corresponding +# control key combination, eg the command +# "(create) screen" is bound to both 'c' and '^C'. +# +# The following list shows the default bindings: +# +# break ^B b +# clear C +# colon : +# copy ^[ [ +# detach ^D d +# digraph ^V +# displays * +# dumptermcap . +# fit F +# flow ^F f +# focus ^I +# hardcopy h +# help ? +# history { } +# info i +# kill K k +# lastmsg ^M m +# license , +# log H +# login L +# meta x +# monitor M +# next ^@ ^N sp n +# number N +# only Q +# other ^X +# pow_break B +# pow_detach D +# prev ^H ^P p ^? +# quit \ +# readbuf < +# redisplay ^L l +# remove X +# removebuf = +# reset Z +# screen ^C c +# select " ' +# silence _ +# split S +# suspend ^Z z +# time ^T t +# title A +# vbell ^G +# version v +# width W +# windows ^W w +# wrap ^R r +# writebuf > +# xoff ^S s +# xon ^Q q +# ^] paste . +# - select - +# 0 select 0 +# 1 select 1 +# 2 select 2 +# 3 select 3 +# 4 select 4 +# 5 select 5 +# 6 select 6 +# 7 select 7 +# 8 select 8 +# 9 select 9 +# I login on +# O login off +# ] paste . +# + +# And here are the default bind commands if you need them: +# +# bind A title +# bind C clear +# bind D pow_detach +# bind F fit +# bind H log +# bind I login on +# bind K kill +# bind L login +# bind M monitor +# bind N number +# bind O login off +# bind Q only +# bind S split +# bind W width +# bind X remove +# bind Z reset + +# Let's remove some dangerous key bindings ... + bind k + bind ^k +# bind . dumptermcap # default + bind . +# bind ^\ quit # default + bind ^\ +# bind \\ quit # default + bind \\ +# bind ^h ??? # default + bind ^h +# bind h hardcopy # default + bind h + +# ... and make them better. + bind 'K' kill + bind 'I' login on + bind 'O' login off + bind '}' history + +# Yet another hack: +# Prepend/append register [/] to the paste if ^a^] is pressed. +# This lets me have autoindent mode in vi. + register [ "\033:se noai\015a" + register ] "\033:se ai\015a" + bind ^] paste [.] + + +# hardstatus alwaysignore +# hardstatus alwayslastline "%Lw" + +# Resize the current region. The space will be removed from or added to +# the region below or if there's not enough space from the region above. + bind = resize = + bind + resize +3 + bind - resize -3 +# bind _ resize max +# +# attrcolor u "-u b" +# attrcolor b "R" + +# STARTUP SCREENS +# =============================================================== +# Defines the time screen delays a new message when one message +# is currently displayed. The default is 1 second. +# msgminwait 2 + +# Time a message is displayed if screen is not disturbed by +# other activity. The dafault is 5 seconds: +# msgwait 2 + +# Briefly show the version number of this starting +# screen session - but only for *one* second: +# msgwait 1 +# version + +# Welcome the user: +# echo "welcome :-)" +# echo "I love you today." + +# Uncomment one/some following lines to automatically let +# SCREEN start some programs in the given window numbers: +# screen -t MAIL 0 mutt +# screen -t EDIT 1 vim +# screen -t GOOGLE 2 links http://www.google.com +# screen -t NEWS 3 slrn +# screen -t WWW 4 links http://www.math.fu-berlin.de/~guckes/ +# screen 5 +# screen 6 + +# Set the environment variable var to value string. If only var is specified, +# you'll be prompted to enter a value. If no parameters are specified, +# you'll be prompted for both variable and value. The environment is +# inherited by all subsequently forked shells. +# setenv PROMPT_COMMAND 'echo -n -e "\033k\033\134"' + +# Don't you want to start programs which need a DISPLAY ? +# setenv DISPLAY '' diff --git a/app-misc/screen/metadata.xml b/app-misc/screen/metadata.xml new file mode 100644 index 000000000000..9fc096744259 --- /dev/null +++ b/app-misc/screen/metadata.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>swegener@gentoo.org</email> + </maintainer> + <maintainer type="project"> + <email>shell-tools@gentoo.org</email> + <name>Gentoo Shell Tools Project</name> + </maintainer> + <longdescription> + Screen is a full-screen window manager that multiplexes a physical terminal + between several processes, typically interactive shells. Each virtual terminal + provides the functions of the DEC VT100 terminal and, in addition, several + control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g., + insert/delete line and support for multiple character sets). There is a + scrollback history buffer for each virtual terminal and a copy-and-paste + mechanism that allows the user to move text regions between windows. When screen + is called, it creates a single window with a shell in it (or the specified + command) and then gets out of your way so that you can use the program as you + normally would. Then, at any time, you can create new (full-screen) windows with + other programs in them (including more shells), kill the current window, view a + list of the active windows, turn output logging on and off, copy text between + windows, view the scrollback history, switch between windows, etc. All windows + run their programs completely independent of each other. Programs continue to + run when their window is currently not visible and even when the whole screen + session is detached from the users terminal. + </longdescription> + <use> + <flag name="multiuser">Enable multiuser support (by setting correct permissions)</flag> + <flag name="nethack">Express error messages in nethack style</flag> + <flag name="utempter">Enable support for <pkg>sys-libs/libutempter</pkg> + </flag> + </use> + <upstream> + <remote-id type="cpe">cpe:/a:gnu:screen</remote-id> + </upstream> + <origin>baldeagleos-repo</origin> +</pkgmetadata> diff --git a/app-misc/screen/screen-4.9.1-r2.ebuild b/app-misc/screen/screen-4.9.1-r2.ebuild new file mode 100644 index 000000000000..03863382bdcc --- /dev/null +++ b/app-misc/screen/screen-4.9.1-r2.ebuild @@ -0,0 +1,153 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic pam tmpfiles + +DESCRIPTION="screen manager with VT100/ANSI terminal emulation" +HOMEPAGE="https://www.gnu.org/software/screen/" + +if [[ ${PV} != 9999 ]] ; then + SRC_URI="mirror://gnu/${PN}/${P}.tar.gz" + KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris" +else + inherit git-r3 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/screen.git" + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}" # needed for setting S later on + S="${WORKDIR}"/${P}/src +fi + +LICENSE="GPL-3+" +SLOT="0" +IUSE="debug nethack pam selinux multiuser" + +DEPEND=">=sys-libs/ncurses-5.2:= + virtual/libcrypt:= + pam? ( sys-libs/pam )" +RDEPEND="${DEPEND} + acct-group/utmp + selinux? ( sec-policy/selinux-screen )" +BDEPEND="sys-apps/texinfo" + +PATCHES=( + # Don't use utempter even if it is found on the system. + "${FILESDIR}"/${PN}-4.3.0-no-utempter.patch + "${FILESDIR}"/${PN}-4.9.1-utmp-exit.patch + "${FILESDIR}"/${PN}-4.9.1-add-missing-pty.h-header.patch + "${FILESDIR}"/${PN}-4.9.1-fix_CVE-2025-46802.patch + "${FILESDIR}"/${PN}-4.9.1-fix_CVE-2025-46804.patch + "${FILESDIR}"/${PN}-4.9.1-fix_CVE-2025-46805.patch + "${FILESDIR}"/${PN}-4.9.1-hurd-path-max.patch +) + +src_prepare() { + default + + # sched.h is a system header and causes problems with some C libraries + mv sched.h _sched.h || die + sed -i '/include/ s:sched.h:_sched.h:' screen.h || die + + # Fix manpage + sed -i \ + -e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \ + -e "s:/usr/local/screens:${EPREFIX}/tmp/screen:g" \ + -e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \ + -e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \ + -e "s:/local/screens/S\\\-:${EPREFIX}/tmp/screen/S\\\-:g" \ + doc/screen.1 || die + + if [[ ${CHOST} == *-darwin* ]] || use elibc_musl; then + sed -i -e '/^#define UTMPOK/s/define/undef/' acconfig.h || die + fi + + # disable musl dummy headers for utmp[x] + use elibc_musl && append-cppflags "-D_UTMP_H -D_UTMPX_H" + + # reconfigure + eautoreconf +} + +src_configure() { + # bug #944429 (revisit this on >= 5.0.0) + append-cflags -std=gnu17 + append-lfs-flags + append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}" + + if [[ ${CHOST} == *-solaris* ]]; then + # enable msg_header by upping the feature standard compatible + # with c99 mode + append-cppflags -D_XOPEN_SOURCE=600 + fi + + use nethack || append-cppflags "-DNONETHACK" + use debug && append-cppflags "-DDEBUG" + + local myeconfargs=( + --with-socket-dir="${EPREFIX}/tmp/${PN}" + --with-sys-screenrc="${EPREFIX}/etc/screenrc" + --with-pty-mode=0620 + --with-pty-group=5 + --enable-rxvt_osc + --enable-telnet + --enable-colors256 + $(use_enable pam) + ) + econf "${myeconfargs[@]}" +} + +src_compile() { + LC_ALL=POSIX emake comm.h term.h + emake osdef.h + + emake -C doc screen.info + default +} + +src_install() { + local DOCS=( + README ChangeLog INSTALL TODO NEWS* patchlevel.h + doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps} + ) + + emake DESTDIR="${D}" SCREEN="${P}" install + + local tmpfiles_perms tmpfiles_group + + if use multiuser || use prefix ; then + fperms 4755 /usr/bin/${P} + tmpfiles_perms="0755" + tmpfiles_group="root" + else + fowners root:utmp /usr/bin/${P} + fperms 2755 /usr/bin/${P} + tmpfiles_perms="0775" + tmpfiles_group="utmp" + fi + + newtmpfiles - screen.conf <<<"d /tmp/screen ${tmpfiles_perms} root ${tmpfiles_group}" + + insinto /usr/share/${PN} + doins terminfo/{screencap,screeninfo.src} + + insinto /etc + doins "${FILESDIR}"/screenrc + + if use pam; then + pamd_mimic_system screen auth + fi + + dodoc "${DOCS[@]}" +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog "Some dangerous key bindings have been removed or changed to more safe values." + elog "We enable some xterm hacks in our default screenrc, which might break some" + elog "applications. Please check /etc/screenrc for information on these changes." + fi + + tmpfiles_process screen.conf + + ewarn "This revision changes the screen socket location to ${EROOT}/tmp/${PN}" +} diff --git a/app-misc/screen/screen-5.0.1.ebuild b/app-misc/screen/screen-5.0.1.ebuild new file mode 100644 index 000000000000..f6278da36ca4 --- /dev/null +++ b/app-misc/screen/screen-5.0.1.ebuild @@ -0,0 +1,141 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic pam tmpfiles + +DESCRIPTION="screen manager with VT100/ANSI terminal emulation" +HOMEPAGE="https://www.gnu.org/software/screen/" + +if [[ ${PV} != 9999 ]] ; then + SRC_URI="mirror://gnu/${PN}/${P}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris" +else + inherit git-r3 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/screen.git" + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}" # needed for setting S later on + S="${WORKDIR}"/${P}/src +fi + +LICENSE="GPL-3+" +SLOT="0" +IUSE="debug nethack pam selinux utempter multiuser" +# bug #956963 +RESTRICT="test" + +DEPEND=">=sys-libs/ncurses-5.2:= + virtual/libcrypt:= + pam? ( sys-libs/pam )" +RDEPEND="${DEPEND} + acct-group/utmp + selinux? ( sec-policy/selinux-screen ) + utempter? ( sys-libs/libutempter:= )" +BDEPEND="sys-apps/texinfo" + +PATCHES=( + "${FILESDIR}"/${PN}-5.0.0-utmp-musl.patch + "${FILESDIR}"/${PN}-5.0.1-texi.patch +) + +src_prepare() { + default + + # sched.h is a system header and causes problems with some C libraries + mv sched.h _sched.h || die + sed -i '/include/ s:sched.h:_sched.h:' canvas.h sched.c screen.h window.h winmsg.c || die + sed -i 's:sched.h:_sched.h:' Makefile.in || die + + # Fix manpage + sed -i \ + -e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \ + -e "s:/usr/local/screens:${EPREFIX}/tmp/screen:g" \ + -e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \ + -e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \ + -e "s:/local/screens/S\\\-:${EPREFIX}/tmp/screen/S\\\-:g" \ + doc/screen.1 || die + + # reconfigure + eautoreconf +} + +src_configure() { + append-lfs-flags + append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}" + + if [[ ${CHOST} == *-solaris* ]]; then + # enable msg_header by upping the feature standard compatible + # with c99 mode + append-cppflags -D_XOPEN_SOURCE=600 + fi + + use nethack || append-cppflags "-DNONETHACK" + use debug && append-cppflags "-DDEBUG" + + local myeconfargs=( + --enable-socket-dir="${EPREFIX}/tmp/${PN}" + --with-system-screenrc="${EPREFIX}/etc/screenrc" + --with-pty-mode=0620 + --with-pty-group=5 + --enable-telnet + $(use_enable pam) + $(use_enable utempter utmp) + ) + + econf "${myeconfargs[@]}" +} + +src_compile() { + LC_ALL=POSIX emake comm.h term.h + + emake -C doc screen.info + default +} + +src_install() { + local DOCS=( + README ChangeLog INSTALL TODO NEWS* + doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps} + ) + + emake DESTDIR="${D}" SCREEN="${P}" install + + local tmpfiles_perms tmpfiles_group + + if use multiuser || use prefix ; then + fperms 4755 /usr/bin/${P} + tmpfiles_perms="0755" + tmpfiles_group="root" + else + fowners root:utmp /usr/bin/${P} + fperms 2755 /usr/bin/${P} + tmpfiles_perms="0775" + tmpfiles_group="utmp" + fi + + newtmpfiles - screen.conf <<<"d /tmp/screen ${tmpfiles_perms} root ${tmpfiles_group}" + + insinto /usr/share/${PN} + doins terminfo/{screencap,screeninfo.src} + + insinto /etc + doins "${FILESDIR}"/screenrc + + if use pam; then + pamd_mimic_system screen auth + fi + + dodoc "${DOCS[@]}" +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog "Some dangerous key bindings have been removed or changed to more safe values." + elog "We enable some xterm hacks in our default screenrc, which might break some" + elog "applications. Please check /etc/screenrc for information on these changes." + fi + + tmpfiles_process screen.conf + + ewarn "This revision changes the screen socket location to ${EROOT}/tmp/${PN}" +} diff --git a/app-misc/screen/screen-9999.ebuild b/app-misc/screen/screen-9999.ebuild new file mode 100644 index 000000000000..f6278da36ca4 --- /dev/null +++ b/app-misc/screen/screen-9999.ebuild @@ -0,0 +1,141 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic pam tmpfiles + +DESCRIPTION="screen manager with VT100/ANSI terminal emulation" +HOMEPAGE="https://www.gnu.org/software/screen/" + +if [[ ${PV} != 9999 ]] ; then + SRC_URI="mirror://gnu/${PN}/${P}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris" +else + inherit git-r3 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/screen.git" + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}" # needed for setting S later on + S="${WORKDIR}"/${P}/src +fi + +LICENSE="GPL-3+" +SLOT="0" +IUSE="debug nethack pam selinux utempter multiuser" +# bug #956963 +RESTRICT="test" + +DEPEND=">=sys-libs/ncurses-5.2:= + virtual/libcrypt:= + pam? ( sys-libs/pam )" +RDEPEND="${DEPEND} + acct-group/utmp + selinux? ( sec-policy/selinux-screen ) + utempter? ( sys-libs/libutempter:= )" +BDEPEND="sys-apps/texinfo" + +PATCHES=( + "${FILESDIR}"/${PN}-5.0.0-utmp-musl.patch + "${FILESDIR}"/${PN}-5.0.1-texi.patch +) + +src_prepare() { + default + + # sched.h is a system header and causes problems with some C libraries + mv sched.h _sched.h || die + sed -i '/include/ s:sched.h:_sched.h:' canvas.h sched.c screen.h window.h winmsg.c || die + sed -i 's:sched.h:_sched.h:' Makefile.in || die + + # Fix manpage + sed -i \ + -e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \ + -e "s:/usr/local/screens:${EPREFIX}/tmp/screen:g" \ + -e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \ + -e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \ + -e "s:/local/screens/S\\\-:${EPREFIX}/tmp/screen/S\\\-:g" \ + doc/screen.1 || die + + # reconfigure + eautoreconf +} + +src_configure() { + append-lfs-flags + append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}" + + if [[ ${CHOST} == *-solaris* ]]; then + # enable msg_header by upping the feature standard compatible + # with c99 mode + append-cppflags -D_XOPEN_SOURCE=600 + fi + + use nethack || append-cppflags "-DNONETHACK" + use debug && append-cppflags "-DDEBUG" + + local myeconfargs=( + --enable-socket-dir="${EPREFIX}/tmp/${PN}" + --with-system-screenrc="${EPREFIX}/etc/screenrc" + --with-pty-mode=0620 + --with-pty-group=5 + --enable-telnet + $(use_enable pam) + $(use_enable utempter utmp) + ) + + econf "${myeconfargs[@]}" +} + +src_compile() { + LC_ALL=POSIX emake comm.h term.h + + emake -C doc screen.info + default +} + +src_install() { + local DOCS=( + README ChangeLog INSTALL TODO NEWS* + doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps} + ) + + emake DESTDIR="${D}" SCREEN="${P}" install + + local tmpfiles_perms tmpfiles_group + + if use multiuser || use prefix ; then + fperms 4755 /usr/bin/${P} + tmpfiles_perms="0755" + tmpfiles_group="root" + else + fowners root:utmp /usr/bin/${P} + fperms 2755 /usr/bin/${P} + tmpfiles_perms="0775" + tmpfiles_group="utmp" + fi + + newtmpfiles - screen.conf <<<"d /tmp/screen ${tmpfiles_perms} root ${tmpfiles_group}" + + insinto /usr/share/${PN} + doins terminfo/{screencap,screeninfo.src} + + insinto /etc + doins "${FILESDIR}"/screenrc + + if use pam; then + pamd_mimic_system screen auth + fi + + dodoc "${DOCS[@]}" +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog "Some dangerous key bindings have been removed or changed to more safe values." + elog "We enable some xterm hacks in our default screenrc, which might break some" + elog "applications. Please check /etc/screenrc for information on these changes." + fi + + tmpfiles_process screen.conf + + ewarn "This revision changes the screen socket location to ${EROOT}/tmp/${PN}" +} |
