GNU bug report logs - #2910
23.0.60; Shell-script coloring bug

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Mon, 6 Apr 2009 22:00:02 UTC

Severity: minor

Tags: confirmed, patch

Merged with 21244, 26217, 30170, 46093, 48193

Found in versions 25.0.95, 25.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2910 in the body.
You can then email your comments to 2910 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2910; Package emacs. (Mon, 06 Apr 2009 22:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 06 Apr 2009 22:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; Shell-script coloring bug
Date: Mon, 6 Apr 2009 22:46:30 +0100 (BST)
In shell-script mode (at least for Shell-script[sh]), in the following line:

for i do

the token “do” is not colored as a keyword, which it should be. From
the relevant POSIX documentation:

http://www.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html#tag_02

The format for the for loop is as follows:

    for name [ in [word ... ]]do
        compound-list


    done

Note that there is no explicit mention of semi-colons (this appears to
be the issue, as if the line is changed to

for i; do

then it is colored correctly, although in fact this syntax is NOT
permitted by POSIX, although bash accepts it.) A semi-colon is only
needed (and indeed, rqeuired) when an “in” clause is used, as the
“word” list mentioned above must end in a semicolon.

Hence, two things seem to need fixing:

1. In Shell-script[sh,bash] modes, “for name do” should color “do” as
   a keyword.

2. In Shell-script[sh], “for name; do” should *not* color “do” as a
   keyword.


In GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.14.3)
 of 2008-10-13 on rothera, modified by Debian
 (emacs-snapshot package, version 1:20081013-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10600000
configured using `configure  '--build' 'i486-linux-gnu' '--host' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/site-lisp:/usr/share/emacs/site-lisp' 
'--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 
'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 
-g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

-- 
http://rrt.sc3d.org/ | impatience, n.  the urge to do nothing
Listening to: 'Sanctus and Benedictus' from 'Mass of the Children and other
sacred music' (The Cambridge Singers / John Rutter)




Severity set to `minor' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 08 Apr 2009 18:55:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2910; Package emacs. (Thu, 09 Apr 2009 06:30:04 GMT) Full text and rfc822 format available.

Message #10 received at 2910 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 2910 <at> debbugs.gnu.org
Subject: Re: bug#2910: 23.0.60; Shell-script coloring bug
Date: Thu, 09 Apr 2009 02:21:53 -0400
The discussion at

http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00040.html

would indicate this was just a "typo" in the online posix docs.
Is any change in Emacs needed?





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2910; Package emacs. (Thu, 09 Apr 2009 11:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 09 Apr 2009 11:15:04 GMT) Full text and rfc822 format available.

Message #15 received at 2910 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 2910 <at> debbugs.gnu.org
Subject: Re: bug#2910: 23.0.60; Shell-script coloring bug
Date: Thu, 9 Apr 2009 12:06:56 +0100 (BST)
On Thu, 9 Apr 2009, Glenn Morris wrote:

>
> The discussion at
>
> http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00040.html
>
> would indicate this was just a "typo" in the online posix docs.
> Is any change in Emacs needed?

If you read the thread again, you'll see that there's no disagreement 
between me and the others over what the correct syntax is, just a 
disagreement over whether the POSIX document does in fact represent it. 
Emacs is definitely getting the coloring wrong.

As Eric Blake says:

Which means the POSIX-mandated syntax should really be represented as:

for name [in [word...] ;] do
  compound-list
done

which neatly demonstrates both the points I raised in my bug report.

-- 
http://rrt.sc3d.org/ | robber, n.  a candid man of affairs (Bierce)




Added tag(s) confirmed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Tue, 05 Jul 2016 02:21:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 25.0.95. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Tue, 05 Jul 2016 02:21:02 GMT) Full text and rfc822 format available.

Forcibly Merged 2910 21244 26217. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Fri, 15 Dec 2017 20:18:02 GMT) Full text and rfc822 format available.

Merged 2910 21244 26217 30170. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Fri, 19 Jan 2018 13:29:01 GMT) Full text and rfc822 format available.

Forcibly Merged 2910 21244 26217 30170 46093. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 02:46:02 GMT) Full text and rfc822 format available.

Removed tag(s) notabug. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 09:13:02 GMT) Full text and rfc822 format available.

Forcibly Merged 2910 21244 26217 30170 46093 48193. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 03 May 2021 15:22:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 14 Oct 2023 12:46:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#2910; Package emacs. (Sat, 14 Oct 2023 15:03:04 GMT) Full text and rfc822 format available.

Message #34 received at 2910-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: Martin Vath <martin <at> mvath.de>, 2910-done <at> debbugs.gnu.org,
 26217-done <at> debbugs.gnu.org
Subject: Re: bug#2910: 23.0.60; Shell-script coloring bug
Date: Sat, 14 Oct 2023 11:01:40 -0400
>> 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





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Nov 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 198 days ago.

Previous Next


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