Subject: bug#26217: closed (Re: bug#2910: 23.0.60; Shell-script coloring bug)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 14 Oct 2023 15:03:01 +0000

Your bug report

#26217: 25.2; shell syntax does not know for i do

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
26217: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26217
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#2910: 23.0.60; Shell-script coloring bug
From: Stefan Monnier <[email-masked]>
To: Mauro Aranda <[email-masked]>
Cc: Martin Vath <[email-masked]>, [email-masked], [email-masked]
Date: Sat, 14 Oct 2023 11:01:40 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

>> I haven't found problems, but I'm suspicious because it seems too easy.
> Welcome to the world of Emacs, where "if it's easy it must be right".

BTW, pushed to `master`, thank you.

        Stefan

Subject: 25.2; shell syntax does not know for i do
From: Martin Vath <[email-masked]>
To: [email-masked]
Date: Wed, 22 Mar 2017 10:10:44 +0100 (CET)
List-Id: <debbugs-submit.debbugs.gnu.org>

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.)