From yar@jujik.ramtel.ru Mon Jul 31 11:08:00 2006 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75A7E16A4E0 for ; Mon, 31 Jul 2006 11:08:00 +0000 (UTC) (envelope-from yar@jujik.ramtel.ru) Received: from jujik.ramtel.ru (jujik.ramtel.ru [81.19.64.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB44D43D70 for ; Mon, 31 Jul 2006 11:07:16 +0000 (GMT) (envelope-from yar@jujik.ramtel.ru) Received: from jujik.ramtel.ru (localhost [127.0.0.1]) by jujik.ramtel.ru (8.13.7/8.13.7) with ESMTP id k6VB71dO072271 for ; Mon, 31 Jul 2006 15:07:01 +0400 (MSD) (envelope-from yar@jujik.ramtel.ru) Received: (from yar@localhost) by jujik.ramtel.ru (8.13.7/8.13.7/Submit) id k6VB71HR072264; Mon, 31 Jul 2006 15:07:01 +0400 (MSD) (envelope-from yar) Message-Id: <200607311107.k6VB71HR072264@jujik.ramtel.ru> Date: Mon, 31 Jul 2006 15:07:01 +0400 (MSD) From: Yar Tikhiy To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: sh(1) can show wrong line numbers in its diagnostic messages X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 101094 >Category: bin >Synopsis: sh(1) can show wrong line numbers in its diagnostic messages >Confidential: no >Severity: non-critical >Priority: medium >Responsible: yar >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 31 11:10:09 GMT 2006 >Closed-Date: Sun Aug 06 10:49:17 GMT 2006 >Last-Modified: Sun Aug 06 10:49:17 GMT 2006 >Originator: Yar Tikhiy >Release: FreeBSD 7.0-CURRENT i386 >Organization: None >Environment: System: FreeBSD jujik.ramtel.ru 7.0-CURRENT FreeBSD 7.0-CURRENT #6: Tue Jun 27 14:45:05 MSD 2006 glebius@jujik.ramtel.ru:/usr/obj/usr/src/sys/JUJIK i386 >Description: sh(1) tries to keep track of the number of the current line in the current script file. The main use of this is in diagnostic messages, such as "%s: %d: Syntax error ...", which come very helpful when debugging complex scripts. However, the line numbering is broken as soon as a line continuation is encountered. >How-To-Repeat: Example 1: %cat -b test.sh 1 foo="\ 2 1\ 3 2\ 4 3\ 5 " 6 esac %sh -n test.sh test.sh: 2: Syntax error: "esac" unexpected Example 2: %cat -b test2.sh 1 echo \ 2 1\ 3 2\ 4 3\ 5 4 6 esac %sh -n test2.sh test2.sh: 3: Syntax error: "esac" unexpected In both cases, the error actually was in line 6. On the other hand: %cat -b test3.sh 1 echo \ 2 1 \ 3 2 \ 4 3 \ 5 4 6 esac %sh -n test3.sh test3.sh: 6: Syntax error: "esac" unexpected In this case, the line number is correct. Perhaps the problem appears when a single shell word is split across multiple lines. >Fix: >Release-Note: >Audit-Trail: State-Changed-From-To: open->patched State-Changed-By: yar State-Changed-When: Mon Jul 31 11:32:52 UTC 2006 State-Changed-Why: I've just fixed this issue in src/bin/sh/parser.c#1.57. MFC is due. Responsible-Changed-From-To: freebsd-bugs->yar Responsible-Changed-By: yar Responsible-Changed-When: Mon Jul 31 11:32:52 UTC 2006 Responsible-Changed-Why: I've just fixed this issue in src/bin/sh/parser.c#1.57. MFC is due. http://www.freebsd.org/cgi/query-pr.cgi?pr=101094 State-Changed-From-To: patched->closed State-Changed-By: yar State-Changed-When: Sun Aug 6 10:47:51 UTC 2006 State-Changed-Why: The fix appeared simple enough to allow for merging it to all active RELENG_ branches: 6, 5, and 4. http://www.freebsd.org/cgi/query-pr.cgi?pr=101094 >Unformatted: