GNU bug report logs - #26217
25.2; shell syntax does not know for i do

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Martin Vath <martin@HIDDEN>; Keywords: confirmed; merged with #2910, #21244, #30170; dated Wed, 22 Mar 2017 11:37:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 2910 21244 26217 30170. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 2910 21244 26217. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 21244 26217. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Mar 2017 11:36:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 07:36:18 2017
Received: from localhost ([127.0.0.1]:38698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqeYs-0004dn-3Y
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 07:36:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <martin@HIDDEN>) id 1cqcIK-0007ge-Qu
 for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 05:11:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <martin@HIDDEN>) id 1cqcIE-00066B-9y
 for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 05:10:59 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:34701)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <martin@HIDDEN>) id 1cqcIE-000667-3Z
 for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 05:10:58 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50191)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <martin@HIDDEN>) id 1cqcIC-00020Z-Ux
 for bug-gnu-emacs@HIDDEN; Wed, 22 Mar 2017 05:10:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <martin@HIDDEN>) id 1cqcI8-00065j-VM
 for bug-gnu-emacs@HIDDEN; Wed, 22 Mar 2017 05:10:56 -0400
Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::9]:21928)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <martin@HIDDEN>) id 1cqcI8-00065c-Ll
 for bug-gnu-emacs@HIDDEN; Wed, 22 Mar 2017 05:10:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1490173849;
 l=1026; s=domk; d=mvath.de;
 h=Content-Type:MIME-Version:Subject:To:From:Date;
 bh=Kruo4BuqfYnACEB5d1aNuC/zXe69AZrRzE+HJtxR4qI=;
 b=MmLX2X5dDR5WQsHG6R+PizxvyBaR+wZDZvLRzFqqQ0KO0sQ0eHUHZF6QED6iVhWGaN
 OU0AWiZmBvOZ83U7yJA1nfYStezFiyAPzLT6wwr5/JTQPIrQUsPDq93h+SELQbHlbaXN
 sxQE8BnZxEz8otfXTCfPqg61XIa8ndRf1jEHg=
X-RZG-AUTH: :IW0WYUmmW/LXBXEy1oS2GmByExLj9zw/4tEKkyX4yPukPF7l2T7gNKXmVFk=
X-RZG-CLASS-ID: mo00
Received: from lounge.imp.fu-berlin.de ([160.45.112.18])
 by smtp.strato.de (RZmta 40.1 AUTH) with ESMTPSA id c0b836t2M9AnliY
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with
 521 ECDH bits, eq. 15360 bits RSA))
 (Client did not present a certificate) for <bug-gnu-emacs@HIDDEN>;
 Wed, 22 Mar 2017 10:10:49 +0100 (CET)
Date: Wed, 22 Mar 2017 10:10:44 +0100 (CET)
From: Martin Vath <martin@HIDDEN>
X-X-Sender: vaeth@HIDDEN
To: bug-gnu-emacs@HIDDEN
Subject: 25.2; shell syntax does not know for i do
Message-ID: <alpine.DEB.2.11.1703220953060.31460@HIDDEN>
User-Agent: Alpine 2.11 (DEB 23 2013-08-11)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 22 Mar 2017 07:36:17 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

1. M-x shell-script-mode
2. Type: "
for i do echo 1; done
for i; do echo 1; done
"

Despite both lines are correct full loops according to POSIX
and in fact understood by all current shells (see below),
this does not correspond to the indentation of emacs and
coloring of "do" in the first line.

That the first line is indeed valid by POSIX and understood
by the shells was discussed recently in the German Usegroup
de.comp.os.unix.shell (OT under "Funktion aus find aufrufen"),
but you can also check the grammer for "for_clause" in
http://pubs.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html
noting that it is valid that "linebreak" expands to the empty
string. Another hint that this is intentional in POSIX is the
explicit mentioning of "do" in Section 2.4 of the above page
as the _third_ word in a for command.

Tested on GNU Emacs 25.2.1 and GNU Emacs 24.4.1

(Removing further build data, since the issue was reproduced
on different machines and distributions before reporting.)




Acknowledgement sent to Martin Vath <martin@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#26217; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 19 Jan 2018 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.