From owner-freebsd-standards@FreeBSD.ORG Fri May 30 18:47:16 2008 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A4561065676 for ; Fri, 30 May 2008 18:47:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id DEDF18FC1D for ; Fri, 30 May 2008 18:47:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m4UIFTQZ028464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 May 2008 21:15:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m4UIFTvK097862; Fri, 30 May 2008 21:15:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m4UIFTiH097861; Fri, 30 May 2008 21:15:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 30 May 2008 21:15:29 +0300 From: Kostik Belousov To: Stefan Farfeleder Message-ID: <20080530181529.GD21317@deviant.kiev.zoral.com.ua> References: <20080530172711.GA1056@lizard.fafoe.narf.at> <20080530181242.GC21317@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="52aklQ8BZHJhx2Z3" Content-Disposition: inline In-Reply-To: <20080530181242.GC21317@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on skuns.kiev.zoral.com.ua Cc: freebsd-standards@freebsd.org Subject: Re: $LINENO within functions X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2008 18:47:16 -0000 --52aklQ8BZHJhx2Z3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 30, 2008 at 09:12:42PM +0300, Kostik Belousov wrote: > On Fri, May 30, 2008 at 07:27:12PM +0200, Stefan Farfeleder wrote: > > Hi, > >=20 > > SUSv3 says the following about $LINENO: > >=20 > > "Set by the shell to a decimal number representing the current > > sequential line number (numbered starting with 1) within a script or > > function before it executes each command. If the user unsets or resets > > LINENO , the variable may lose its special meaning for the life of the > > shell. If the shell is not currently executing a script or function, the > > value of LINENO is unspecified. This volume of IEEE Std 1003.1-2001 > > specifies the effects of the variable only for systems supporting the > > User Portability Utilities option." > >=20 > > My initial interpretation of "or function" was that it means $LINENO > > within a function should be relative to the function's beginning line. > > Now I'm not so sure anymore. Bash release 2.05b changed the expansion > > of $LINENO within functions to absolute numbering, stating this is > > required by POSIX. But then I wonder about the meaning of "or > > function". Does it mean functions in interactive scripts? Because for > > functions in shell scripts the mentioning of both "script" and > > "function" seems redundant. >=20 > I do not know whether you need this data, but ksh93 and pdksh exhibit > the same behaviour as bash. For the rev. 1.1 of lineno.0, I got >=20 > 2 > 3 > 6 > 7 > 12 > 13 > foo > foo > 2 >=20 > On the other hand, zsh produces >=20 > 2 > 3 > 1 > 2 > 12 > 13 > foo > foo > 2 Oh, and /usr/xpg4/bin/sh on the fully patches Solaris 10 output is identical with the zsh one. --52aklQ8BZHJhx2Z3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkhAREAACgkQC3+MBN1Mb4gFHQCcDFBQCWRK2E+kUbaLtStA1Lzr RzYAnArb2W1EibQJmwrgDweI+VSb5OrM =x9Xp -----END PGP SIGNATURE----- --52aklQ8BZHJhx2Z3--