From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QDHwFl+tiWGLfwAAgWs5BA (envelope-from ) for ; Tue, 09 Nov 2021 00:06:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6EmsEl+tiWEjCQAA1q6Kng (envelope-from ) for ; Mon, 08 Nov 2021 23:06:07 +0000 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 4C6A22B4FB for ; Tue, 9 Nov 2021 00:06:06 +0100 (CET) Received: from localhost ([::1]:49838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkDiG-00040o-RT for larch@yhetil.org; Mon, 08 Nov 2021 18:06:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkDi8-00040g-DP for help-guix@gnu.org; Mon, 08 Nov 2021 18:05:56 -0500 Received: from [2607:f8b0:4864:20::72b] (port=39662 helo=mail-qk1-x72b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkDi5-00036t-0r for help-guix@gnu.org; Mon, 08 Nov 2021 18:05:56 -0500 Received: by mail-qk1-x72b.google.com with SMTP id bk22so17086998qkb.6 for ; Mon, 08 Nov 2021 15:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=message-id:date:mime-version:user-agent:from:subject:to:references :content-language:in-reply-to:content-transfer-encoding; bh=RphQXxM4DovT2Po+C68Xc+P+HyxVSov3cR+W55X1pgE=; b=dRX6t/gBKnmPKzLQu1uzPfpOWPHQH1P6aV6pj46FyPH8ASnAXEqd04PQGyHkfNjMNk TUFn3GTpP7IA70h+wAsagZmtIMqZXpzvdETo/iItzBdrsIa1QU8cYEaBV9IRXsAa6oOB 9XZQqTtJJ6laGIUYpU+MercXchNLtHN0tqSIMUH+5DB3Hb/dafki+NO3cJ2Q8CLzuBI1 kOu1/0yb+bMxu01BMNpu48SFmHKnQHFjNYtHIdbXSDO1oVtU4bM0yM/5p29UpVwORLck HomNiMY6GljkZ/STvUYR6hRNj6rW32L+9Z7d9bUninXxI/zRyhb5VyFbVxM1TKI4m5A5 xTAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:references:content-language:in-reply-to :content-transfer-encoding; bh=RphQXxM4DovT2Po+C68Xc+P+HyxVSov3cR+W55X1pgE=; b=eBB3QvbVUSr7rIz+sw5oO9evxf9J/y2x4MUCLSJbjzLhd5L8M85oXmACz9pSpv3w/e 9IGIhN1HNnKOUqVzFrzldLVooQvmkest1f0Ha4I7bAOO58/fLWajs2ywgLkQQfamwDtb YI6lm4HgmRLsXj6TkDvzv/GR7AEts5rJnT4bnhHDVU4AZ1G/kR4WLjwsRFSn5jCp5mDc KlGRvLcfG4OOLS7EOjrtTNuejJb2EAdmLf60AHk1xHonSTZXtfuH45tmQ/s3Nt7g8poL HgVjRkuwWbDIL1xkSp/jWtJzRrIW0ZawOEi1ZKdycSqLc1aJnjHu/YhCbB+0AZLWTv9s 20Nw== X-Gm-Message-State: AOAM533YC8XeSa9hUbse0TjtnIXwTSwT4l1eSyfUpnUUbx4Gti6MjkqN JAEyLLZRvb8DMCJU61WG3PbcZxgvL+y9rKS2 X-Google-Smtp-Source: ABdhPJzNz8DvUJbC+ce5Rfjnh1ii3XKcN7GvK75jJqjvWxzahmz5OPUnsrB4hFuDq3sS6+mhkVtlaw== X-Received: by 2002:a05:620a:4003:: with SMTP id h3mr2206167qko.127.1636412291416; Mon, 08 Nov 2021 14:58:11 -0800 (PST) Received: from ?IPV6:2601:589:4900:c80:f5dd:674d:75d9:578? ([2601:589:4900:c80:f5dd:674d:75d9:578]) by smtp.gmail.com with ESMTPSA id u18sm11131939qki.69.2021.11.08.14.58.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Nov 2021 14:58:11 -0800 (PST) Message-ID: Date: Mon, 8 Nov 2021 17:58:10 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 From: Philip McGrath Subject: Re: How to add /bin/sh to the build environment To: Xinglu Chen , help-guix@gnu.org References: <87bl2u37wr.fsf@disroot.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::72b (failed) Received-SPF: neutral client-ip=2607:f8b0:4864:20::72b; envelope-from=philip@philipmcgrath.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 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, NICE_REPLY_A=-3.06, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1636412767; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=RphQXxM4DovT2Po+C68Xc+P+HyxVSov3cR+W55X1pgE=; b=NBPzOI4soHAVeOdqUijboUlnqTwcWCeAwtRDNoxinbq9yIS9B84795h8qjA+NKxpCo4PlO 5NPqHZyOUa0icwsj52sZK5yzOdJOsMQbdcVbhrnn84ayWNhfZy0ec4RTI5e2xs4t3MiXqI S5H2erHBTOt1J9SEO5n7bfz7Old7F29r9QI0tJyRT2waUhDwZh1g2+GCgi2PeCtxE2H92L XkrdsL1iIe06N2c9rsenc7YG5w0Vz9GOosNywoB4+PgM7WITqXAeo055fIcZp9gUAtj/JN 98izP9VB+YV7o1Josk/XEondJPGh7v3Mc+GyaRRF9eS4JUfG0Td9rbH8BwYDkw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1636412767; a=rsa-sha256; cv=none; b=lxLGYXeAVg3VTDM7HKxXyHkfedtnAHUwT7vzmpVvOQARdFEHm3/Ehvsq6tOstDbcrTbws8 Y4gAjEbPihgTE3FdyErUcyTdm2ZgduRVBnbzcVvEzTHfO44U0kLOIWOnp1/SAlfAS8ICUf rie4szZzCkyv29O0HG0nR+5kzGNVYaPtlbCFb06s00JDegqsWILHzdYviCMIVTokhXs2pW D2IdRKsxoS0MiqLPQyNDU1PBMpY2OsJQ3hRf42Jqohn0xrQ808Qbx0Pd4hgGbuQtIE1rgA xwASo+bdp1T8bpck1wFrBb1/ckJ3tW66LeDTNDXDE5wS0JgIRTUpmvOTlAS2sw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=philipmcgrath.com header.s=google header.b="dRX6t/gB"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Spam-Score: -2.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=philipmcgrath.com header.s=google header.b="dRX6t/gB"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: 4C6A22B4FB X-Spam-Score: -2.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: RJ27lcDm8Fo7 Hi, On 11/8/21 15:19, Foo Chuan Wei wrote: > * Part of the build process relies on programs written in Standard ML. > * The part written in Standard ML uses a function from the SML Basis > Library: `OS.Process.system`. > * `OS.Process.system` will always use /bin/sh. This is hardcoded. I > cannot change it. If I change it, the behavior of `OS.Process.system` > would probably be wrong in the final product (the sml compiler). A similar issue came up for Racket, which has a family of functions like `process` and `system` that execute commands using `sh`.[0] Maybe this kind of function is common enough in programming language implementations that it should be documented in the Guix manual's packaging guidelines? For example, even libc has a `system` function specified to use "/bin/sh" (I haven't looked at how Guix handles it). Part of the issue with Guix is that, even if you somehow arranged for "/bin/sh" to exist in the build environment, Guix users will likely also want to run the SML/NJ compiler and compiled SML/NJ programs in environments where "/bin/sh" doesn't exist. For Racket, thanks to some discussion with Jack Hill,[1] I added a patch that uses a Guix-specific C preprocessor macro to intercept attempts to execute "/bin/sh" in librktio (Racket's cross-platform IO library) and substitute the store path to Guix's `bash-minimal`. The current patch is at [2]. (A subtlety I'd forgotten is that, in addition to functions like `system` that are specified to use `sh`, Racket's build process was also calling functions like `system*`, which are more like `execve`, with "/bin/sh" as an argument. Since that approach is recommended for portability and robustness, the patch intercepts those attempts, too.) The approach was especially defensible for Racket because the Racket Reference merely specifies that the functions will use some `sh`, not that it will be any particular `sh` or will be located at any particular path. From a quick look at the SML Basis Library reference[3], it specifies that `OS.Process.system` uses "the operating system's default shell", though it does go on to say that, "on Unix systems" (but apparently not Mac OS?), the default shell is '/bin/sh'". Since Guix doesn't really have a "default shell" in general, I think using the an explicit package input might make sense for SML/NJ's `OS.Process.system`, too. [0]: https://docs.racket-lang.org/reference/subprocess.html#%28def._%28%28lib._racket%2Fsystem..rkt%29._process%29%29 [1]: https://issues.guix.gnu.org/47180 [2]: https://git.savannah.gnu.org/gitweb/?p=guix.git;a=blob;f=gnu/packages/patches/racket-minimal-sh-via-rktio.patch;h=6bc2ee8331f046959fd493f8e1604e682ddc4a0d;hb=HEAD [3]: https://smlfamily.github.io/Basis/os-process.html#SIG:OS_PROCESS.system:VAL