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: Sat, 30 May 2020 15:33:20 +0100 Lines: 51 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" X-Trace: usenet.stanford.edu 1590849216 28919 209.51.188.17 (30 May 2020 14:33:36 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org, bash@packages.debian.org To: "Dale R. Worley" 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=gmE3eXMRHnAbCpiGA+Ry0qOPWlfpPVbPuN++YYlNRK8=; b=CEaPJDsJIQfSUQz3oUSIO11vCMLr+HxUjN1yWtRW8jJB61W3+sS84drYj6pb3N7CFZ OX5D7BmfEJzKT5+XdseOavPnutnspeMJQyf5XZYBdSfshpsVtbQrZ1ZvgSSUsm06IlWt YwyRmXxSyQJEdH3ttRlyVyMiPQ7q5+6AXBPQWNAhenYcrGS1dVE1yjeKVxcZTW+3vViv //TW51SbYVFk15CH/MPJgTYV+IOdgbmwVcGtCEcYwPKDGEI2jsGPdSgkkIRnkuSoQEqu VkWLIl0kcpSv22UJfrjvpgnkPEfASYoVOY2xDC4Px3kmCH0DWdzE//AI2jdbe6fVXSE3 aNPQ== 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=gmE3eXMRHnAbCpiGA+Ry0qOPWlfpPVbPuN++YYlNRK8=; b=LY4abkn6e+5bavfn037rYaxf0ZeC6o4h41RMkdRzOkL6EH/dfiUo1r7Fqu4CUFUk3w p5NvA2kRTPrPl7PZyw1d7jIeul7D3n3ERMuxKqhFzlHoyuhpWcIDlfvfZZu/hLtHzUwc fgc41cDBVoaKfitKxzR3hithJ0CEKaggWdmcuLGI954zJqTNB5I9GmNNnyA4uuaw0n/9 THxqFJUBw73jjiNrR2hGcwLV7tU4m1SI/P9L2rCSS6vGRAS/vRD5/Zlax28kzOeKw/Cc 2SVWyZ7dPSxhgmYgOdNfsmjdb8PDHiQLMyLtGOzQ854wwHcCmIoQKQlPMQmEAR7z5m8G VYmA== X-Gm-Message-State: AOAM532yHw0nklRcGCgEj7LUT04QV1hgn8nHNMALjJBGdkiwKqUAmqvr 3yw7qsQaNSbBdWUcu0uC08pTLUfHkxVxR93YIYk= X-Google-Smtp-Source: ABdhPJz6uVBah0DGAI/I9MWLPSIRRdyI5kSZQYQqmEX4zH9/NGS4MtiFr+T6qQIHc/hH0RotIM8XtAPvHa1PSTfMXYk= X-Received: by 2002:a05:6512:62:: with SMTP id i2mr6890162lfo.152.1590849211288; Sat, 30 May 2020 07:33:31 -0700 (PDT) In-Reply-To: <87tuzzh34x.fsf@hobgoblin.ariadne.com> Received-SPF: pass client-ip=2a00:1450:4864:20::141; envelope-from=lpicquet@gmail.com; helo=mail-lf1-x141.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:16322 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 us everything is ok when it wasn't. If feel it should know that the assignment encountered a problem and should report it 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 exit > 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 command > 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