Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #13748

Re: Function definitions

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!171.64.64.130.MISMATCH!usenet.stanford.edu!not-for-mail
From Pierre Gaston <pierre.gaston@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Function definitions
Date Mon, 26 Feb 2018 16:16:26 +0200
Lines 60
Approved bug-bash@gnu.org
Message-ID <mailman.9750.1519654612.27995.bug-bash@gnu.org> (permalink)
References <877er0qbb7.fsf@gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1519654612 31245 208.118.235.17 (26 Feb 2018 14:16:52 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bug-bash@gnu.org" <bug-bash@gnu.org>
To moosotc@gmail.com
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=oUNoFIiHgCEPc+M/9eDQ87jlD8dWMB2HuRF/p5tvcGs=; b=IbxUxWRTNl7okg1xkGIHoM6AOZqgSuFWltv1r1PpJlysSrV0vmHKkgXPbcgauas1uX Hu+ykdeZSYUaOQuHJlnmDwzFzapE5T9iD9zHIqsl/GiwrkJ+i/n3LIo6+lvX8ofW9DmN 8u6CDhMoeT8xGtEpktZxnEMoKZQPUkDtBLMjoQPewX4DHVPit6aCE217xf7SfM1rBE6V 2nYkZ2jSy8l3GaxhZ9VP3hkhBS67P2yD7QRTW2Xigd86ZpFRJmtgRBrHAuEdPVGgweBy QLaL+n0BULiWTOrGrtTG0HdFxEoeX+kzcD5w0tChli4WsmktQCXi3yGI12xXELL+KM2b 1ifA==
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=oUNoFIiHgCEPc+M/9eDQ87jlD8dWMB2HuRF/p5tvcGs=; b=kQFrda/zfAo3dSKW61ngp6D9ksrVrbDLVZ4z0WM5KHra8vpq7U/Qqq+X5n4NL6oyCP ZwIbqYgzA5/0HsU9rBRSMoJCR9W7ts8RCi6CukjYFn1iRCzwGMJSEHVIN7Ee21HunVEA SEaXKz4X44SBwVw2P43w9AdKWP2tDIA9UtpwzgYNbUGoklbKKnCWd8LPJ8Ox3ZEkFrhE MIIqfpDzGnobz8DV9SqBvT23hyJv3C5LuJH/E39DftDSFbKdk7FxWr6rtfe+eGlEKu3J YA5AnFJcsBilgb9EXc1/GBNmsbDD8gVDANoTeN7kr86Mck0YM7J1jO3P9V+t6NJ0bjpB j2vQ==
X-Gm-Message-State APf1xPDfEFNFmesOUByvcjAg87nALJ/I9WW2rtFCM6ugJvYz6aGR1evl MfcWfGTN5GwXcA7+3XvOEB+ZCcH4ECKTBiTNJrA=
X-Google-Smtp-Source AG47ELuBHXL2+6r+LNmg/nPkGUm53P480vG/AYlpwNuG59p51ZWOjuNobYb6TAXv9khxXtSeFl/nhFGyQWp0UxITEiE=
X-Received by 10.200.26.55 with SMTP id v52mr13320183qtj.53.1519654607327; Mon, 26 Feb 2018 06:16:47 -0800 (PST)
In-Reply-To <877er0qbb7.fsf@gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:400d:c0d::229
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:13748

Show key headers only | View raw


On Mon, Feb 26, 2018 at 12:45 PM, <moosotc@gmail.com> wrote:

>
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
> -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2
> -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt
> -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
> -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
> -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
> -Wno-parentheses -Wno-format-security
> uname output: Linux linmac2 4.15.5-1-ARCH #1 SMP PREEMPT Thu Feb 22
> 22:15:20 UTC 2018 x86_64 GNU/Linux
> Machine Type: x86_64-unknown-linux-gnu
>
> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
>
> Description:
>         Bash rejects valid function definitions
>
> Repeat-By:
>
> $ func() true
> bash: syntax error near unexpected token `true'
>
> # Variant#2
> $ func() { true }
> > ^C
>
> Both forms seem to be valid per [1] and are accepted by (at least)
> ash, zsh and mksh
>
> Worth noting that the Variant#2 can be made to work in bash with an
> addition
> of a semicolon:
>
> $ func() { true; }
>
> [1] http://pubs.opengroup.org/onlinepubs/9699919799/
> utilities/V3_chap02.html
>
> --
> mailto:moosotc@gmail.com
>
>
On the contrary SUS doesn't define either one, as function definition
requires a compound command

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05

and  it requires a delimiter in compound commands

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Function definitions Pierre Gaston <pierre.gaston@gmail.com> - 2018-02-26 16:16 +0200

csiph-web