Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Manuel Reiter Newsgroups: gnu.bash.bug Subject: error message for missing fi is not helpful Date: Wed, 12 Sep 2018 11:17:39 +0200 Lines: 61 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1536756475 4532 208.118.235.17 (12 Sep 2018 12:47:55 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Virus-Scanned: by amavisd-new at csg.dwd.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Content-Language: uk-UA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 141.38.3.245 X-Mailman-Approved-At: Wed, 12 Sep 2018 08:47:54 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14573 ++ 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-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-7fckc0/bash-4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -no-pie -Wno-parentheses -Wno-format-security uname output: Linux eeyore 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3 (2017-12-03) x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 4.4 Patch Level: 12 Release Status: release ++ Description: When an if statement is not terminated by a fi, bash's error message is not helpful in locating the problem. This was mentioned in http://lists.gnu.org/archive/html/bug-bash/2008-06/msg00105.html but never replied to. I don't know whether bash allows an if statement to be terminated by EOF (as it does for a here document which was the original subject of the cited post) but even if it does, a warning message might be helpful. This applies to case not being terminated by esac (and possibly other commands) as well. ++ Repeat-By: + run the following script in bash: --snip #!/bin/bash if true then exit 0 # fi missing exit 1 -- snip + expected output: ./test.bash: line 2: syntax error: if without corresponding fi or at least ./test.bash: line 2: warning: if without corresponding fi + actual output: ./test.bash: line 8: syntax error: unexpected end of file