From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 20:35:00 2022 Received: (at 40641) by debbugs.gnu.org; 10 Jun 2022 00:35:00 +0000 Received: from localhost ([127.0.0.1]:48248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzSc7-0003E8-Iz for submit@debbugs.gnu.org; Thu, 09 Jun 2022 20:34:59 -0400 Received: from mail-qk1-f180.google.com ([209.85.222.180]:46653) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzSc2-0003Dq-JP for 40641@debbugs.gnu.org; Thu, 09 Jun 2022 20:34:58 -0400 Received: by mail-qk1-f180.google.com with SMTP id o68so18907667qkf.13 for <40641@debbugs.gnu.org>; Thu, 09 Jun 2022 17:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=bOFzRRpiU9ZsZFoZ36jlL+ITtYEjeLyOHha39IPjqR4=; b=RpAkPUc6nPNSxVMyc8qWQ+yKCJ+6oEDyl6ou93cAl8E2AVB83TbdetDoKm5yBW2UYk xCO+KT9yAH6TiTC//UENTSACoNm3SFVbIeUnS0GhndKFrM+DzKGqb8egG4Rc+3Uh5DOp bh8O8A8FFvV8HZ3c2oH1SY49rtVBEYzzvVnaLvSu2T0ou3StGL6CcAPf0sIeuqXCg1Dy 7vMt8uuUwGBWCDVPRnWGh6u3KD/K8nIfl8jT8EhmtNdl2L04zDbGAxzSvNw6tC0ZwSeT NhkzCzG8RABq+dI+LLTDe0QpfOQyYqqGkoR4U77T8Zl+dfAepMJr8jItdaYaWqhegqyI 8D7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=bOFzRRpiU9ZsZFoZ36jlL+ITtYEjeLyOHha39IPjqR4=; b=M2OlPK/1ABTHLOPc5FgM8EwDKI7L2AYfAQjtuKpxCp/l3OB+6EfjiXS+g051ng+sA+ AmR0dbD+2MBiryXipthCO86r1rfUkk6Rn9UiMAV/jWICFYd9PPwy5wSDPqfjA+G8Och1 lQF0I55uDFPCE87KhyPVrLzMWWlHQ1ttylbFRhH2bu+t3Sg5HNXY17XDZzjTr8cexVbH JmF8MygIsdkg8dUVY76ScNiUeabijv8TnCNroKe3b8I+zAXaT3A6qiZi49wIEL2tuFoZ JX0X9mlX7NCFwfsYFFURqgIaTWlLe+RvScmsI8LLAN12MFDgHQ0uvl39EXEczYpY7XXy xQSA== X-Gm-Message-State: AOAM531rqn4jEO3WelwSQa8mIQsj12FVoJqJmAepHujVkW4gFPK84IBK ST0AAXE9hpMjp3lKxgEtLiqelIlRGsg7jA+d X-Google-Smtp-Source: ABdhPJwCUHPkTDOiz1rW3zQyr7inYfn7MsYilCL6kUcOTOLuws1RQjwpv+LIlBQdSbh0FwoxmYd8Ag== X-Received: by 2002:a37:5404:0:b0:6a6:48c7:b137 with SMTP id i4-20020a375404000000b006a648c7b137mr28682515qkb.284.1654821288290; Thu, 09 Jun 2022 17:34:48 -0700 (PDT) Received: from hurd (dsl-155-254.b2b2c.ca. [66.158.155.254]) by smtp.gmail.com with ESMTPSA id f11-20020a05620a280b00b006a6bd7028d5sm11924843qkp.18.2022.06.09.17.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 17:34:47 -0700 (PDT) From: Maxim Cournoyer To: elaexuotee@wilsonb.com Subject: Re: bug#40641: Building from git breaks when /bin/sh isn't bash References: <2O2NKRGHD2OZD.30CKDJBOP4LE3@wilsonb.com> <20200415122149.j7b6bcgvrp5cpq5l@pelzflorian.localdomain> <38M8QJ1PDKHCI.2ZBQF20W9BE03@wilsonb.com> Date: Thu, 09 Jun 2022 20:34:45 -0400 In-Reply-To: <38M8QJ1PDKHCI.2ZBQF20W9BE03@wilsonb.com> (elaexuotee@wilsonb.com's message of "Fri, 17 Apr 2020 23:57:04 +0900") Message-ID: <87h74tgxui.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 40641 Cc: 40641@debbugs.gnu.org, "pelzflorian \(Florian Pelz\)" 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 (-) Hello, elaexuotee@wilsonb.com writes: > "pelzflorian (Florian Pelz)" wrote: >> On Wed, Apr 15, 2020 at 06:06:25PM +0900, elaexuotee--- via Bug reports for GNU Guix wrote: >> > When building from git, ./bootstrap ends up generating (via automake) several >> > Makefiles that set SHELL = /bin/sh. However, some targets contain rules that >> > make use of bashisms. This leads to breakage when /bin/sh is something other >> > than bash. >> > >> > In particular, I am building from a foreign distro which links /bin/sh to dash. >> > Currently, this ends up breaking the build, the details of which I reported >> > to guix-devel in [0]. >> >> is related. Your workaround may be more welcome. >> >> Regards, >> Florian > > > Florian, > > Thanks for the pointer. I ended up doing a little bit of sleuthing and think > I figured out a relatively clean fix---a simple one-liner in configure.ac. > Attached is a proof-of-concept patch against master (974bf81776). > > Currently, autoconf sets make's shell to whatever it thinks is best. On a > foreign distribution, this often ends up something external to guix profile. > However, when this isn't bash, we run into problems. > > The patch's idea is to let make use its hard-coded default shell. A guix-built > make will correctly fallback to whichever sh is in the profile, so for `guix > environment guix' this effectively becomes $GUIX_ENVIRONMENT/bin/sh. For > example, > > $ echo '$(info $(SHELL))' | make -f - > /gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7/bin/sh > make: *** No targets. Stop. > > I belive this should do the Right Thing. However, is there anything I am > missing? Perhaps this change would break build scenaries I am not thinking of? This seems odd to me. Perhaps it'd be cleaner to detect which shell is used at configure time to detect when /bin/sh != Bash, and warn that if there are issues, the user should set the SHELL variable to Bash. Or if the Bashisms are scarce enough, perhaps we can rewrite the routines in POSIXly correct shell, although this being a GNU project I don't really see the merit of forcing lesser shells (and less readable code) on ourselves. Could you provide a list of the problematic targets? Or if my suggestion sounds good, give it a shot? Thanks :-) Maxim