X-Loop: help-debbugs@HIDDEN Subject: bug#76876: logname output is often wrong when linked with glibc Resent-From: Nicolas Boos <nicolas.boos@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-coreutils@HIDDEN Resent-Date: Sat, 08 Mar 2025 23:08:03 +0000 Resent-Message-ID: <handler.76876.B.174147523321237 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 76876 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 76876 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.174147523321237 (code B ref -1); Sat, 08 Mar 2025 23:08:03 +0000 Received: (at submit) by debbugs.gnu.org; 8 Mar 2025 23:07:13 +0000 Received: from localhost ([127.0.0.1]:57211 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tr3GC-0005WN-BZ for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 18:07:13 -0500 Received: from lists.gnu.org ([2001:470:142::17]:46920) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <nicolas.boos@HIDDEN>) id 1tqxLS-0002k9-8s for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 11:48:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <nicolas.boos@HIDDEN>) id 1tqxLM-00005H-KY for bug-coreutils@HIDDEN; Sat, 08 Mar 2025 11:48:08 -0500 Received: from smtp-13.smtpout.orange.fr ([80.12.242.13] helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <nicolas.boos@HIDDEN>) id 1tqxLK-00081l-98 for bug-coreutils@HIDDEN; Sat, 08 Mar 2025 11:48:08 -0500 Received: from unknown ([83.113.165.223]) by smtp.orange.fr with ESMTPSA id qxL8tT9qdgqdOqxLCtNoaR; Sat, 08 Mar 2025 17:47:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1741452478; bh=jKq84GpjaN5/xYpH61qdJtOs6ljneegwxSVxRb2QnHc=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=qXmVsP5PZKPgKXFvquBfxTUi5J8oLCM7n1bdaFijFaXFWw94nXL02yNLDGk2v6xFI gXel49JCJfG2K7PhO8GKau2vOZcEYV+zIBz19I2bKdu+U7eRjBAiyP6YiB5MuHhBnk l7F2sNKjGyBOuUul2WWvQOnyw8EtuHpMBUHtf4oOUNDh5LilxWtEyhDVrtM+7iXzTp NGnPap/eM/spsn0tVOvEajgEvZ1UNnr+KPDeY5LexNFD+Ae1SS0JwTiWwJ5hnhOqzd iPqkOPzBTOb1mboZTug8eRU/jvKX1Z226uulRMjFtNpn6T0fCMmL3sinQRs1KqGO1b kNFwcMHqdDTng== X-ME-Helo: unknown X-ME-Auth: bmljb2xhcy5ib29zQHdhbmFkb28uZnI= X-ME-Date: Sat, 08 Mar 2025 17:47:58 +0100 X-ME-IP: 83.113.165.223 Date: Sat, 8 Mar 2025 17:46:22 +0100 From: Nicolas Boos <nicolas.boos@HIDDEN> Message-ID: <20250308174622.316f583a@unknown> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=80.12.242.13; envelope-from=nicolas.boos@HIDDEN; helo=smtp.smtpout.orange.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Sat, 08 Mar 2025 18:07:05 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) First test case with logname 9.1 and glibc 2.36: $ echo $LOGNAME nicolas $ logname nicolas $ su --login root $ echo $LOGNAME root $ logname nicolas $ logname (musl) root $ logname (uclibc) root Second test case, with a minimal chroot, no /proc and busybox login: $ echo $LOGNAME nicolas $ logname logname: no login name $ busybox logname logname: getlogin: No such file or directory $ logname (musl) nicolas $ logname (uclibc) nicolas It seems getlogin() is malfunctioning only with glibc. The following patch with "equivalent code" fixes the issue: --- logname.c.orig +++ logname.c @@ -71,7 +71,11 @@ /* POSIX requires using getlogin (or equivalent code) and prohibits using a fallback technique. */ - cp = getlogin (); + #if __GLIBC__ + cp = getenv ("LOGNAME"); + #else + cp = getlogin (); + #endif if (! cp) error (EXIT_FAILURE, 0, _("no login name")); Adding a permanent fix to gnulib/getlogin.c code might be a better solution. NB
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Nicolas Boos <nicolas.boos@HIDDEN> Subject: bug#76876: Acknowledgement (logname output is often wrong when linked with glibc) Message-ID: <handler.76876.B.174147523321237.ack <at> debbugs.gnu.org> References: <20250308174622.316f583a@unknown> X-Gnu-PR-Message: ack 76876 X-Gnu-PR-Package: coreutils Reply-To: 76876 <at> debbugs.gnu.org Date: Sat, 08 Mar 2025 23:08:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 76876 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 76876: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76876 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.