From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS54825 147.75.80.0/22 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (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) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E422B1F44D for ; Fri, 5 Apr 2024 17:49:12 +0000 (UTC) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6FBFE1F24A0A for ; Fri, 5 Apr 2024 17:49:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C38BC171E54; Fri, 5 Apr 2024 17:49:03 +0000 (UTC) Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A880134AC for ; Fri, 5 Apr 2024 17:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712339343; cv=none; b=ta8mO+XyH/jR8RQi9rQnaAK3bzeO7qlDUKFLVzGmR6z4v4E6C2Om8qW2CNcK1/zYkrz6qcItNHP2pjZh1LYqnylapWAJbpWuCs81OtCfLfyhelrEY0jrxKISW6ACJPo5M/dmjPGzjt5r8CRwpTzuCXKiOraPSjxWo1A4MRaaYNA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712339343; c=relaxed/simple; bh=Q48QSQOMFKirtdqOtF7KQxf0ICU8rgwAdepflXlrsd8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ciqo++TX3hXbXsDl9kPs65C+caDaVLCiQurydcEeUoVjDLJYBwTujwRbf/Al3dgPC4GXkF51PxkrYLhOkwKCQWDY1G2xMEMnpxGQitkMrfKZEGfqInvYGfoZuDp2stWnAV084fvWGTnpSFjv8QBLqvK5dq7KIr3vG9lZwdd8fio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 18269 invoked by uid 109); 5 Apr 2024 17:49:00 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 05 Apr 2024 17:49:00 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 30934 invoked by uid 111); 5 Apr 2024 17:49:01 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 05 Apr 2024 13:49:01 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 5 Apr 2024 13:48:59 -0400 From: Jeff King To: Junio C Hamano Cc: git@vger.kernel.org, Patrick Steinhardt , Eric Sunshine , =?utf-8?B?UmVuw6k=?= Scharfe Subject: Re: [PATCH] CodingGuidelines: quote assigned value with "local" and "export" Message-ID: <20240405174859.GE2529133@coredump.intra.peff.net> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Apr 05, 2024 at 09:12:34AM -0700, Junio C Hamano wrote: > Dash bug https://bugs.launchpad.net/ubuntu/+source/dash/+bug/139097 > lets the shell erroneously perform field splitting on the expansion > of a command substitution during declaration of a local or an extern > variable. > > The explanation was stolen from ebee5580 (parallel-checkout: avoid > dash local bug in tests, 2021-06-06). Thanks for digging up that commit. I read the earlier part of the thread and went off on a wild goose chase in the archive. :) > + - Some versions of dash has broken variable assignment when prefixed > + with "local", "export", and "readonly", in that the value to be > + assigned goes through field splitting at $IFS unless quoted. > + > + DO NOT write: > + > + local variable=$value ;# wrong > + export variable=$(command args) ;# wrong > + > + and instead write: > + > + local variable="$value" > + export variable="$(command args)" I think that is a good rule for "local", but I thought we did not allow "export foo=bar" at all, and required: foo=bar export foo If that was only because of this bug, it would be nice to loosen the rules a bit. -Peff