From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id mNAJJKm1cGe+qwAAe85BDQ:P1 (envelope-from ) for ; Sun, 29 Dec 2024 02:36:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id mNAJJKm1cGe+qwAAe85BDQ (envelope-from ) for ; Sun, 29 Dec 2024 03:36:25 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=NIt8Qa8C; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=gzft0Ysb; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735439785; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oVezi2yoAy7YGV5Aq446MC+Rv3LmhsZEtcJ4VrXDW9w=; b=QCJdBf2LAX5CzUOj4H7rzOr3AOQELyjOgo1RR9OIF+0j/DxE6fTyff78CkrwKoYGlJDo3n xCZpxs5zCQGMwZdpxkY9vvcI5emfSdvGpJPbQXCq1CCtW9qvW7cy7WI3D9As0e+J/FhKX8 7dHnfKNN59DS5ZUCY8Gb5WMhPjGPq2LPvnuXBY3qwD1dax/OGqLfDCUdJ23nePxFFSwlkc gOv6+EpqdooxjDGowvrhdT/ZQEPD1ARWbd9xzCkz/82NhqemI7oN9vf9GBk/ptIVzNNB5J 95TYD5xqt6jkr5PbTrtCi8ApvtbPYYGfyzasogx8lvEMS0wkOXKBtN8D1vtmGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=NIt8Qa8C; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=gzft0Ysb; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735439785; a=rsa-sha256; cv=none; b=ocAsDp3NqTB62Zx4KoPdposHK3xtDTdTSXYiDY0y2XpQPe5LNwdSwoFlkGAQO17giJMHQf AMaMX94qX1o5frrLWmUXEyRvHL6pl+oG0tXCDzaPyMRGOO07QcOgZdWECUQ+bVVK9E5LQO LnGrf1u+I6wMamLo0zHAVp6scF9mE7ywRMQdQgmVb1w+G9hxE+xuXHzdTE8d7P21UjJ8e/ EcTfrGxPcjcXBfF+ISaYwlp6+ncy8iToI8CMIzUN7Pgw2b025X7KrwaSyTq0bUOak0Ac4/ +kv50bCRJlfQfXUTPTJRNFH4tq0PenDaVibpDCNXU5RKXmzVxig2a2NZVLUy3Q== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E158B53C23 for ; Sun, 29 Dec 2024 03:36:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRj9w-0002LZ-BR; Sat, 28 Dec 2024 21:36:04 -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 1tRj9u-0002LE-QA for guix-patches@gnu.org; Sat, 28 Dec 2024 21:36:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRj9t-0007bt-T1 for guix-patches@gnu.org; Sat, 28 Dec 2024 21:36:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=oVezi2yoAy7YGV5Aq446MC+Rv3LmhsZEtcJ4VrXDW9w=; b=NIt8Qa8CCGn1OdIgLAzMYsrHwTk5Q2a1FVsYrq6UlYT+/KAzbwy7ItBc2AVFKVYWBsGo04XwADIkevp43NseRJYAXeRydcb0MAs3Mjn7vE2QT44kATarbZVVmV/wCnKdAatiUjiafEAD03DJj+t3r/+l0LHvLC6OhPHZYJ6RbLfTtMd83txtvYp8hdrq4bsh6Qwbx876whHIZc4mSxaP9XP/DTMzPajV5qcWq3pGXt5d8sWGdObVrrnAQMgACldPW/DYqo6tzOEdlLfKAVTXhEYed04wOjSHX3lU9g5TeCj2YYnwPgP+0jeZdKlGUdEN16fhfwyHW8WlPGYA3MqEgA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRj9t-0001L6-O0 for guix-patches@gnu.org; Sat, 28 Dec 2024 21:36:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74962] [PATCH v3 4/5] etc/guix-install.sh: Remove 'which' commands from requirements. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Dec 2024 02:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74962 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Josefsson Cc: Mathieu Othacehe , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 74962@debbugs.gnu.org, Josselin Poiret , Janneke Nieuwenhuizen Received: via spool by 74962-submit@debbugs.gnu.org id=B74962.17354397335062 (code B ref 74962); Sun, 29 Dec 2024 02:36:01 +0000 Received: (at 74962) by debbugs.gnu.org; 29 Dec 2024 02:35:33 +0000 Received: from localhost ([127.0.0.1]:53236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRj9Q-0001JX-Iw for submit@debbugs.gnu.org; Sat, 28 Dec 2024 21:35:33 -0500 Received: from mail-pj1-f51.google.com ([209.85.216.51]:50270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRj9N-0001JK-Hm for 74962@debbugs.gnu.org; Sat, 28 Dec 2024 21:35:30 -0500 Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2f42992f608so8392536a91.0 for <74962@debbugs.gnu.org>; Sat, 28 Dec 2024 18:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735439669; x=1736044469; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oVezi2yoAy7YGV5Aq446MC+Rv3LmhsZEtcJ4VrXDW9w=; b=gzft0Ysbi+Q7JvVBc9tucv18jMXwvSAuUmy6Dh2RZIa2zUxZwxs/Ol6zVaYQSdI42P xZpUMj9xwa0txEUB3moPms/yFW4/PVj6DAASI8e4jmFBHYtukIB6leqyg/Zo6RLKrAMQ 92jhGem6Kn+dCpt7lYv3CPUXXesVChEJvedZ18lYevBo/Rmh6mhIACIdIpRCXv0AdzU+ p/XBuHMtS7wHC0Di+ZXwwo2zJtDJ+Yea1+T7dTr0NkhR/ZSwOixvtP1eOuZ6bfgO+kDj etl9gpfIkmuRdHXxo42xFaL5d3Va9aMVWK5soKzsYnsNpdxQ4C5FrYtdZSjTi6aM1pFB CmaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735439669; x=1736044469; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oVezi2yoAy7YGV5Aq446MC+Rv3LmhsZEtcJ4VrXDW9w=; b=lUB/pDODrs4I+0OgUyQUdvkI5GB9APo8GwCjtEJlGh6Ds/ZRA4BimfFsoF0gBM0kqH lDBSnijHMoAZDFJ/RUxcwa/aNfhej06cePUMJxfYkkLMwVlzJidb9NcaDI83z8caEeD5 Fu9aeyS7CbZAwfWp8OAGRIMlqa4xM0VmdYiP+5CC+RgAFWAiT21gWAc5rRLF0hvG58c4 lUU0gzKp1Br/3nwlM0EmNiNtoCS9x7ZHa796TAOheNfmsDc31f4JCnTQc3PlzpgDssvU qvKVnY8TMKf4BpG2NUDWLSfGHBkw1/F17htyhWzeqklBXesdsHjB5CaRkPUXZzcEpYS9 UwUg== X-Forwarded-Encrypted: i=1; AJvYcCUNEPVX2zLWCH7J9KKD6Lt/A3wukAY+FD1LG8GcNy8bWTTuUqWsfFf/lNbPRrsj/XUEU+JpAw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yyf6lN+fIqiak5t56/VzBNGk2jVkHE7KojYL8K8Ql+PX9DQLMes 6Ef0IOmJqwHgWtRIybks00696sn0GCsQqU8UfEy53VZ1p8Su3ujN X-Gm-Gg: ASbGnctDeklHlRjqEap2K/6wEiFMJbGtITgD/eJcbpevN/vkhGZYsTrp9+WJaazgKQ/ LWlcDJZBhOGKlB6JqQ9l5Gz/2VJ9IarY2D7Z10oToCnwzXjeFX1liLHi/EibyUzlAvS+7ywGuSK wl58HZoacakFmc1DOXA92xMUKaxUUC/ypsSGz7avrQbcEtlC4Fa+DLxZG5gPE3I5gBni5thCu/J GTuy1S9GOKc3c1bFysObNU69+d0mNJy25R7eKS3XXFEjtUwo7JViQ== X-Google-Smtp-Source: AGHT+IG9NyWUOsZBeI1g8IYTDaYKSzxglMQwadaxGlJ5coSEk111k4XYVbmCAkq9E2t1hboZWAxcOw== X-Received: by 2002:a17:90b:54c6:b0:2f4:434d:c7f0 with SMTP id 98e67ed59e1d1-2f452e22c43mr58209364a91.12.1735439668716; Sat, 28 Dec 2024 18:34:28 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96eac6sm156680735ad.80.2024.12.28.18.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 18:34:28 -0800 (PST) From: Maxim Cournoyer In-Reply-To: <87v7v6tygi.fsf@kaka.sjd.se> (Simon Josefsson's message of "Thu, 26 Dec 2024 13:34:21 +0100") References: <3d0ccfc5f28f48b0a4e513e4ebfd3018c85b4407.1734594333.git.maxim.cournoyer@gmail.com> <6d1f4ffaa70f4cfb3ed9e18b46fe3cedb44025f2.1734594333.git.maxim.cournoyer@gmail.com> <878qs2zpaf.fsf@gnu.org> <87v7v6tygi.fsf@kaka.sjd.se> Date: Sun, 29 Dec 2024 11:34:17 +0900 Message-ID: <8734i7i5ee.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: E158B53C23 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -3.79 X-Spam-Score: -3.79 X-TUID: 5qWmtTfFw8C5 Hi Simon, Simon Josefsson writes: > Ludovic Court=C3=A8s writes: > >> Maxim Cournoyer skribis: >> >>> * etc/guix-install.sh (REQUIRE): Remove "which". Add "nologin". >>> (sys_create_build_user): Use 'type' instead of 'which'. >>> >>> Fixes: >>> Reported-by: Simon Josefsson >>> Change-Id: I0675716bab3fc22d3289ee7af2cb0ab33a1cee71 >> >> LGTM. > > Using 'type -P' is not POSIX and neither /bin/dash nor /bin/gash > supports it. It seems like a GNU bash extension. Is that okay? I think it's OK, since we currently mandate Bash, but we could use 'command -v the-command > /dev/null' for the same result, which *is* POSIX, so perhaps we should use that instead. > The snippet ends up in the manual as recommendations for users to run on > different operating systems. We may want to assume GNU bash to favor > it, but I'm not sure if that is really helping users. > > If 'type -P' is used, shouldn't that really be 'type -fP' to avoid shell > function expansion? It isn't all that clear from the man page if -f is > still needed for -P or not: > > https://manpages.debian.org/bookworm/bash/bash.1.en.html#type I think we'd have to use -f if we want to guard against shell functions being found instead; but maybe then it's simpler and clearer to just use 'command -v' as I mentioned above. > Even so 'type' uses hashed names, do they survive sub-shell $() > execution? If type is to be used, maybe this should be: > > $(hash -r nologin && type -Pf nologin) > > My suggestion was to use 'command -v nologin' which behaviour is > standard POSIX /bin/sh. I acknowledge that it has the trouble of > expanding to an alias if the shell had 'nologin' aliases somehow > (unlikely but not impossible). I agree; I'll make the change. Perhaps adjust the other 'type' usages also (there was only 2). > $(unalias nologin; command -v nologin) > > It seems all of the options (which, type -P, command -v) has another > unwanted property: if 'nologin' is not available in the path, these > commands expand to the empty string, and that empty string gets passed > to 'useradd -s STR -c ...' and the user gets an ugly error message about > '-c' not being a proper shell. Yuck. > I wonder what all this solves compared to hard-coding "/" as the login > shell for the guixbuild user? > > Here is source code for nologin, which we seem to make some effort to > use - is this better than 'false'? > > https://github.com/shadow-maint/shadow/blob/master/src/nologin.c It seems marginally better than using 'false' in that it logs something to syslog when a login is attempted and fail :-). > At least I'm happy nobody wants to keep using 'which'. > > I am sorry for the rabbit hole :) Thanks for the comments. I'll send a reworked version. --=20 Thanks, Maxim