From 2ee6e005d02132d857685ad4e88c0a6e627f8fb3 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Sat, 18 Jan 2025 14:29:30 -0500 Subject: [PATCH] termio: revise macOS-specific .hushlogin note login(1)'s .hushlogin logic was "fixed" in macOS Sonoma 14.4, so this comment (and our workaround) is only relevant for versions earlier than that. The relevant change to login/login.c is part of system_cmds-979.100.8. > login.c: look for .hushlogin in home directory (112854361) - https://github.com/apple-oss-distributions/system_cmds/commit/1bca46ecc5b76432f42eb23ec39fe63e8159f251 - https://github.com/apple-oss-distributions/distribution-macOS/tree/macos-144 --- src/termio/Exec.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 1a3b8cad0..dd1f65305 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -971,12 +971,12 @@ const Subprocess = struct { // which we may not want. If we specify "-l" then we can avoid // this behavior but now the shell isn't a login shell. // - // There is another issue: `login(1)` only checks for ".hushlogin" - // in the working directory. This means that if we specify "-l" - // then we won't get hushlogin honored if its in the home - // directory (which is standard). To get around this, we - // check for hushlogin ourselves and if present specify the - // "-q" flag to login(1). + // There is another issue: `login(1)` on macOS 14.3 and earlier + // checked for ".hushlogin" in the working directory. This means + // that if we specify "-l" then we won't get hushlogin honored + // if its in the home directory (which is standard). To get + // around this, we check for hushlogin ourselves and if present + // specify the "-q" flag to login(1). // // So to get all the behaviors we want, we specify "-l" but // execute "bash" (which is built-in to macOS). We then use