From nobody Sat Dec 24 22:53:46 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NffVM2079z20f6D for ; Sat, 24 Dec 2022 22:53:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NffVM0chfz4M09 for ; Sat, 24 Dec 2022 22:53:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671922427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2+ScGUQQCIQf6QuYrIjnD/xACCgK6c64imOB7sBUHHk=; b=n0C3h5M4G/3lIJtlUJ1YwnKSMQThP2HTM7Ht9xr0Au+E8DXGF0UMosoUwdUox9KH2qdj7e 2nRnfm/CWD5309OmicKucggZ8pbD4vf7XR59nw/aHfT9S4rix3mWxVHE5VaHNYKFK2ja5c FBGyCSPX1ppxK0d8Y4+whrmNd9J2b7qAtU1a6MK98091UiaH1paPVzejXRB85WUC5gNq7E EDykfgLB+S27rL76ndJLErbaBfcj/7cyQAdjyMgYBF5N7+Iep3foS5MAvboIbOsY8Jmv64 Rw3u7FFpUCe9Scu8eDl1uRXy//OC9biQahqbwrIRkM/nRZWOxc0p/f4X7APqBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671922427; a=rsa-sha256; cv=none; b=qqlze023F+53W/6CjbhjAN5WrhArZtz498w9KJVrUtwl1sf01Bcu3Ki3OxWmo4VXdTRZFW dtYk30VwhDEPQShJ5DRkge/zTa7qCGwMWR269yfSE5UalppYX5HPdPB0Rn/M1aCM0DsRQq Pzq80u9jdKUweYovuXpm9uKKku/yBW68eRkCFOKJLeX5BVUj3LGGv05FrAFfS/eaqSPu4P ioHQquCjOtr1ns7sQzf3U5zKrFRHjPqOwi4u8DJX8f/x3bjH1TX/1QRRtTjMPEQnnoBsGK 71MaKWEkuyX3jhict9x1GuRJmBN0oEbGFBaWptsx1uLEbYT8VIu6Lu1Q1GE2pw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NffVL6qKqzW1X for ; Sat, 24 Dec 2022 22:53:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2BOMrk4x070834 for ; Sat, 24 Dec 2022 22:53:46 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2BOMrkTT070832 for bugs@FreeBSD.org; Sat, 24 Dec 2022 22:53:46 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268547] /bin/sh 'cd' should get user's home directory from password database if HOME is unset Date: Sat, 24 Dec 2022 22:53:46 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jschauma@netmeister.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268547 Bug ID: 268547 Summary: /bin/sh 'cd' should get user's home directory from password database if HOME is unset Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: jschauma@netmeister.org Created attachment 239007 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D239007&action= =3Dedit patch to cd to fall back to getpwuid->pw_dir if HOME is unset POSIX requires that the 'cd' command use the $HOME environment variable (if that is set) when no operand is given. It explicitly notes that behavior of 'cd' with no operand when $HOME is uns= et is implementation defined. It then notes:=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 "A common extension when HOME is undefined is to get the login directory fr= om the user database for the invoking user. This does not occur on System V implementations." If HOME is unset, /bin/sh currently fails with the error message "HOME not set". Instead, I think it would be useful to try to determine the user's ho= me directory via a getpwuid() lookup. Attached is a diff to implement this proposed change. --=20 You are receiving this mail because: You are the assignee for the bug.=