From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 08 18:07:13 2025 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 ) id 1tr3GC-0005WN-BZ for submit@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 ) id 1tqxLS-0002k9-8s for submit@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 ) id 1tqxLM-00005H-KY for bug-coreutils@gnu.org; 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 ) id 1tqxLK-00081l-98 for bug-coreutils@gnu.org; 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 To: bug-coreutils@gnu.org Subject: logname output is often wrong when linked with glibc 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@wanadoo.fr; 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-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 08 Mar 2025 18:07:05 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 08 18:43:03 2025 Received: (at 76876) by debbugs.gnu.org; 8 Mar 2025 23:43:03 +0000 Received: from localhost ([127.0.0.1]:57275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tr3ot-0004rS-D7 for submit@debbugs.gnu.org; Sat, 08 Mar 2025 18:43:03 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:41372) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tr3op-0004qs-M1 for 76876@debbugs.gnu.org; Sat, 08 Mar 2025 18:43:01 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 8FDCE3C010849; Sat, 8 Mar 2025 15:42:53 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id WhuXygswyqhj; Sat, 8 Mar 2025 15:42:53 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 067BB3C01084B; Sat, 8 Mar 2025 15:42:53 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 067BB3C01084B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1741477373; bh=OnDfExojjyJZOcavW5j8kP81MGq6k3jCqIcwY9rB0MI=; h=Message-ID:Date:MIME-Version:To:From; b=AQAOTIC+x2EFL9HSJEWpifzRj8EdUQN2G0MfDKeEslKqkKBsjsX3/fNzoOZxDxTOA 5b9nZqiqgAEFueSU92GU+rRhI1my3abvLuCnpN0kv7IjWdMRshB6J0ujd3A318uHxm VqgOwaO1RdLeilGLPZ2vtj1GizN1IYhr5pK8nd+ad62RTig5sb4F7TA7wZNl7LD5po apgNHMc95ZCCYlA6p3jRxn5katXdKaSjX6hzfcvJz5tZhEId5KyQk1lE2Vh3yMmZmj 8oHkE420ZAkAha0Y0F2mf+OS/ZPIy7nPrab4uiGKxheI0MT1LHqcqq2vWrgL1V5dv7 Uwfl1KRRKXwRQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 1zXOCD8d8kKf; Sat, 8 Mar 2025 15:42:52 -0800 (PST) Received: from [192.168.254.12] (unknown [47.147.225.25]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id D52D73C010849; Sat, 8 Mar 2025 15:42:52 -0800 (PST) Content-Type: multipart/mixed; boundary="------------j7cqxqc96KVsFO7CGWw2Lk8m" Message-ID: <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> Date: Sat, 8 Mar 2025 15:42:51 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#76876: logname output is often wrong when linked with glibc To: Nicolas Boos References: <20250308174622.316f583a@unknown> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <20250308174622.316f583a@unknown> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: Gnulib bugs , 76876@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------j7cqxqc96KVsFO7CGWw2Lk8m Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025-03-08 08:46, Nicolas Boos via GNU coreutils Bug Reports wrote: > It seems getlogin() is malfunctioning only with glibc. It's the other way round: glibc is right (in the sense that it conforms to POSIX) and the other two are wrong. > Adding a permanent fix to gnulib/getlogin.c code might be a better solution. Any such fix should work around the musl bug. (Gnulib doesn't worry about uclibc.) I expect such a patch would be welcome if someone had the time to write and test it. In the meantime I installed the attached to Gnulib, to document the incompatibility, which also occurs with getlogin_r. --------------j7cqxqc96KVsFO7CGWw2Lk8m Content-Type: text/x-patch; charset=UTF-8; name="0001-getlogin-document-musl-bug.patch" Content-Disposition: attachment; filename="0001-getlogin-document-musl-bug.patch" Content-Transfer-Encoding: base64 RnJvbSAyYTYwYzkzOWJlYzMyMGFiZTE4NzM3MzYwYmI5ODQxNTk1ZjVkOGQxIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDggTWFyIDIwMjUgMTU6MzY6MzMgLTA4MDAKU3ViamVjdDogW1BBVENI XSBnZXRsb2dpbjogZG9jdW1lbnQgbXVzbCBidWcKClByb2JsZW0gcmVwb3J0ZWQgYnkgTmlj b2xhcyBCb29zIDxodHRwczovL2J1Z3MuZ251Lm9yZy83Njg3Nj4uCi0tLQogQ2hhbmdlTG9n ICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA1ICsrKysrCiBkb2MvcG9zaXgtZnVuY3Rp b25zL2dldGxvZ2luLnRleGkgICB8IDMgKysrCiBkb2MvcG9zaXgtZnVuY3Rpb25zL2dldGxv Z2luX3IudGV4aSB8IDMgKysrCiAzIGZpbGVzIGNoYW5nZWQsIDExIGluc2VydGlvbnMoKykK CmRpZmYgLS1naXQgYS9DaGFuZ2VMb2cgYi9DaGFuZ2VMb2cKaW5kZXggMzNhMTNiZjQzOC4u ODk5NDBkZGQ0YyAxMDA2NDQKLS0tIGEvQ2hhbmdlTG9nCisrKyBiL0NoYW5nZUxvZwpAQCAt MSwzICsxLDggQEAKKzIwMjUtMDMtMDggIFBhdWwgRWdnZXJ0ICA8ZWdnZXJ0QGNzLnVjbGEu ZWR1PgorCisJZ2V0bG9naW46IGRvY3VtZW50IG11c2wgYnVnCisJUHJvYmxlbSByZXBvcnRl ZCBieSBOaWNvbGFzIEJvb3MgPGh0dHBzOi8vYnVncy5nbnUub3JnLzc2ODc2Pi4KKwogMjAy NS0wMy0wNyAgQnJ1bm8gSGFpYmxlICA8YnJ1bm9AY2xpc3Aub3JnPgogCiAJZ29jb21wLXNj cmlwdDogQXZvaWQgZXJyb3Igb24gbmF0aXZlIFdpbmRvd3MuCmRpZmYgLS1naXQgYS9kb2Mv cG9zaXgtZnVuY3Rpb25zL2dldGxvZ2luLnRleGkgYi9kb2MvcG9zaXgtZnVuY3Rpb25zL2dl dGxvZ2luLnRleGkKaW5kZXggZGRiMGI5YWFlMS4uMGRlMDI2ZjJlZSAxMDA2NDQKLS0tIGEv ZG9jL3Bvc2l4LWZ1bmN0aW9ucy9nZXRsb2dpbi50ZXhpCisrKyBiL2RvYy9wb3NpeC1mdW5j dGlvbnMvZ2V0bG9naW4udGV4aQpAQCAtMjAsNiArMjAsOSBAQCBtaW5ndy4KIFBvcnRhYmls aXR5IHByb2JsZW1zIG5vdCBmaXhlZCBieSBHbnVsaWI6CiBAaXRlbWl6ZQogQGl0ZW0KK1Ro aXMgZnVuY3Rpb24gcmV0dXJucyB0aGUgdmFsdWUgb2YgdGhlIEBlbnZ7TE9HTkFNRX0gZW52 aXJvbm1lbnQgdmFyaWFibGU6CittdXNsIGxpYmMgMS4yLjUuCitAaXRlbQogVGhpcyBmdW5j dGlvbiByZXR1cm5zIGFuIGVtcHR5IHN0cmluZyBldmVuIHdoZW4gc3RhbmRhcmQgaW5wdXQg aXMgYSB0dHkKIG9uIHNvbWUgcGxhdGZvcm1zOgogSFAtVVggMTEuMTEuCmRpZmYgLS1naXQg YS9kb2MvcG9zaXgtZnVuY3Rpb25zL2dldGxvZ2luX3IudGV4aSBiL2RvYy9wb3NpeC1mdW5j dGlvbnMvZ2V0bG9naW5fci50ZXhpCmluZGV4IGY5MmQ2YzI0YjEuLmRhYWZkOWVhYTAgMTAw NjQ0Ci0tLSBhL2RvYy9wb3NpeC1mdW5jdGlvbnMvZ2V0bG9naW5fci50ZXhpCisrKyBiL2Rv Yy9wb3NpeC1mdW5jdGlvbnMvZ2V0bG9naW5fci50ZXhpCkBAIC0yOCw2ICsyOCw5IEBAIFBv cnRhYmlsaXR5IHByb2JsZW1zIG5vdCBmaXhlZCBieSBHbnVsaWI6CiBUaGlzIGZ1bmN0aW9u IGhhcyBhbiBpbmNvbXBhdGlibGUgZGVjbGFyYXRpb24gb24gc29tZSBwbGF0Zm9ybXM6CiBG cmVlQlNEIDEyLjAsIE1pZG5pZ2h0QlNEIDIuMCwgU29sYXJpcyAxMS40ICh3aGVuIEBjb2Rl e19QT1NJWF9QVEhSRUFEX1NFTUFOVElDU30gaXMgbm90IGRlZmluZWQpLgogQGl0ZW0KK1Ro aXMgZnVuY3Rpb24gcmV0dXJucyB0aGUgdmFsdWUgb2YgdGhlIEBlbnZ7TE9HTkFNRX0gZW52 aXJvbm1lbnQgdmFyaWFibGU6CittdXNsIGxpYmMgMS4yLjUuCitAaXRlbQogVGhpcyBmdW5j dGlvbiBmYWlscyBldmVuIHdoZW4gc3RhbmRhcmQgaW5wdXQgaXMgYSB0dHkgb24gc29tZSBw bGF0Zm9ybXM6CiBIUC1VWCAxMS4xMS4KIEBpdGVtCi0tIAoyLjQ1LjIKCg== --------------j7cqxqc96KVsFO7CGWw2Lk8m-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 05:23:11 2025 Received: (at 76876) by debbugs.gnu.org; 9 Mar 2025 09:23:11 +0000 Received: from localhost ([127.0.0.1]:58240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trCsI-0004AT-7C for submit@debbugs.gnu.org; Sun, 09 Mar 2025 05:23:11 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.220]:39725) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trCsE-0004AF-9O for 76876@debbugs.gnu.org; Sun, 09 Mar 2025 05:23:08 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1741512183; cv=none; d=strato.com; s=strato-dkim-0002; b=d5T8FXFGjhHvWb+rAimosd6zhaPTRuFA9Dm1QjkE6caZDqDqlVQGbRGdHluAi6G7eL OmkCHfpaCyUQxTxob8OISgNgV6ZAVVQ76o48wuj3/7faOahTJ4LzKMiDQAMYT48HclGK qIcWJRGofdIX3/9G1OkDYVnMTpanJJYxoquCepqNjDNwVFZWP83vaicqXz3pzGCAXdiv xkBmbaUbcqvCkoVLPEZHd/nuWwSBnC8n8MEev/d8NF+6ZrTV8iK0+HmNBAlxfFO6ZplH 5K70ywHsvE2QC75GcMoIbd8IRZ8V6WTPk7jmJaPDyb/Nesl3jVi+vAHFsW5+/4E5dtxy et7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1741512183; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=rDnrKqMKHb2lC4fk41Cjwxfxj5YMBI+KUxStJugnnT8=; b=qZSF+M0NIGeILfS+Lbkfhn49JfzyVo8PbtCCFbKtS4Ujg2muY4yA6gzbTq8fQRBUPw s6fl1tWdtp4mv3FxsWUIUHy5bvYvk90enDxrZOR0cknucEInTsEvX7SRISaIUTzircGY m3ZhgtCoaFQDmHGihrObPRqjW5KkH1uFF2FJBrE16gsm7qm/S7Ebpua5YjPhGA1HDor2 851Rh71glJNwHbnz46zSRVo6/d0hhdNXWoFFhP/cPeiRCsOAXZzu6PUPkTc/sGAOQl95 ArXW16z1ZZfz9X+S6qrzPaRvVs5BQeyk5MhweOngmr8iwmIBe6dIhiWxddiwCHivmHKX IIWQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1741512183; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=rDnrKqMKHb2lC4fk41Cjwxfxj5YMBI+KUxStJugnnT8=; b=sIp1DzfX2PpB3C20TIZzO7+WkAFGXIrmcoUzWlPpFAbvgYNuslhbySmaJN7CdXonvy raIv9JbPA81KvftGVoBqEg89QMztuhNTva8ZM4VBmCgHeERLfTbTg4sqRAmKLVNC5qLY H7m8giBdd5EjSX9KCeAOz7J6WR2pvWDFHEC5I4L9l9KCEh53ZFHhg/pa7h++dCeOTmfd zB4G8lnot/CUqzChzMmnBZaGjwKZxTEAR362KiYjz+E6NJs0os9zbvHAtYTvshDcPF2D r4DuNYUCFjzYQ5o7+G7KzQJBbGCzZxHxtpbf6EDyrOWCPeSncag2OW0J7ddlK7HZIxwJ 9rJg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1741512183; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=rDnrKqMKHb2lC4fk41Cjwxfxj5YMBI+KUxStJugnnT8=; b=9Ewfd2IEMVRal7IS6hzkeXOJXtpj1rNqu7aWhCqxM/KPuQrD11tvaQzu8n9Ad1zBzQ IOCwDV2td/5KGgsWUuAw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqj+dF29GflCDcBORH61+tuzCGxT7" Received: from nimes.localnet by smtp.strato.de (RZmta 51.3.0 AUTH) with ESMTPSA id N7dcf81299N2HUj (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 9 Mar 2025 10:23:02 +0100 (CET) From: Bruno Haible To: Nicolas Boos , bug-gnulib@gnu.org, Paul Eggert Subject: Re: bug#76876: logname output is often wrong when linked with glibc Date: Sun, 09 Mar 2025 10:23:02 +0100 Message-ID: <8799255.t5eZAygCvR@nimes> Organization: GNU In-Reply-To: <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> References: <20250308174622.316f583a@unknown> <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart13825264.RPfkvVQGbb" Content-Transfer-Encoding: 7Bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: 76876@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart13825264.RPfkvVQGbb Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Paul Eggert wrote: > In the meantime I installed the attached to Gnulib, to > document the incompatibility, which also occurs with getlogin_r. These two patches actually work around the bugs. With this, coreutils should be fine, since it already imports the 'getlogin' module from gnulib. 2025-03-09 Bruno Haible getlogin_r: Work around musl bug. * lib/getlogin_r.c (getlogin_r): Add implementation for Linux. * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test whether getlogin_r has the musl bug. * tests/test-getlogin_r.c (main): Add another test. * doc/posix-functions/getlogin_r.texi: Mention the workaround. 2025-03-09 Bruno Haible getlogin: Work around musl bug. * lib/unistd.in.h (getlogin): Consider REPLACE_GETLOGIN. * lib/getlogin.c: Change license header to GPL. (getlogin): Add implementation for Linux. * m4/getlogin.m4 (gl_FUNC_GETLOGIN): Test whether getlogin works. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETLOGIN. * modules/unistd-h (Makefile.am): Substitute REPLACE_GETLOGIN. * modules/getlogin (Depends-on): Add readutmp. (configure.ac): Consider REPLACE_GETLOGIN. (License): Change to GPL. * tests/test-getlogin.c (main): Add another test. * doc/posix-functions/getlogin.texi: Mention the workaround. --nextPart13825264.RPfkvVQGbb Content-Disposition: attachment; filename="0001-getlogin-Work-around-musl-bug.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-getlogin-Work-around-musl-bug.patch" >From 90840606e77dd24d87ad7f075d8f87c0ed814ef5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 9 Mar 2025 10:16:58 +0100 Subject: [PATCH 1/2] getlogin: Work around musl bug. * lib/unistd.in.h (getlogin): Consider REPLACE_GETLOGIN. * lib/getlogin.c: Change license header to GPL. (getlogin): Add implementation for Linux. * m4/getlogin.m4 (gl_FUNC_GETLOGIN): Test whether getlogin works. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETLOGIN. * modules/unistd-h (Makefile.am): Substitute REPLACE_GETLOGIN. * modules/getlogin (Depends-on): Add readutmp. (configure.ac): Consider REPLACE_GETLOGIN. (License): Change to GPL. * tests/test-getlogin.c (main): Add another test. * doc/posix-functions/getlogin.texi: Mention the workaround. --- ChangeLog | 15 +++++ doc/posix-functions/getlogin.texi | 6 +- lib/getlogin.c | 99 +++++++++++++++++++++++++++++-- lib/unistd.in.h | 14 ++++- m4/getlogin.m4 | 49 ++++++++++++++- m4/unistd_h.m4 | 3 +- modules/getlogin | 6 +- modules/unistd-h | 1 + tests/test-getlogin.c | 6 ++ 9 files changed, 184 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89940ddd4c..6d2ad66c83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2025-03-09 Bruno Haible + + getlogin: Work around musl bug. + * lib/unistd.in.h (getlogin): Consider REPLACE_GETLOGIN. + * lib/getlogin.c: Change license header to GPL. + (getlogin): Add implementation for Linux. + * m4/getlogin.m4 (gl_FUNC_GETLOGIN): Test whether getlogin works. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETLOGIN. + * modules/unistd-h (Makefile.am): Substitute REPLACE_GETLOGIN. + * modules/getlogin (Depends-on): Add readutmp. + (configure.ac): Consider REPLACE_GETLOGIN. + (License): Change to GPL. + * tests/test-getlogin.c (main): Add another test. + * doc/posix-functions/getlogin.texi: Mention the workaround. + 2025-03-08 Paul Eggert getlogin: document musl bug diff --git a/doc/posix-functions/getlogin.texi b/doc/posix-functions/getlogin.texi index 0de026f2ee..0ccce336ce 100644 --- a/doc/posix-functions/getlogin.texi +++ b/doc/posix-functions/getlogin.texi @@ -15,14 +15,14 @@ @item This function is not declared unless @code{_POSIX} is defined on some platforms: mingw. +@item +This function returns the value of the @env{LOGNAME} environment variable: +musl libc 1.2.5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function returns the value of the @env{LOGNAME} environment variable: -musl libc 1.2.5. -@item This function returns an empty string even when standard input is a tty on some platforms: HP-UX 11.11. diff --git a/lib/getlogin.c b/lib/getlogin.c index 72c25acbc7..4772111567 100644 --- a/lib/getlogin.c +++ b/lib/getlogin.c @@ -3,19 +3,19 @@ Copyright (C) 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. + it under the terms of the GNU General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public License + You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* Written by Bruno Haible, 2010. */ +/* Written by Bruno Haible, 2010, 2025. */ #include @@ -30,15 +30,102 @@ # define GetUserName GetUserNameA #endif +#if defined __linux__ || defined __ANDROID__ +# include +# include +# include +# include +# include +# include "readutmp.h" +#endif + char * getlogin (void) { #if defined _WIN32 && ! defined __CYGWIN__ + /* Native Windows platform. */ static char login_name[1024]; DWORD sz = sizeof (login_name); if (GetUserName (login_name, &sz)) return login_name; +#elif defined __linux__ || defined __ANDROID__ + /* Linux. */ + { + /* Read the login uid from the /proc file system. */ + int fd = open ("/proc/self/loginuid", O_RDONLY); + if (fd >= 0) + { + char buf[20 + 1]; + int n = read (fd, buf, sizeof (buf) - 1); + if (n > 0) + { + buf[n] = '\0'; + char *endptr; + unsigned long uid = strtoul (buf, &endptr, 10); + if (endptr == buf + n && uid != (uid_t) -1) + { + /* Convert the uid to a user name. */ + struct passwd *p = getpwuid (uid); + if (p != NULL && strlen (p->pw_name) < 64) + { + static char resultbuf[64]; + strcpy (resultbuf, p->pw_name); + close (fd); + return resultbuf; + } + } + } + close (fd); + } + } + { + /* Find the tty connected to the current process. */ + char *tty = ttyname (STDIN_FILENO); + if (tty != NULL) + { + /* Try to see to which user it is allocated, via utmp. */ + if (strncmp (tty, "/dev/tty", 8) == 0) + { + idx_t n; + STRUCT_UTMP *entries; + if (read_utmp (UTMP_FILE, &n, &entries, READ_UTMP_USER_PROCESS) + == 0) + { + idx_t i; + for (i = 0; i < n; i++) + if (strcmp (entries[i].ut_line, tty + 5) == 0) + { + if (strlen (entries[i].ut_user) < 64) + { + static char resultbuf[64]; + strcpy (resultbuf, entries[i].ut_user); + free (entries); + return resultbuf; + } + break; + } + free (entries); + } + } + /* Fallback for systems which don't maintain an utmp database + or for ttys that are not recorded in that the utmp database: + Look at the owner of that tty. */ + struct stat statbuf; + if (stat (tty, &statbuf) >= 0) + { + uid_t uid = statbuf.st_uid; + /* Convert the uid to a user name. */ + struct passwd *p = getpwuid (uid); + if (p != NULL && strlen (p->pw_name) < 64) + { + static char resultbuf[64]; + strcpy (resultbuf, p->pw_name); + return resultbuf; + } + } + } + } #endif return NULL; } diff --git a/lib/unistd.in.h b/lib/unistd.in.h index acabdf8c68..bfb4817726 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1365,11 +1365,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ -# if !@HAVE_DECL_GETLOGIN@ +# if @REPLACE_GETLOGIN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getlogin rpl_getlogin +# endif +_GL_FUNCDECL_RPL (getlogin, char *, (void), ); +_GL_CXXALIAS_RPL (getlogin, char *, (void)); +# else +# if !@HAVE_DECL_GETLOGIN@ _GL_FUNCDECL_SYS (getlogin, char *, (void), ); -# endif +# endif _GL_CXXALIAS_SYS (getlogin, char *, (void)); +# endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (getlogin); +# endif #elif defined GNULIB_POSIXCHECK # undef getlogin # if HAVE_RAW_DECL_GETLOGIN diff --git a/m4/getlogin.m4 b/m4/getlogin.m4 index e876fad5ea..7f1f07319d 100644 --- a/m4/getlogin.m4 +++ b/m4/getlogin.m4 @@ -1,5 +1,5 @@ # getlogin.m4 -# serial 7 +# serial 8 dnl Copyright (C) 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,6 +16,53 @@ AC_DEFUN([gl_FUNC_GETLOGIN] AC_CHECK_FUNCS_ONCE([getlogin]) if test $ac_cv_func_getlogin = no; then HAVE_GETLOGIN=0 + else + dnl On musl libc, getlogin returns getenv ("LOGNAME"). + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether getlogin works], + [gl_cv_func_getlogin_works], + [ + dnl Initial guess, used when cross-compiling. +changequote(,)dnl + case "$host_os" in + # Guess no on musl libc. + *-musl* | midipix*) gl_cv_func_getlogin_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_getlogin_works="guessing yes" ;; + esac +changequote([,])dnl + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#if !HAVE_DECL_GETLOGIN +extern +# ifdef __cplusplus +"C" +# endif +char *getlogin (void); +#endif +int +main (void) +{ + int result = 0; + char *buf; + + putenv ("LOGNAME=ygvfibmslhkmvoetbrcegzwydorcke"); + buf = getlogin (); + if (buf != NULL && strcmp (buf, "ygvfibmslhkmvoetbrcegzwydorcke") == 0) + result |= 1; + return result; +}]])], + [gl_cv_func_getlogin_works=yes], + [gl_cv_func_getlogin_works=no], + [:]) + ]) + case "$gl_cv_func_getlogin_works" in + *yes) ;; + *) REPLACE_GETLOGIN=1 ;; + esac fi ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 2c08d65e0d..6ec16286ef 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,5 +1,5 @@ # unistd_h.m4 -# serial 96 +# serial 97 dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -244,6 +244,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS] REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) + REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN]) REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) diff --git a/modules/getlogin b/modules/getlogin index 8725a7031e..7acee58a81 100644 --- a/modules/getlogin +++ b/modules/getlogin @@ -7,10 +7,12 @@ m4/getlogin.m4 Depends-on: unistd-h +readutmp [test $HAVE_GETLOGIN = 0 || test $REPLACE_GETLOGIN = 1] configure.ac: gl_FUNC_GETLOGIN -gl_CONDITIONAL([GL_COND_OBJ_GETLOGIN], [test $HAVE_GETLOGIN = 0]) +gl_CONDITIONAL([GL_COND_OBJ_GETLOGIN], + [test $HAVE_GETLOGIN = 0 || test $REPLACE_GETLOGIN = 1]) gl_UNISTD_MODULE_INDICATOR([getlogin]) AC_REQUIRE([gl_LIB_GETLOGIN]) @@ -26,7 +28,7 @@ Link: $(GETLOGIN_LIB) License: -LGPLv2+ +GPL Maintainer: all diff --git a/modules/unistd-h b/modules/unistd-h index 1a7376efdb..0fdb6368b3 100644 --- a/modules/unistd-h +++ b/modules/unistd-h @@ -201,6 +201,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ + -e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c index 1b980a152d..431844bd71 100644 --- a/tests/test-getlogin.c +++ b/tests/test-getlogin.c @@ -41,5 +41,11 @@ main (void) #endif test_getlogin_result (buf, err); + /* Check that getlogin() does not merely return getenv ("LOGNAME"). */ + putenv ("LOGNAME=ygvfibmslhkmvoetbrcegzwydorcke"); + buf = getlogin (); + ASSERT (!(buf != NULL + && strcmp (buf, "ygvfibmslhkmvoetbrcegzwydorcke") == 0)); + return test_exit_status; } -- 2.43.0 --nextPart13825264.RPfkvVQGbb Content-Disposition: attachment; filename="0002-getlogin_r-Work-around-musl-bug.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0002-getlogin_r-Work-around-musl-bug.patch" >From 0bca572030d26721cb81800ff4264b6f18dc7e40 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 9 Mar 2025 10:19:20 +0100 Subject: [PATCH 2/2] getlogin_r: Work around musl bug. * lib/getlogin_r.c (getlogin_r): Add implementation for Linux. * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test whether getlogin_r has the musl bug. * tests/test-getlogin_r.c (main): Add another test. * doc/posix-functions/getlogin_r.texi: Mention the workaround. --- ChangeLog | 9 ++++ doc/posix-functions/getlogin_r.texi | 6 +-- lib/getlogin_r.c | 74 +++++++++++++++++++++++++++++ m4/getlogin_r.m4 | 20 +++++--- tests/test-getlogin_r.c | 5 ++ 5 files changed, 105 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d2ad66c83..d8eb0e8df7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-03-09 Bruno Haible + + getlogin_r: Work around musl bug. + * lib/getlogin_r.c (getlogin_r): Add implementation for Linux. + * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test whether getlogin_r has the + musl bug. + * tests/test-getlogin_r.c (main): Add another test. + * doc/posix-functions/getlogin_r.texi: Mention the workaround. + 2025-03-09 Bruno Haible getlogin: Work around musl bug. diff --git a/doc/posix-functions/getlogin_r.texi b/doc/posix-functions/getlogin_r.texi index daafd9eaa0..df145ecfe2 100644 --- a/doc/posix-functions/getlogin_r.texi +++ b/doc/posix-functions/getlogin_r.texi @@ -20,6 +20,9 @@ This function returns a truncated result, instead of failing with error code @code{ERANGE}, when the buffer is not large enough, on some platforms: macOS 14. +@item +This function returns the value of the @env{LOGNAME} environment variable: +musl libc 1.2.5. @end itemize Portability problems not fixed by Gnulib: @@ -28,9 +31,6 @@ This function has an incompatible declaration on some platforms: FreeBSD 12.0, MidnightBSD 2.0, Solaris 11.4 (when @code{_POSIX_PTHREAD_SEMANTICS} is not defined). @item -This function returns the value of the @env{LOGNAME} environment variable: -musl libc 1.2.5. -@item This function fails even when standard input is a tty on some platforms: HP-UX 11.11. @item diff --git a/lib/getlogin_r.c b/lib/getlogin_r.c index 6a13e8e405..ade819940e 100644 --- a/lib/getlogin_r.c +++ b/lib/getlogin_r.c @@ -39,6 +39,14 @@ extern char *getlogin (void); # endif #endif +#if defined __linux__ || defined __ANDROID__ +# include +# include +# include +# include +# include +#endif + /* See unistd.in.h for documentation. */ int getlogin_r (char *name, size_t size) @@ -64,6 +72,72 @@ getlogin_r (char *name, size_t size) return ENOENT; } return 0; +#elif defined __linux__ || defined __ANDROID__ + /* Linux. */ + { + /* Read the login uid from the /proc file system. */ + int fd = open ("/proc/self/loginuid", O_RDONLY); + if (fd >= 0) + { + char buf[20 + 1]; + int n = read (fd, buf, sizeof (buf) - 1); + if (n > 0) + { + buf[n] = '\0'; + char *endptr; + unsigned long uid = strtoul (buf, &endptr, 10); + if (endptr == buf + n && uid != (uid_t) -1) + { + /* Convert the uid to a user name. */ + struct passwd pbuf1; + char pbuf2[1024]; + struct passwd *p; + if (getpwuid_r (uid, &pbuf1, pbuf2, sizeof (pbuf2), &p) == 0) + { + if (strlen (p->pw_name) < size) + { + strcpy (name, p->pw_name); + close (fd); + return 0; + } + return ERANGE; + } + } + } + close (fd); + } + } + { + /* Find the tty connected to the current process. */ + char tty[1024]; + if (ttyname_r (STDIN_FILENO, tty, sizeof (tty)) == 0) + { + /* We cannot use read_utmp here, since it is not multithread-safe. */ + /* Fallback for systems which don't maintain an utmp database + or for ttys that are not recorded in that the utmp database: + Look at the owner of that tty. */ + struct stat statbuf; + if (stat (tty, &statbuf) >= 0) + { + uid_t uid = statbuf.st_uid; + /* Convert the uid to a user name. */ + struct passwd pbuf1; + char pbuf2[1024]; + struct passwd *p; + if (getpwuid_r (uid, &pbuf1, pbuf2, sizeof (pbuf2), &p) == 0) + { + if (strlen (p->pw_name) < size) + { + strcpy (name, p->pw_name); + return 0; + } + return ERANGE; + } + } + } + } + /* ENOENT is a reasonable errno value if getlogin returns NULL. */ + return ENOENT; #elif HAVE_GETLOGIN_R /* Platform with a getlogin_r() function. */ int ret = getlogin_r (name, size); diff --git a/m4/getlogin_r.m4 b/m4/getlogin_r.m4 index 26664e1fda..5ac8a89ff8 100644 --- a/m4/getlogin_r.m4 +++ b/m4/getlogin_r.m4 @@ -1,5 +1,5 @@ # getlogin_r.m4 -# serial 15 +# serial 16 dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -35,22 +35,26 @@ AC_DEFUN([gl_FUNC_GETLOGIN_R] HAVE_GETLOGIN_R=1 dnl On Mac OS X 10.13 and OSF/1 5.1, getlogin_r returns a truncated result dnl if the buffer is not large enough. + dnl On musl libc, getlogin_r returns getenv ("LOGNAME"). AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CACHE_CHECK([whether getlogin_r works with small buffers], + AC_CACHE_CHECK([whether getlogin_r works], [gl_cv_func_getlogin_r_works], [ dnl Initial guess, used when cross-compiling. changequote(,)dnl case "$host_os" in - # Guess no on Mac OS X, OSF/1. - darwin* | osf*) gl_cv_func_getlogin_r_works="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_getlogin_r_works="guessing yes" ;; + # Guess no on Mac OS X, OSF/1. + darwin* | osf*) gl_cv_func_getlogin_r_works="guessing no" ;; + # Guess no on musl libc. + *-musl* | midipix*) gl_cv_func_getlogin_r_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_getlogin_r_works="guessing yes" ;; esac changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include +#include #include #include #if !HAVE_DECL_GETLOGIN_R @@ -76,6 +80,10 @@ AC_DEFUN([gl_FUNC_GETLOGIN_R] if (getlogin_r (buf, n) == 0) result |= 4; } + putenv ("LOGNAME=ygvfibmslhkmvoetbrcegzwydorcke"); + if (getlogin_r (buf, 100) == 0 + && strcmp (buf, "ygvfibmslhkmvoetbrcegzwydorcke") == 0) + result |= 8; return result; }]])], [gl_cv_func_getlogin_r_works=yes], diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c index 4deddfbb01..3674195e55 100644 --- a/tests/test-getlogin_r.c +++ b/tests/test-getlogin_r.c @@ -68,5 +68,10 @@ main (void) ASSERT (strcmp (hugebuf, buf) == 0); } + /* Check that getlogin_r() does not merely return getenv ("LOGNAME"). */ + putenv ("LOGNAME=ygvfibmslhkmvoetbrcegzwydorcke"); + err = getlogin_r (buf, sizeof buf); + ASSERT (!(err == 0 && strcmp (buf, "ygvfibmslhkmvoetbrcegzwydorcke") == 0)); + return test_exit_status; } -- 2.43.0 --nextPart13825264.RPfkvVQGbb-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 07:08:45 2025 Received: (at 76876) by debbugs.gnu.org; 9 Mar 2025 11:08:46 +0000 Received: from localhost ([127.0.0.1]:58600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trEWT-0003nb-L5 for submit@debbugs.gnu.org; Sun, 09 Mar 2025 07:08:45 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.22]:45603) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trEWQ-0003nP-4S for 76876@debbugs.gnu.org; Sun, 09 Mar 2025 07:08:43 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1741518519; cv=none; d=strato.com; s=strato-dkim-0002; b=Dvt9H/+YRbtmKCUUxEGxGGfJjUMM0+A+MWOMA5Ujyz4gC6TzZH/0pVdNf6spwCqIMa UXs6+SpS1pxXg0CXgIY8wNhrhoXThvJHD3b+KZB6BCTX/AuhMYh620/8w8s50EJTk7qB EHqSqap2fg95UJ6xlOivzDlWeZsVPSn4Ps+um64ftPVWt4VBRktoU7DLXw3yCPAH9Eyw b7yC8lCpWDGvqDpcyhP4PBz53geof+HeaxUkTBpC6MDsc9eQ430OuuTvR2QPuywLOISI TwEtapLjzD75VrD2aemtz2oeCAtmwV+KyoGNWL6eWQC9MXeilzs+XWYsv4tpvovZeELS +ZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1741518519; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=YIUKJpXCElSG5oyVM4pOHieedXAgAr5oHqqhdXBj6H0=; b=DaXOfq/CIZa0EGCybUaC+tKFlTnoVzUs6v0g18M24INroxOC5ZwkkL3I7p++4fjMhv VIbxArD+UbREGpjIgC9I5TbU5wd3LDQw89I/v8AzJFkwHm+oYulQcgDYMffiP5cyGjYh eZvSBucM9bueaag8sTht10Mq678crHOCKOhxS+/a8/XQKuYe9Ytphx+90NAFlm+rC1Hf nicWNgBU79ct6bWl0kqclV44SaojMYKRC3jCJOw6jJmDcRey5BgF0la4WtRoEgekBgdo 3J+MzJwwYXvxk3immog0mg5x/OLvUQDPvf2HE6WflWHBUgPz6hL3h5HQfhKueanruvq7 yIbw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1741518519; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=YIUKJpXCElSG5oyVM4pOHieedXAgAr5oHqqhdXBj6H0=; b=BZPiaPBaFX+PtFcht/QSltyi/KtZg9bakRlgevGGK0EcumfMUVPvdUW6CUFBqYyIYQ XNALU4t5hlCW8YaVHhAD7TmGP7fertnr/IDcmBZcIVjsn8q1vLXUv97OrzPRAPOrH1mJ ZUdXv8n9BGZCXayKeplNr2tMPuNR9t2stBWsfh/bAsNte+ApoNfAkmo3u3HL0Y2R0lbg uAJcnXUWuR4xryOqYwgL6Z3+o2FaNqIck6jnUb/firGfJDpRKV1HHuDPCxFS1lQQCTpP r0/xPjQe95dAlQ5mVAvX7et2tZ/qVdqXlr+rCEs5LHcp63qeQLDCeilMdW8ewHlbNlRN elJw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1741518519; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=YIUKJpXCElSG5oyVM4pOHieedXAgAr5oHqqhdXBj6H0=; b=TK1g8Jqtgl+AQgutJMjnSPUIY9U17K+tkwaZ0HW4+p1cjTJnrvWOYPpElcIHTumuyQ dPFqrQZTPJwRP3mHcLCg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqj+dF29GflCDcBORH61+tuzCGxT7" Received: from nimes.localnet by smtp.strato.de (RZmta 51.3.0 AUTH) with ESMTPSA id N7dcf8129B8cHew (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 9 Mar 2025 12:08:38 +0100 (CET) From: Bruno Haible To: Nicolas Boos , bug-gnulib@gnu.org, Paul Eggert Subject: Re: bug#76876: logname output is often wrong when linked with glibc Date: Sun, 09 Mar 2025 12:08:38 +0100 Message-ID: <2003186.Clq8ysSdAP@nimes> Organization: GNU In-Reply-To: <8799255.t5eZAygCvR@nimes> References: <20250308174622.316f583a@unknown> <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> <8799255.t5eZAygCvR@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: 76876@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I wrote: > With this, coreutils should be fine, since it already imports the 'getlog= in' > module from gnulib. Verified by comparing coreutils-9.5 with coreutils-HEAD on Alpine Linux 3.2= 0: With coreutils-9.5: $ logname bruno $ su - Password: # logname root Now: $ logname bruno $ su - Password: # logname bruno Paul, P=E1draig: How about adding a coreutils/NEWS entry for this bug fix? Bruno From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 08:49:01 2025 Received: (at 76876-done) by debbugs.gnu.org; 9 Mar 2025 12:49:02 +0000 Received: from localhost ([127.0.0.1]:58778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trG5V-0000jU-E0 for submit@debbugs.gnu.org; Sun, 09 Mar 2025 08:49:01 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:51374) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1trG5S-0000jA-Jy for 76876-done@debbugs.gnu.org; Sun, 09 Mar 2025 08:48:59 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-abf615d5f31so650646766b.2 for <76876-done@debbugs.gnu.org>; Sun, 09 Mar 2025 05:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741524532; x=1742129332; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=hspOq2CIwb0LGWQZGvu9RnB2Ka/gYnhnUhNIcSlrQB8=; b=e4WWK16/vAKbV9rjAHZNY8k+5KOj5JElJyt3Cbyn5qKQHLBk8kRazXZXY8l2w6fp34 r3O51gShi44XkGiBfJqeygwz+QuMGv3SeLlGRWtqSqYsSKCMQQVp23VNZNhpnEXZrDux aHM2TA8Smc1Z4M3TQcXHy1FXBRGbmBVGniE+/UARzu9u5tTY6qCP4kUHDWVjkgD1llus +kLJ8UEU6P9jzESohV0ndd0Ua1TJKeyFt9b9wKcW5a4aau4caZt2MEQRTpkI2kOrTn4q aWDet5y+mkLkkT1nZF2S7V8XN5nSjDTG6Zf5LBJ7EGUyL9Jwombe0tsLif60GLPSD2jC i/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741524532; x=1742129332; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hspOq2CIwb0LGWQZGvu9RnB2Ka/gYnhnUhNIcSlrQB8=; b=j8txlwxWy9kWPixDth/JlhbD2u+WzbuNIz6VQqRYdljwdX5dWZhzyFFQSR9ZfMhG7I C2XJcIs2sIaXIOK4RCHY6X8RElGpC6qIxFhm2DXx1bY+rU9+T4CQX6DWiCSRBb8i6Q2T nuR9yOKvyrkj+yCZsiYuvE0E+4Yc5J3RJILZbYMIX2NbsliKlrUXXx0eSqBkbgHac9Gq lQjHTGkhuwgJwdF5Pji3NyNjMETtCQp4XHmo7sWC3J9NJiMJewLIr/ftf1E4EGxu3M+h mgup682fNEkt71Vgre6iR70f/naR66SHbM8tMiKt1miwc081RjyTq8PJNqevlolrMi7X Ox/Q== X-Gm-Message-State: AOJu0YyrHd306LmSNEQrQSEBPm8JrNVmmeggZJPZ4puN3TAV/8pK0Xv+ 8M94tvF5/f5q96nBDtsreQnYlcN8+SHffLFNrCouXOzDAdC0m1s8 X-Gm-Gg: ASbGncuRd0J56kY4kXZUYBQXVix25sErqUNR6B1VEOqvV8PLzXO4zXFtnevOHALFpqY +W+jNm8fSSE6rS9mfd7RZYKl39iYDyJYv51NP5B3We/YuHAq84/mCxmTGR739uVyZtwMLzxP8Zw U4NsXBO+EI9cvENlC7qa8RlyeI8xIxO1FE+vMbjZWl6A3fcZfWKOg/jer4bJeg/a16IqZCHIXVJ p5LTSTxuWR2B6VBj5j7PHRfXq44XBP5h8+hPiELoMhUIxxOx11RSBZgqYHm+tVVmAhTMveHHwdp DJxVxJZ0OoEn6zB2TrWv7d5NruWDCsYvF5zdxZsEiQEABBu13sH06bauwDT09ZsEadPxv9jShQr hr8KNQU+55Nhi8Mnv+YfCa4hi X-Google-Smtp-Source: AGHT+IF7TkbKMC1433JhMq7Q3Vc9taO0JO0LhQi5OwF7y9ZokMtBk7AFqQxRTebbwhgXKSNYCZbl1A== X-Received: by 2002:a17:906:1d14:b0:ac2:7fd5:774 with SMTP id a640c23a62f3a-ac27fd52434mr388364966b.56.1741524532093; Sun, 09 Mar 2025 05:48:52 -0700 (PDT) Received: from [192.168.1.31] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id a640c23a62f3a-ac27c7e29bbsm229489166b.92.2025.03.09.05.48.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Mar 2025 05:48:51 -0700 (PDT) Message-ID: Date: Sun, 9 Mar 2025 12:48:49 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#76876: logname output is often wrong when linked with glibc To: Bruno Haible , Nicolas Boos , bug-gnulib@gnu.org, Paul Eggert References: <20250308174622.316f583a@unknown> <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> <8799255.t5eZAygCvR@nimes> <2003186.Clq8ysSdAP@nimes> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: <2003186.Clq8ysSdAP@nimes> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876-done Cc: 76876-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 09/03/2025 11:08, Bruno Haible via Gnulib discussion list wrote: > I wrote: >> With this, coreutils should be fine, since it already imports the 'getlogin' >> module from gnulib. > > Verified by comparing coreutils-9.5 with coreutils-HEAD on Alpine Linux 3.20: > > With coreutils-9.5: > > $ logname > bruno > $ su - > Password: > # logname > root > > Now: > > $ logname > bruno > $ su - > Password: > # logname > bruno > > Paul, Pádraig: How about adding a coreutils/NEWS entry for this bug fix? I pushed an update to coreutils NEWS mentioning the fix. Marking this as done. thanks! Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 09:45:25 2025 Received: (at submit) by debbugs.gnu.org; 9 Mar 2025 13:45:25 +0000 Received: from localhost ([127.0.0.1]:58844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trGy4-0003UE-UY for submit@debbugs.gnu.org; Sun, 09 Mar 2025 09:45:25 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60158) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trGy3-0003Tn-5f for submit@debbugs.gnu.org; Sun, 09 Mar 2025 09:45:23 -0400 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 ) id 1trGxu-0005qE-7s; Sun, 09 Mar 2025 09:45:14 -0400 Received: from smtp-81.smtpout.orange.fr ([80.12.242.81] 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 ) id 1trGxr-00013L-Uh; Sun, 09 Mar 2025 09:45:13 -0400 Received: from unknown ([83.113.165.223]) by smtp.orange.fr with ESMTPSA id rGxjt49EeDuRtrGxmtI6IW; Sun, 09 Mar 2025 14:45:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1741527908; bh=iblqH7UaGUJ6PLxHRRFsy/s+OSPRyCtFAtZvsxMkoyI=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=le/OmUOmxHEzursgzZ1AoZZwdvBe3tZE0ryI2H9WDgo/4j1q3Nrpw1/naI11KUMAa 4e3ZVMhv9XROOyM2wOQ9JXULXPaHM9xqyvYpVawbtepexgeEriSvkDXQPksj9AFWMm 5ZXzEuRN5lrtvJ5DFUezYoSvx3WFzPq/qp68bB3Oi8uz98rzJKur0J6nfUgyhElQt+ IgS3zy0egVmVXtTZu4+dtowkbrhHuXw8T/BXRPKidb6lZGQD3ol+031c1AOKRt4Aq6 7Al/YB+EnRu/2NAI2PH19bVKcRpo7aLBvq+mtAs6DnloTRnii2vEwC75eUU4/j3sid tVfZj67RHBiHQ== X-ME-Helo: unknown X-ME-Auth: bmljb2xhcy5ib29zQHdhbmFkb28uZnI= X-ME-Date: Sun, 09 Mar 2025 14:45:08 +0100 X-ME-IP: 83.113.165.223 Date: Sun, 9 Mar 2025 14:43:29 +0100 From: Nicolas Boos To: Bruno Haible via GNU coreutils Bug Reports Subject: bug#76876: logname output is often wrong when linked with glibc Message-ID: <20250309144329.7422e738@unknown> In-Reply-To: <2003186.Clq8ysSdAP@nimes> References: <20250308174622.316f583a@unknown> <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> <8799255.t5eZAygCvR@nimes> <2003186.Clq8ysSdAP@nimes> 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=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=80.12.242.81; envelope-from=nicolas.boos@wanadoo.fr; 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_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-Debbugs-Envelope-To: submit Cc: bug-gnulib@gnu.org, Paul Eggert , Bruno Haible , 76876@debbugs.gnu.org, Rich Felker X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This page says that the result of the logname command and the LOGNAME variable must be the same: https://www.ibm.com/docs/en/aix/7.3?topic=3Dl-logname-command Thus, getlogin() implementations that use the LOGNAME or login_name variables such as musl, uclibc or even gnulib WIN32 seems fine. What to believe? Anyway, using a UID to get a login name like glibc's getlogin() function does, we sometimes get incorrect results. Here is a third test case, allowed by posix: $ cat /etc/passwd nicolas:x:1000:2001::/home/nicolas:/bin/bash claude:x:1000:2002::/home/claude:/bin/zsh localhost login: claude Password: $ echo $LOGNAME claude $ logname (glibc) nicolas $ logname (musl) claude $ logname (uclibc) claude I'm not really convinced that these fixes make things better. NB > I wrote: > > With this, coreutils should be fine, since it already imports the 'getl= ogin' > > module from gnulib. >=20 > Verified by comparing coreutils-9.5 with coreutils-HEAD on Alpine Linux 3= .20: >=20 > With coreutils-9.5: >=20 > $ logname > bruno > $ su - > Password: > # logname > root >=20 > Now: >=20 > $ logname > bruno > $ su - > Password: > # logname > bruno >=20 > Paul, P=C3=A1draig: How about adding a coreutils/NEWS entry for this bug = fix? >=20 > Bruno >=20 >=20 >=20 >=20 >=20 >=20 From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 12:04:19 2025 Received: (at 76876) by debbugs.gnu.org; 9 Mar 2025 16:04:19 +0000 Received: from localhost ([127.0.0.1]:33906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trJ8V-0002GD-5R for submit@debbugs.gnu.org; Sun, 09 Mar 2025 12:04:19 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:33227) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trJ8T-0002G0-0W for 76876@debbugs.gnu.org; Sun, 09 Mar 2025 12:04:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-voelker.de; s=s1-ionos; t=1741536250; x=1742141050; i=mail@bernhard-voelker.de; bh=XSmRWsetzp0KI+E//Cv7xDfAEuXi/9B/qxhrpMSabbA=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=CVC9lk2/3eGBg5HEtyHcXdieWp/HaBfdj8FZb6aU3jci1+2PRmUv85xzNofKLwIo HBJ5YxFVFlKdvONfWercYBwj1FsQ+30P7sCyffSEYevxjD4lkRTLylltr0+AXZGks N/fbSUGb57Dc6Kabz5sdw689H6sPK7M5wgFe21gO8ub5olZxY2K8ACvxA45MvNBaf FCic0k4QNfIm5W+mUYvQiOm8XqdMoauFWGMZd56QxGRviHaBHMbtG6OqeTGEuie5K RZKStLAz1uc8JmCdIgRKd771VnGvjNLTqn033/mVySEwPd8Osyrfl3nfqypW31fUk MnPMnWGuN0vC9drBQg== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [192.168.101.10] ([93.218.109.10]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MJEAX-1tXqAj1oZH-00J6bB; Sun, 09 Mar 2025 17:04:10 +0100 Message-ID: <9cdb4475-48d0-4f77-83a9-87525cd080fe@bernhard-voelker.de> Date: Sun, 9 Mar 2025 17:04:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#76876: logname output is often wrong when linked with glibc To: 76876@debbugs.gnu.org, P@draigBrady.com, nicolas.boos@wanadoo.fr References: <20250308174622.316f583a@unknown> <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> <8799255.t5eZAygCvR@nimes> <2003186.Clq8ysSdAP@nimes> Content-Language: en-US From: Bernhard Voelker In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:mt30RrQadYmZ5KmNVLoI/+uvslZULedfuVgfnFq6Nfx0mq7tWYY 5v22x/GV+6AAaWNyNq1gEYKUjTz+mnLdpnr9KEvh96jAINwoG5OuCHaCGf9vR6Ve8o6/vQd 51JLmlAbZBUP1ClWxZn4ANipXBGdyWDKvR63G3XtvbhubvrG/dlKQt6SAsmgyDq+2YUxCo3 63tQH/OLgil7KKpAcTq4w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:o8/324tL3TQ=;Km8n9RR/JOc0X4zZrZuFObI8qOO tlSlR+AEtXro4BXvllBJOUVKmgtKO4DqS3FzfPhp2gn+9K9Y9ANcehm8hExu5tvVKob/DMCxL jnvxSdOVbFZQ/gubN1tqJDmcIEjqYV2DRxm/KStTvoJEexLpKy1ZO/Ge/2Ra7TSQeEuvVfZTn 2A1l5r5R3H4jawjwbXsx6ZOlp4K7MZXonluUaZKObXd5254RViXMr75Z+qgNJjV93fhgWNkji TU4BnzyMFJ0G++p/XmTMhFU+GZWR88f/bkMIWucJzTp+A/gF8BgeFGa7/J4sdZcVy9bEL3l3P 9YfxXjYP8iYBNgLcZUBF+rr31kL5e65v5Kn/q7Bxh9qtxvGizODoz0qyIIRmp7i5J4leoqKor zlrHH0FCyjLORfnLwcHlW0pjsi0CgDn/BmDhVwMrj7a/CYeZDIL+O8MQut8sOd1Z+HpbOavE3 1qAGGsm9Eg1YZmu/+wO8Rdqa7T3mqdHzL2as4r41NHAuHJYcyCWn9ZdN0Zq3S7iFAvmgEPGPl WjqDuHR/yY6d22PNpsnD1ZQj+6033jUqc7YiIecweVvg4oNUzalpeazBMvl35TsZkiyv/uVZv 1tcEdn6XD3cQJ671KLfXELVEeZdsoGgTZHowr782hbRRj2RZiFUKm80JuINA8+6X/hg2eCr/e JvM2Tn1c3AWVHndN4Lq5QtQAPvLoL32vQPIl2PCI0Q4sm06COWBAAzl37CQPDpTBYthL+4QDH uC4ZAl2n3a8ZN9RLEyDIUjdurW+3BLETuWQYzIHDsIFNhJ8tsFWMadxaYJU16B0WMt8fS8BuW SZFRWfgWkEwXVdDGBf2ELTZYg07ouP3jjkVETH9nJaBXN6/3eVHppqZg2SkCx4pYetk3wdyow bVi4ah6jHS0Mof8v091SScDj/FkR4rNdRwvP9sPWO4wJbva6LIQuAd8c+vsYkdrCqHo6elHb0 4rZk6f5dreJqba0J3fHsDlE3VXcO3tLxq/0Fc46Nodj6s+H8vBCa/cV4ZAlk7/Y1nEo1S/4UR kCgZ/QBwjRFqBYnBlLUDE2OFs+IY7XxVFaueSa85ROWIT1NrGpw46bAvxc+rzierTKgKN2NRm 6NYi6IGUtYf5agzh0nTA5f9aVxmmw/jhBfv3dNmNK1oPDYfwiyonSEK/5dMLmbe9sRiR1HvUM TBe+2C8bU6UbKpcY6cOv2wL0AwLZ3obBfoAtQrIYSKW/lTq8a/GbHt746wdYBYBDQ+1k2MSn5 6zV3KdN9nxX4A+bGwI1ddnfcunXe8n1QaOgRZBfpYLS7MfNbt9HokL/2JIT3l4cCkHx3nS2G4 otaiWPLfBVXjIi3rvXTdIUJONMlqLJWpvOg0QJgCnxuQQouf2V8iAaD1/vyJyhXupP80etkHg u/hcxj5GQo/qeUTA== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Padraig, On 3/9/25 13:48, P=C3=A1draig Brady wrote: > I pushed an update to coreutils NEWS mentioning the fix. > Marking this as done. > doc: mention logname improvement in NEWS > > * NEWS: Mention the improvement in gnulib commit 90840606. > Addresses https://bugs.gnu.org/76876 FWIW: That gnulib commit will only be available with the next gnulib update in coreutils, obviously. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 14:49:49 2025 Received: (at submit) by debbugs.gnu.org; 9 Mar 2025 18:49:49 +0000 Received: from localhost ([127.0.0.1]:34314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trLif-0004t5-2t for submit@debbugs.gnu.org; Sun, 09 Mar 2025 14:49:49 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49416) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trLic-0004si-Ca for submit@debbugs.gnu.org; Sun, 09 Mar 2025 14:49:47 -0400 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 ) id 1trLiV-0006O1-5S; Sun, 09 Mar 2025 14:49:39 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1trLiT-00027l-E7; Sun, 09 Mar 2025 14:49:38 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1741546156; cv=none; d=strato.com; s=strato-dkim-0002; b=H0/hpusfhaBGv8HnzkwohyhTmV63rmc1j4AJORVi7md4d6v5RzgB52J4e7O95SdXiT dMa+nDTdAlv4gxbK1ikupxCyTjN8nLPQs4WnRObTOf6GWSQYoRffbyv+a5A0p2oZfXpS xXp8aqu1QqDy9dcfQiVj+Dly09ASp447rOlmJy1A15cYEcScBX9AoHwNF6IDY72TETn4 2NWdfIcUKHsQvn5e/8fb9bmjzcsyhdJ04BKgYMJD+2vGl990Fmm7ak7hcoVpd1Xl7EJ+ EbyZw4Fx3F9e8TP6EjY4ekHiJUGjQmEovJ04APs1+T7qRw6FaqRxHpDsxu0Bz/H4uPrc estA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1741546156; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=MbAbjJ/s9pQZCMB3GYekpT3xTTcrft5nZ/NHc8MWow4=; b=jlBEW2v9YgNUjxC95Cjwt85SyKxvqyF3gq4empSBQjL5wg6JXV0xNPjE2ZgbFESial CZTMu4qkhKhAzUQtwAkRqx+PNBiBhiQk49puks3mJymCf7BoZ4Cmjj/IIpXpozYuw21q lKwoFx3vsE59cxc6+hBb4Vo/lO0hhSW5mFiAx5wsZ+lrVidIBYv1GLzd91H40duoizRq jAtAZtUK+RZ128pq4dG1OMfbLp7quFWhHVLN2wUgVVmfpgZBgZYSyHwIdXu0vP2SZtdL OQ0rbx3/AyyyS0QfjXFAUcLRP7BnETYDC4IwsA6X3p55gN242ViLsfs3RCf+YBqovXPJ beNw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1741546156; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=MbAbjJ/s9pQZCMB3GYekpT3xTTcrft5nZ/NHc8MWow4=; b=jXsALOhNDJRX538nc9TOTnQLk3gtQSNBDjd85NYx7Ullygy8A6ScsYZNeyQe5839uU IKOLoehSbICNnO6zIYJF17yJgxV4usPKnTNEJ56SgZZnmBdfJcwlleEgSgyx2QkXI1tG KpMYlyBmz1K7TZmUaAOARDe+9T4TB8jCQVcMa/gAtq0qKTPTq0O2XcGCMbXYN66KreBE RQx7tVyFajHS0PDkMQ7YIr0PD28olnMVa/eO4Vn9yarz/z+c9mYZkr9gSSZlxZ+U6W57 Hx+BfY5N7vlYdFU2tZLm3KnZqt9jn6EfBBwzajGaUywSpNVGxgbqtEqeJyJgk3/N6HEv 13cQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1741546156; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=MbAbjJ/s9pQZCMB3GYekpT3xTTcrft5nZ/NHc8MWow4=; b=/b2F4wFIsCDQW7F4yTnCzZrd/ErV1O2gfSP/Caf8wQ/Rcjq7SUUnD+Ye5p5vyL+62i M1Lg2Y05UrRGAQKpwlAw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqjufQGliTVm5S+s96Nof7rF9fTsH" Received: from nimes.localnet by smtp.strato.de (RZmta 51.3.0 AUTH) with ESMTPSA id N7dcf8129InGIGB (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 9 Mar 2025 19:49:16 +0100 (CET) From: Bruno Haible To: bug-coreutils@gnu.org, Nicolas Boos Subject: Re: bug#76876: logname output is often wrong when linked with glibc Date: Sun, 09 Mar 2025 19:49:15 +0100 Message-ID: <1860398.z80rmPrJh6@nimes> Organization: GNU In-Reply-To: <20250309144329.7422e738@unknown> References: <20250308174622.316f583a@unknown> <2003186.Clq8ysSdAP@nimes> <20250309144329.7422e738@unknown> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.54; envelope-from=bruno@clisp.org; helo=mo4-p01-ob.smtp.rzone.de 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: Paul Eggert , bug-gnulib@gnu.org, 76876@debbugs.gnu.org, Rich Felker X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Nicolas Boos wrote: > This page says that the result of the logname command and the LOGNAME > variable must be the same: > https://www.ibm.com/docs/en/aix/7.3?topic=l-logname-command An AIX man page is not a specification for what we run on GNU systems. > Thus, getlogin() implementations that use the LOGNAME or login_name > variables such as musl, uclibc or even gnulib WIN32 seems fine. getlogin() is used for security and auditing purposes, for example, for recording who has made important system changes as 'root'. The problem with getenv("LOGNAME") is that it is arbitrarily fakeable. For some uses, this may be fine. For other uses, it is not. And it's for the latter that POSIX specified the getlogin() function that accesses system-internal data structures that are not fakeable. (If every use-case was happy with getenv("LOGNAME"), there would be no need for a getlogin() function in POSIX.) > Anyway, using a UID to get a login name like glibc's getlogin() function > does, we sometimes get incorrect results. > > Here is a third test case, allowed by posix: > $ cat /etc/passwd > nicolas:x:1000:2001::/home/nicolas:/bin/bash > claude:x:1000:2002::/home/claude:/bin/zsh > > localhost login: claude > Password: > $ echo $LOGNAME > claude > $ logname (glibc) > nicolas > $ logname (musl) > claude > $ logname (uclibc) > claude Yes, POSIX [1] says "If getlogin() returns a non-null pointer, then that pointer points to the name that the user logged in under, even if there are several login names with the same user ID." This can be implemented on systems like FreeBSD, where the kernel keeps track of the user name as a string. But on Linux, - The kernel keeps track only of the uid, which - as you noted - can be associated with several user names, - The database which associates ttys with login *names* is utmp, which on musl libc does not exist (see this definition in : #define _PATH_UTMP "/dev/null/utmp" ). - Even on systems which have /var/run/utmp, often the pseudo-ttys (allocated by terminal emulators) have no entry in /var/run/utmp; thus finding the "seat" of the screen on which a terminal emulator is running is hard. Thus, on Linux systems, a correct implementation of getlogin() can not distinguish different users with the same uid (with reasonable effort). This applies to both glibc and the new code in gnulib. Bruno [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/getlogin.html From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 23:10:17 2025 Received: (at 76876) by debbugs.gnu.org; 10 Mar 2025 03:10:17 +0000 Received: from localhost ([127.0.0.1]:35600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trTWz-0003rq-AE for submit@debbugs.gnu.org; Sun, 09 Mar 2025 23:10:17 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:49844) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trTWw-0003nE-0W for 76876@debbugs.gnu.org; Sun, 09 Mar 2025 23:10:15 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 375313C01085F; Sun, 9 Mar 2025 20:10:07 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id 98cj8qauJA06; Sun, 9 Mar 2025 20:10:06 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id ABEC23C010861; Sun, 9 Mar 2025 20:10:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu ABEC23C010861 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1741576206; bh=YaTD5Yahkyogj8zt1gy+GZLxgSrIsr7stB0PohVCb0U=; h=Message-ID:Date:MIME-Version:To:From; b=BvAfenM4OJ6BOqLcZbIQKHtSZvlunOdaleeSM2sx5posnOVvHTHuC0tV566rbZ21x nCAbpbxefampZqN1zFUQS0D1x6iafbzTxx51Q8L3kjH5T3gtvqmK+azRvc1esB0Uyl 2++Lx00HUKmYzj4QwJRxZ3O6BArU2cJM53R2IJweqE1YKfpmTD63hr7mDdxE1F/OFv /0fPJh6+qXRDIwR6mg1Kr6gXi1P3NUkvV3/TOjufQVDAHqBFgVhyYQ674B7S5Alvtm I8bf9UCNE7tHhY1ixNT7VXIOUp10aDgadaPx3aR7CDL1kycA5Q3ElLSQOraXwOSFi6 LUNIPDlbVUXhA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 6QO5WFsxCbb5; Sun, 9 Mar 2025 20:10:06 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.147.225.25]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 87C003C01085F; Sun, 9 Mar 2025 20:10:06 -0700 (PDT) Message-ID: <83b3c09a-3cb5-47c8-8161-05ba83532efb@cs.ucla.edu> Date: Sun, 9 Mar 2025 20:10:06 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#76876: logname output is often wrong when linked with glibc To: Bernhard Voelker , 76876@debbugs.gnu.org, P@draigBrady.com, nicolas.boos@wanadoo.fr References: <20250308174622.316f583a@unknown> <66e0864b-5c75-4268-8dd1-0f0ab0216283@cs.ucla.edu> <8799255.t5eZAygCvR@nimes> <2003186.Clq8ysSdAP@nimes> <9cdb4475-48d0-4f77-83a9-87525cd080fe@bernhard-voelker.de> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <9cdb4475-48d0-4f77-83a9-87525cd080fe@bernhard-voelker.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-03-09 09:04, Bernhard Voelker wrote: > That gnulib commit will only be available with the next > gnulib update in coreutils, obviously. Yes, and just now I installed that update. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 23:13:56 2025 Received: (at 76876) by debbugs.gnu.org; 10 Mar 2025 03:13:56 +0000 Received: from localhost ([127.0.0.1]:35609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trTaW-0003zk-6A for submit@debbugs.gnu.org; Sun, 09 Mar 2025 23:13:56 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:51796) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trTaU-0003zT-62 for 76876@debbugs.gnu.org; Sun, 09 Mar 2025 23:13:54 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 874063C01085F; Sun, 9 Mar 2025 20:13:48 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id cg9BGsEcvki7; Sun, 9 Mar 2025 20:13:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 492153C010861; Sun, 9 Mar 2025 20:13:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 492153C010861 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1741576428; bh=jIQGFXFo6S2ZPP89w1wTGGdaqs1R5IUnp9/eW0XG7ok=; h=Message-ID:Date:MIME-Version:To:From; b=IwnqCuNqcWAmXyb97CIChoynM1a18rEIS4bPxsJAXBPTd1TS5gmr+gtSW32Y6wCyl dB8TCjTF1Iy99+KPiOpZEGMWrxiGT4hsnMNDnkbCEj6OeCgF5nrfkJkds5MDVeTOHu +GFce2lVRrN3vWP2RaI5+R4Hh8ZYAfhskiY+nuZbdB6PdoOPR/1lHDDOuNQFtxn7s8 BC0iRIQQEuCP0r+0r0vhEf0p5dz2HAV3DTHXDcCXGqjeBZR8V2KlZX2AfCP0aZF0Kx lsdF7zVlgsfkyy1ACQRpQ8Yrq5wpXQf1ER89sw+XOMDlPaIuDsv9Y14W1ti1KHKkr+ Y6hOzQHxZiDjg== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id WcbZdP0feyL9; Sun, 9 Mar 2025 20:13:48 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.147.225.25]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 2500F3C01085F; Sun, 9 Mar 2025 20:13:48 -0700 (PDT) Message-ID: <102845f9-2a5f-47ec-8f36-99921c18f421@cs.ucla.edu> Date: Sun, 9 Mar 2025 20:13:42 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#76876: logname output is often wrong when linked with glibc To: Bruno Haible References: <20250308174622.316f583a@unknown> <2003186.Clq8ysSdAP@nimes> <20250309144329.7422e738@unknown> <1860398.z80rmPrJh6@nimes> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <1860398.z80rmPrJh6@nimes> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: Nicolas Boos , Rich Felker , bug-gnulib@gnu.org, 76876@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-03-09 11:49, Bruno Haible wrote: > Nicolas Boos wrote: >> This page says that the result of the logname command and the LOGNAME >> variable must be the same: >> https://www.ibm.com/docs/en/aix/7.3?topic=l-logname-command > An AIX man page is not a specification for what we run on GNU systems. Plus, that AIX man page is wrong even for AIX. Here's a /bin/sh transcript on AIX: $ export LOGNAME=ouch $ env | grep LOGNAME LOGNAME=ouch $ logname eggert $ uname -a AIX gcc119 3 7 00F9C1964C00 I.e., AIX agrees with GNU and conforms to POSIX. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 10 01:24:56 2025 Received: (at 76876) by debbugs.gnu.org; 10 Mar 2025 05:24:56 +0000 Received: from localhost ([127.0.0.1]:35897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trVdH-0001pP-QD for submit@debbugs.gnu.org; Mon, 10 Mar 2025 01:24:56 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.23]:39003) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trVdE-0001pC-UC for 76876@debbugs.gnu.org; Mon, 10 Mar 2025 01:24:54 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1741584286; cv=none; d=strato.com; s=strato-dkim-0002; b=Z/teykn1rB9M2npfOmTFXV0q+f9tVIfTrqNoF2GMrdE3HsTJx+vOW5Y0LbTHZj6Nrh Yp6c0gS5WtUcXJFV6/cxg15vnx5HuZDy8aUOSfLY5sgndgUCGHw/z/qZfL+dN/F2ul4v canBYdf/oMgt2/5Z3JVlYjDxQ+7SgsAMBY8/ENC0E0WmD9eyFbQub3wsEqJkcRqiCO+O rRjK0qh9bx3lBiml/WAGdN/MYRYuEOh4mbF1uIxHaNd1Yf6vdxHujxQZkqsDQiFMxhKx bpF8hjOEwcIHkf4Ts7paKHUHOU2e1xo7KvHAYxUKQXk+3dEQ+VvdjX2P/Cdd95fRbomd Zg7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1741584286; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=zLwOzJKy3fjqnWbE6+tVKINA5ABepgC932ql4Mqu4jU=; b=lC0yIICTZtclzkX8YqV3b3ALCx7Acrh4thsBj+7qS4nIrg0nTg7GRIYSykJ3FKkkrU 2Gs/NFIUCrPoaZRr2U+Z94B5bGJdRzeLxbA489rPVWFdLNjugbIJ8JshBsXrg/uv2fp9 EEI6WYsUwliNEUy2w+jIUOPjAkvwVzVWKcvc+MwyrDiqscRoacW1BMkltRFDHoPNp+qH 6BU8/8QuIdd0F0rKMIMGUt9MiKz98qkC/83h/6SUQtFKKOaN8TSkd5pbJAFQ5yqyWPBt JDmJKvnJzsOos2lEB1OmhNfPDAjRa1exVFYWwMUAByZU6El/g+lD9xA8tRRjVsVIsUsI WNJg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1741584286; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=zLwOzJKy3fjqnWbE6+tVKINA5ABepgC932ql4Mqu4jU=; b=KnB2hOiw0RRnpgCf6Yg58qXdqOzWq/kLOBUvWgvPhHlYmyFtLPDT2Fd2zx+NR9ry1D 1rkYkgYADN/Ft+FfMJfkNhZaIRx2Ty1RftNnA+vw2MjFYvECpTaqnkQhluEwIe7/IVX9 QJUySMOJlYBBlALW9c1yirxyPyKNFzq4hOLH1QPja1EhKwJQQC+DRk0QmoQDZpo7c8js z5qs0rStECKYdGwjbszhYt7lLj1RX/kYZ7Sk+JqMf9JdaFohw7qXJrTLjsAlorWfnVpk 6iQr28a14MlJZI9M7LfB5GreB1PEvinrSgdudekAn399uWLa5Vg01VQhDg+w0ahwPwH0 /2xg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1741584286; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=zLwOzJKy3fjqnWbE6+tVKINA5ABepgC932ql4Mqu4jU=; b=nsMHuIN8EmvdTKaN+Bl8MpXl2/+vDtj+RZ84h+e1jbFsb7okxthVRwkk37fPwsLCQr pvdeVXrMratBWCKFlUCg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqjufQGliTVm5S+s96Nof7rF9fTsH" Received: from nimes.localnet by smtp.strato.de (RZmta 51.3.0 AUTH) with ESMTPSA id N7dcf812A5OjIt6 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 10 Mar 2025 06:24:45 +0100 (CET) From: Bruno Haible To: bug-coreutils@gnu.org, Nicolas Boos Subject: Re: bug#76876: logname output is often wrong when linked with glibc Date: Mon, 10 Mar 2025 06:24:45 +0100 Message-ID: <5621752.ihCYSUqkRZ@nimes> Organization: GNU In-Reply-To: <1860398.z80rmPrJh6@nimes> References: <20250308174622.316f583a@unknown> <20250309144329.7422e738@unknown> <1860398.z80rmPrJh6@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: Paul Eggert , bug-gnulib@gnu.org, 76876@debbugs.gnu.org, Rich Felker X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I wrote: > Thus, on Linux systems, a correct implementation of getlogin() can not > distinguish different users with the same uid (with reasonable effort). > This applies to both glibc and the new code in gnulib. Let me document this limitation. 2025-03-10 Bruno Haible getlogin, getlogin_r: Document limitation. Reported by Nicolas Boos in . * doc/posix-functions/getlogin.texi: Mention the "different user names with same uid" limitation. * doc/posix-functions/getlogin_r.texi: Likewise. diff --git a/doc/posix-functions/getlogin.texi b/doc/posix-functions/getlogin.texi index 0ccce336ce..b0b8da73ae 100644 --- a/doc/posix-functions/getlogin.texi +++ b/doc/posix-functions/getlogin.texi @@ -16,7 +16,8 @@ This function is not declared unless @code{_POSIX} is defined on some platforms: mingw. @item -This function returns the value of the @env{LOGNAME} environment variable: +This function returns the value of the @env{LOGNAME} environment variable +and this therefore arbitrarily fakeable: musl libc 1.2.5. @end itemize @@ -26,4 +27,9 @@ This function returns an empty string even when standard input is a tty on some platforms: HP-UX 11.11. +@item +When there are several user names with the same user ID, +this function may return, instead of the user name that logged in, +another user name that has the same user ID, on some platforms: +Linux and others. @end itemize diff --git a/doc/posix-functions/getlogin_r.texi b/doc/posix-functions/getlogin_r.texi index df145ecfe2..0e3b7968db 100644 --- a/doc/posix-functions/getlogin_r.texi +++ b/doc/posix-functions/getlogin_r.texi @@ -21,7 +21,8 @@ @code{ERANGE}, when the buffer is not large enough, on some platforms: macOS 14. @item -This function returns the value of the @env{LOGNAME} environment variable: +This function returns the value of the @env{LOGNAME} environment variable +and this therefore arbitrarily fakeable: musl libc 1.2.5. @end itemize @@ -42,4 +43,9 @@ some platforms: @c https://dev.haiku-os.org/ticket/18349 Haiku. +@item +When there are several user names with the same user ID, +this function may return, instead of the user name that logged in, +another user name that has the same user ID, on some platforms: +Linux and others. @end itemize From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 10 02:44:44 2025 Received: (at submit) by debbugs.gnu.org; 10 Mar 2025 06:44:44 +0000 Received: from localhost ([127.0.0.1]:36063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trWsW-0005Z0-3r for submit@debbugs.gnu.org; Mon, 10 Mar 2025 02:44:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57466) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trWsT-0005Yk-Jj for submit@debbugs.gnu.org; Mon, 10 Mar 2025 02:44:42 -0400 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 ) id 1trWsL-0004xs-Rz for bug-coreutils@gnu.org; Mon, 10 Mar 2025 02:44:34 -0400 Received: from smtp-22.smtpout.orange.fr ([80.12.242.22] 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 ) id 1trWsI-0003qe-S8 for bug-coreutils@gnu.org; Mon, 10 Mar 2025 02:44:32 -0400 Received: from unknown ([83.113.165.223]) by smtp.orange.fr with ESMTPSA id rWsAtBkR2BxXBrWsEtt9IM; Mon, 10 Mar 2025 07:44:27 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1741589067; bh=Rqi98TRK6NhVAgBqaiLP9hJs4zOxe8DUDeYs23WYYiM=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=fJ37HiYtE6lVeB8s4dsNSnHtc+XMnzPku7tdpKWBS47upTmFcOL9a3f2G1PX2tuBC 8LN2rRujASs2o1qrPaEdQRy42O1tLgnqY+jQMVFMCI+7qZhm+v+KkjOnGOEmHtzdA/ N+wCVjp9QJXNmemVWAl9kF00hKcGKA44H+L0D9a6wQ48pnJ3SIRQek0NpgRJBERRUA Q8Sw7NNkK8A+qXBaEtOjUiUPrwCND9QuI98zP3rjN2dtFCHh7Bfz6BalSF52xj9M59 03VBnd8qIckf10EOCgK41VA2BCQC12gvUGOFbCamVH5QBCcdkuZxHEYFz7R5xfzKJK xhKhNfNPeeHEg== X-ME-Helo: unknown X-ME-Auth: bmljb2xhcy5ib29zQHdhbmFkb28uZnI= X-ME-Date: Mon, 10 Mar 2025 07:44:27 +0100 X-ME-IP: 83.113.165.223 Date: Mon, 10 Mar 2025 07:42:50 +0100 From: Nicolas Boos To: bug-coreutils@gnu.org Subject: bug#76876: logname output is often wrong when linked with glibc Message-ID: <20250310074250.00b17459@unknown> In-Reply-To: <1860398.z80rmPrJh6@nimes> References: <20250308174622.316f583a@unknown> <2003186.Clq8ysSdAP@nimes> <20250309144329.7422e738@unknown> <1860398.z80rmPrJh6@nimes> 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.22; envelope-from=nicolas.boos@wanadoo.fr; 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-Debbugs-Envelope-To: submit Cc: Bruno Haible X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Bruno, thank you for all these clarifications. Regarding cases such as "su --login" and users who share the same uid, it might be interesting to add a few lines to the logname documentation. It's still very confusing to have $LOGNAME with one value and the output of logname with another. NB > Nicolas Boos wrote: > > This page says that the result of the logname command and the LOGNAME > > variable must be the same: > > https://www.ibm.com/docs/en/aix/7.3?topic=l-logname-command > > An AIX man page is not a specification for what we run on GNU systems. > > > Thus, getlogin() implementations that use the LOGNAME or login_name > > variables such as musl, uclibc or even gnulib WIN32 seems fine. > > getlogin() is used for security and auditing purposes, for example, > for recording who has made important system changes as 'root'. > > The problem with getenv("LOGNAME") is that it is arbitrarily fakeable. > For some uses, this may be fine. For other uses, it is not. And it's > for the latter that POSIX specified the getlogin() function that > accesses system-internal data structures that are not fakeable. > (If every use-case was happy with getenv("LOGNAME"), there would be > no need for a getlogin() function in POSIX.) > > > Anyway, using a UID to get a login name like glibc's getlogin() function > > does, we sometimes get incorrect results. > > > > Here is a third test case, allowed by posix: > > $ cat /etc/passwd > > nicolas:x:1000:2001::/home/nicolas:/bin/bash > > claude:x:1000:2002::/home/claude:/bin/zsh > > > > localhost login: claude > > Password: > > $ echo $LOGNAME > > claude > > $ logname (glibc) > > nicolas > > $ logname (musl) > > claude > > $ logname (uclibc) > > claude > > Yes, POSIX [1] says "If getlogin() returns a non-null pointer, then that > pointer points to the name that the user logged in under, even if there > are several login names with the same user ID." This can be implemented > on systems like FreeBSD, where the kernel keeps track of the user name > as a string. But on Linux, > - The kernel keeps track only of the uid, which - as you noted - can > be associated with several user names, > - The database which associates ttys with login *names* is utmp, which > on musl libc does not exist (see this definition in : > #define _PATH_UTMP "/dev/null/utmp" ). > - Even on systems which have /var/run/utmp, often the pseudo-ttys > (allocated by terminal emulators) have no entry in /var/run/utmp; > thus finding the "seat" of the screen on which a terminal emulator > is running is hard. > > Thus, on Linux systems, a correct implementation of getlogin() can not > distinguish different users with the same uid (with reasonable effort). > This applies to both glibc and the new code in gnulib. > > Bruno > > [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/getlogin.html > > > > > > From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 19 10:11:43 2025 Received: (at 76876) by debbugs.gnu.org; 19 Mar 2025 14:11:43 +0000 Received: from localhost ([127.0.0.1]:51840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuu90-0003vR-2T for submit@debbugs.gnu.org; Wed, 19 Mar 2025 10:11:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:23987) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuu8t-0003uk-Fb for 76876@debbugs.gnu.org; Wed, 19 Mar 2025 10:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lAQ4i7kQIanildQFH53n9Mdn/4rQrmwK98N00uJh8dU=; b=F1pZWdlomYcmwT7rxIrtqD6Pn78L2V6+GQR5+Q5uxZXVLKe7pMNY9MrXGP34TtOcOyUOVE tv7HW5ccM+A2EqJr6gE3MT53oSY37Ao9Nb+foGJ2sx6MlMglblHlCeklneEKsv7LGtL/7O FJM1nJc0vd1GJiMP/24hRkyx5gZ+Pe0= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-463-bwWV_VFLP_SFQjzTRV0PVA-1; Wed, 19 Mar 2025 10:11:32 -0400 X-MC-Unique: bwWV_VFLP_SFQjzTRV0PVA-1 X-Mimecast-MFC-AGG-ID: bwWV_VFLP_SFQjzTRV0PVA_1742393490 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ACBB419560B7; Wed, 19 Mar 2025 14:11:29 +0000 (UTC) Received: from redhat.com (unknown [10.2.17.1]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 10E7E1956094; Wed, 19 Mar 2025 14:11:26 +0000 (UTC) Date: Wed, 19 Mar 2025 09:11:24 -0500 From: Eric Blake To: Bruno Haible Subject: Re: bug#76876: logname output is often wrong when linked with glibc Message-ID: References: <20250308174622.316f583a@unknown> <20250309144329.7422e738@unknown> <1860398.z80rmPrJh6@nimes> <5621752.ihCYSUqkRZ@nimes> MIME-Version: 1.0 In-Reply-To: <5621752.ihCYSUqkRZ@nimes> User-Agent: NeoMutt/20250113 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 908aDHeXZpSwYjKAwcwYwIttN3yXoPmWyKl9tGAZQ8A_1742393490 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: nicolas.boos@wanadoo.fr, eggert@cs.ucla.edu, bug-gnulib@gnu.org, 76876@debbugs.gnu.org, dalias@libc.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, Mar 10, 2025 at 06:24:45AM +0100, Bruno Haible via GNU coreutils Bug Reports wrote: > I wrote: > > Thus, on Linux systems, a correct implementation of getlogin() can not > > distinguish different users with the same uid (with reasonable effort). > > This applies to both glibc and the new code in gnulib. > > Let me document this limitation. > > -This function returns the value of the @env{LOGNAME} environment variable: > +This function returns the value of the @env{LOGNAME} environment variable > +and this therefore arbitrarily fakeable: s/this/thus/ ? -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 19 10:36:34 2025 Received: (at 76876) by debbugs.gnu.org; 19 Mar 2025 14:36:34 +0000 Received: from localhost ([127.0.0.1]:51995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuuX2-0007m5-51 for submit@debbugs.gnu.org; Wed, 19 Mar 2025 10:36:33 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.163]:37617) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tuuWx-0007kz-2B for 76876@debbugs.gnu.org; Wed, 19 Mar 2025 10:36:28 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1742394960; cv=none; d=strato.com; s=strato-dkim-0002; b=RCdiKQ43W1+3E0zP/XDAAZroYvtpyX5kzf8ecbCsit6jKshVw9wXCjjSgBrZnuU9lb 2RjbovOMOJ4je+1Ojyg7FhVV8EnBIXGmJxcSLZ9G4pBFoiXQDWFENFC8XJ34OT39WF13 yujluqj0Z6Ui5OtZ/nBqxHmwXwjt8XkGxW9NmAlZh7nSANJVV37hi1nHAh6JT/hcx9kS 4Zd6Fy0hVZpl57V1WNjUUTLqYTLy3oG0obDtIEYeFtNt4TkA50trM5RFij+c/3V84j1e vwIKHheOVfSFlKVS07xvUu6V8WN2+D13/Unn/2s2SZnr++He1D7fCDrSiL5PjQ8gpDe4 jFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1742394960; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=UcORpSSC9+oPntlF3lX9VQGXefD2gQLHQKFc+XmXvC0=; b=FTZPA6d23YqLahCLEcNXZw1lIe9jog6hLRwAEPYhsDcCq/gyBVZGOSuMKe2Lmrxsnp Z/HpaOQdBFdVJAIIKuT0OKpEDiE1OAKCS0otmdSk04u4C7FRGrCMsP6cjLNTUiTmWvAM E+VcEfWZk7ZVmkZDkDhcgLPtKfwPm8cm4KHbhoc/pfuWiqtWV01z55NGxg/EgQgXNXti 3fI20R+zap1PZ0uZaM1cA6hWyJTjnenMASIeJsDW7SrSu4F5SraXZyS2JPONBEijxCA6 ax01vMixFvlij157S7/zlA7N6+c0sIFcsGcmBDpdDfxO8DotNNonwlSDsP8caLtecI2m u57A== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1742394960; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=UcORpSSC9+oPntlF3lX9VQGXefD2gQLHQKFc+XmXvC0=; b=KKz+7VTrVk755qrxQ9uQH1R9tq1WsoWiuon2hs+N7Zyc3sb42+7RaY7lY9ZuSm3ZtB rl4so9SXldkc7cWa2I2VH4h5qznV/DRdd1TqYLmNIidMlf+VFOWhopjRIYH9SEcRbQeK DXonTBaBfjOTTr9zrfl7/gTtQKzWFGK7PzqpVMhAcmFS0caOHO7XBcZkuubumqsOg4S0 DH6KYFfyBy+UsLzQPufgUzGnzTIy47tn4uVdtw3dEEr6HjSsCEvwjXPYxoYJ2nb73hp0 LguM+SqYvmof6eeG96He87IhgSKhs0zmqzLsPkg9w1ZNH+7j04tkCUQwKNmZ4y/A87ri PfFA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1742394959; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=UcORpSSC9+oPntlF3lX9VQGXefD2gQLHQKFc+XmXvC0=; b=Li4y/WbJNknloDNPkJEDuqC+IOc0FS6PIamIw8TqS9a+qEY+IBO2Niq3ok7y5aF5oD TDG9WJv/ddu46yEzGwDw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqjiQEm7gzaGYG3gikYmFw+Yd+lvO" Received: from nimes.localnet by smtp.strato.de (RZmta 51.3.0 AUTH) with ESMTPSA id N7dcf812JEZx6wl (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 19 Mar 2025 15:35:59 +0100 (CET) From: Bruno Haible To: Eric Blake Subject: Re: bug#76876: logname output is often wrong when linked with glibc Date: Wed, 19 Mar 2025 15:35:58 +0100 Message-ID: <21515999.0c2gjJ1VT2@nimes> Organization: GNU In-Reply-To: References: <20250308174622.316f583a@unknown> <5621752.ihCYSUqkRZ@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76876 Cc: nicolas.boos@wanadoo.fr, eggert@cs.ucla.edu, bug-gnulib@gnu.org, 76876@debbugs.gnu.org, dalias@libc.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eric Blake wrote: > > Let me document this limitation. > > > > > -This function returns the value of the @env{LOGNAME} environment variable: > > +This function returns the value of the @env{LOGNAME} environment variable > > +and this therefore arbitrarily fakeable: > > s/this/thus/ ? Oops, thanks for reporting this. Fixed: 2025-03-19 Bruno Haible getlogin, getlogin_r: Fix typo in documentation. Reported by Eric Blake in . * doc/posix-functions/getlogin.texi: Fix typo. * doc/posix-functions/getlogin_r.texi: Likewise. diff --git a/doc/posix-functions/getlogin.texi b/doc/posix-functions/getlogin.texi index b0b8da73ae..45cac08d89 100644 --- a/doc/posix-functions/getlogin.texi +++ b/doc/posix-functions/getlogin.texi @@ -17,7 +17,7 @@ mingw. @item This function returns the value of the @env{LOGNAME} environment variable -and this therefore arbitrarily fakeable: +and is therefore arbitrarily fakeable: musl libc 1.2.5. @end itemize diff --git a/doc/posix-functions/getlogin_r.texi b/doc/posix-functions/getlogin_r.texi index 0e3b7968db..b4829559be 100644 --- a/doc/posix-functions/getlogin_r.texi +++ b/doc/posix-functions/getlogin_r.texi @@ -22,7 +22,7 @@ macOS 14. @item This function returns the value of the @env{LOGNAME} environment variable -and this therefore arbitrarily fakeable: +and is therefore arbitrarily fakeable: musl libc 1.2.5. @end itemize From unknown Sun Jun 22 11:33:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 17 Apr 2025 11:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator