Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: =?UTF-8?B?T8SfdXo=?= Newsgroups: gnu.bash.bug Subject: Re: No word splitting for assignment-like expressions in compound assignment Date: Mon, 27 Jul 2020 11:05:31 +0300 Lines: 65 Approved: bug-bash@gnu.org Message-ID: References: <87o8o1zfpn.fsf@hobgoblin.ariadne.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1595837137 7089 209.51.188.17 (27 Jul 2020 08:05:37 GMT) X-Complaints-To: action@cs.stanford.edu Cc: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= , "Dale R. Worley" , "bug-bash@gnu.org" To: Alexey Izbyshev Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=h6k6Ma0Qu0ESy9BjjxQ+Mi5IdfGRpTmnAQmCrKhEkZI=; b=LEAOXX2qLdzrZyE1ENECt81hysmp+xSg49zGOaj7utKF4C+vWLn5XzVJ7nBNoBSudU FK+F/zPngJnadVB00UAjYHdzyNJDRWN+3ewoDTCUTjsq6/T6SCZ4m7O0DBmqCmYVv1Zp udOmq0mjQlEplPWiBVD4B1ZWPn3c91zlWOQ1w4Dsv3M4Drf1OgSezbmzJVy2K90X/zj2 4AGotn9YsZNoA7XmiQ1745qEJAg8Z9Qy9WIKXu3AUoTihVEdrVZkYl63f/FfRj9eWo0j qOGiKUAeoZPrVifFyamGtwUMJ7kKMpgj1RDuUBt28JNJrV4eocgfjupmm0oQcU9zJJ9s LJDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=h6k6Ma0Qu0ESy9BjjxQ+Mi5IdfGRpTmnAQmCrKhEkZI=; b=gIoSncWDVX5hqOjitawNCYuQA9IfPI+KaDHUduCkN92kQAlE3x6G1zK30VMWulxn48 6kBqXlxAz407Q/0XiFsc5xV41UGjmDwBb84Lu5d7bmUjcYjHmnYZhS/5ho0a+sGUzgYM JqpK55CDIFrhSGmFOyb5h0qBb+maLvwS2ggJkQXnojS1kOjykl3b5w39RxsktidOlEM7 Hy/u5306OwlWySh62giM/A01cLT+YCxsjmSXsgGIMzx4ZhAeNxRLB0UeLjwPoiah6ifs qF6hdAMO5lzgqxoj6HHEpZ5H3hlcLk7nfJWik4nNrBNUzPcklLMu4mtKopCVcbyJ85m9 UmVA== X-Gm-Message-State: AOAM533NgUYdS2Mjx0AfNPH9qk9Gr9ISzLds+8mN6ora8qCkf6zWxY9/ UR0BDkjKpkuZIMdqNJDDAGzUR93Y4MeyXqS6YH8= X-Google-Smtp-Source: ABdhPJzDGBIvbwhXDB1zvNBEoZBIl1dH6VyxOjN2FV1TMez9LbJ6hJNRGZzO1K0NtJfjuJMZVFNzu4Wq9VLWClnAKwY= X-Received: by 2002:ac8:7591:: with SMTP id s17mr5672683qtq.160.1595837132525; Mon, 27 Jul 2020 01:05:32 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::829; envelope-from=oguzismailuysal@gmail.com; helo=mail-qt1-x829.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <87o8o1zfpn.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16623 27 Temmuz 2020 Pazartesi tarihinde Alexey Izbyshev yazd=C4=B1: > On 2020-07-27 10:06, Lawrence Vel=C3=A1zquez wrote: > >> On Jul 27, 2020, at 1:31 AM, Dale R. Worley wrote: >>> Interesting. The documentation for 4.2.53(1) says this about parameter >>> assignments generally, with no special rules for compound assignments: >>> >>> All >>> values undergo tilde expansion, parameter and variable expansion, >>> com- >>> mand substitution, arithmetic expansion, and quote removal (see >>> EXPAN- >>> SION below). ... Word splitting is not >>> performed, with the exception of "$@" as explained below under >>> Special >>> Parameters. Pathname expansion is not performed. >>> >>> So it seems like the word splitting in "A=3D(X$Z)" is incorrect. So is >>> pathname expansion in that context. >>> >> >> >> If word splitting were not performed in compound assignments, this... >> >> foo=3D(a b c) >> >> ...would not work. If pathname expansion were not performed in compound >> assignments, this... >> >> foo=3D(*) >> >> ...would not work. Arrays would become significantly less usable if >> word splitting and pathname expansion were not allowed in compound >> assignments. >> >> To be clear, I don't consider word splitting and expansions in compound > assignments to be a problem: this is well-known and long-standing behavio= r, > even though it doesn't seem to be explicitly documented. In particular, I > expect word splitting to happen in "A=3D(X$Z)" case. But I expect it to > happen in "A=3D(X=3D$Z)" too, and the lack of it seems unintentional to m= e. I agree, anything that forms a valid assignment statement in isolation is exempt from word splitting and that indeed seems like a bug or very poor implementation choice. $ Z=3D'a b' $ A=3D(X=3D$Z X[123]=3D$Z X[qwerty]=3D$Z X+=3D$Z) $ declare -p A declare -a A=3D([0]=3D"X=3Da b" [1]=3D"X[123]=3Da b" [2]=3D"X[qwerty]= =3Da b" [3]=3D"X+=3Da b") > > Alexey > > --=20 O=C4=9Fuz