From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 31 11:10:19 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FCE816A4DE for ; Mon, 31 Jul 2006 11:10:19 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2601643D73 for ; Mon, 31 Jul 2006 11:10:17 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6VBAGe1054479 for ; Mon, 31 Jul 2006 11:10:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6VBAGrw054478; Mon, 31 Jul 2006 11:10:16 GMT (envelope-from gnats) Resent-Date: Mon, 31 Jul 2006 11:10:16 GMT Resent-Message-Id: <200607311110.k6VBAGrw054478@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Yar Tikhiy 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 X-Send-Pr-Version: 3.113 Cc: Subject: bin/101094: sh(1) can show wrong line numbers in its diagnostic messages X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2006 11:10:19 -0000 >Number: 101094 >Category: bin >Synopsis: sh(1) can show wrong line numbers in its diagnostic messages >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 31 11:10:09 GMT 2006 >Closed-Date: >Last-Modified: >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: >Unformatted: