Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Laurent Picquet Newsgroups: gnu.bash.bug Subject: Re: local failure Date: Sun, 31 May 2020 10:29:27 +0100 Lines: 96 Approved: bug-bash@gnu.org Message-ID: References: <87tuzzh34x.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 1590917385 10924 209.51.188.17 (31 May 2020 09:29:45 GMT) X-Complaints-To: action@cs.stanford.edu Cc: "Dale R. Worley" , bug-bash@gnu.org, "bash@packages.debian.org" To: =?UTF-8?B?T8SfdXo=?= Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LBSOV4XeMpBeWQ88nqP95LTp9wdjuzqQJM40/swDLbo=; b=HJpqDwe3UQ83ZXbYabuFjBX3WHo1i2PxNRLGYpWLkCaIdmU20wqymmdUHrF99grTJZ q0+3mOQo9Pc28yVpIwV8B2WY4puGtqvKJ5aLHTSoosSpIoT3DRe706+6jqu/WmnK601z +osV9Z00zWWvAo8pH4Ka+7Zl1Dl2pL9OEeYlA2MT9wHjI07QZ3G67VN/lwllPEWHc1Ij 6JeMK/9S63BdZS75RVppw4pMUC93c2b/2TFUrgvTTaRi5WwoCVJ2nUL9vTLkMtC9lUYV WyCvzQC7t8voSrTD70c4Rf5Pa+TEHA5CtqHVzHpzGo0HD789lxr5MAWfxto11udTj1Ik /rhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LBSOV4XeMpBeWQ88nqP95LTp9wdjuzqQJM40/swDLbo=; b=lIw0Xkalspaa+k9bExQTtajOggftE69/K1tfPqGRO4JZkYai7kMVvgHgQV082JtJx5 n7vnljqQmOkWAuorKfMIjcM8uDecR9UX5Y7lWniszNsHHOWaKcbJ0TnJg6t6fynqWRh4 +kmeiwbIZTAklTI6Cdgl2Fx4Jui3IUjPtImc81NRlznTuuyezwcV/KrAzh/kDay+PJb/ YQZNkMWFN4fYT/QUDiMecxiF44V8EA6FZduAqDn4FwPtBnS6AYmRwBvmQQlNvuuGTqZy TqG/q83d9deK7amDBaFR5brLPpunIktNDR2A5svCjRR+rPT9rpr/2HM6sHCag8NglToY SLAg== X-Gm-Message-State: AOAM532CMW+hifA4dL7rs1tzoom+9ZsBsBvDg0v8JCnyxWjQThnOt3Tr dXBfYBxOVrE6xXWzK1/2/07DgKwO+GYclT+AZK0= X-Google-Smtp-Source: ABdhPJwEHWnMBEDYTEa9P/Yvq6Yxt5Dp7FK7Q6Ft8dme6qZ0B5bdl56RvDj4WzD2lEHJxpYkR20DYwuzzaN8kM5u8kM= X-Received: by 2002:ac2:5586:: with SMTP id v6mr8127990lfg.172.1590917379024; Sun, 31 May 2020 02:29:39 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=lpicquet@gmail.com; helo=mail-lf1-x12f.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_PASS=-0.001 autolearn=_AUTOLEARN 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: <87tuzzh34x.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16325 Ok, thanks for the clarification. This behaviour is not fully documented and I believe this should be addressed. I don't mind participating. Could you point me in the right direction to do that and raise a pull request? Regards, Laurent On Sat, 30 May 2020, 16:32 O=C4=9Fuz, wrote: > > > 30 May=C4=B1s 2020 Cumartesi tarihinde Laurent Picquet > yazd=C4=B1: > >> Hello Dale, >> >> This is really interesting. >> Should the 'local' command be the one able to detect that the assignment >> to >> the variable had an non-zero exit code and return the non-zero exit code= ? >> >> as a developer, it is counter-intuitive that the 'local' command tells u= s >> everything is ok when it wasn't. If feel it should know that the >> assignment >> encountered a problem and should report it >> >> > Everything is ok for `local` though; it takes a valid assignment statemen= t > and successfully evaluates that. So it's not that the assignment > encountered a problem, but that the expansion has failed, which has nothi= ng > to do with `local`. So there is no reason for `local` to return a non-zer= o > exit status in that case. > > >> The return status is zero unless local is used outside a function, an >> invalid name is supplied, or name is a readonly variable. >> >> >> >> On Fri, 29 May 2020 at 03:43, Dale R. Worley wrote= : >> >> > It's a subtle point. See this paragraph in the bash manual page: >> > >> > If there is a command name left after expansion, execution >> > proceeds as described below. Otherwise, the command exits. If >> > one of the expansions contained a command substitution, the exi= t >> > status of the command is the exit status of the last command >> > substitution performed. If there were no command substitutions= , >> > the command exits with a status of zero. >> > >> > In one of your examples, a "local" command is generated using a comman= d >> > substitution, so the exit status is that of the local command. In the >> > other, only an assignment is done, which is not a command, so the exit >> > status is that of the last command substitution. >> > >> > Dale >> > >> >> >> -- >> >> >> -- >> >> Laurent Picquet >> >> 16, Hunters Chase >> >> South Godstone >> >> RH98HR >> >> England >> >> tel: 07882 356 104 >> > > > -- > O=C4=9Fuz > >