Debian Bug report logs - #629247
lintian: Please use a decent shell script parser

version graph

Package: lintian; Maintainer for lintian is Debian Lintian Maintainers <[email protected]>; Source for lintian is src:lintian (PTS, buildd, popcon).

Reported by: Niels Thykier <[email protected]>

Date: Sat, 4 Jun 2011 20:33:02 UTC

Severity: wishlist

Found in version lintian/2.5.0

Blocking fix for 253012: lintian: Check all /bin/sh scripts for bashisms, 338005: lintian: Check all /bin/sh scripts for bashisms, 376007: lintian: Check for maintainer scripts that rely on /usr/share/doc, 376183: lintian: Detect maintainer scripts that exit 0 when sourcing fails, 397785: lintian: Warn if a postinst script doesn't understand reconfigure, 398658: lintian: Detect unconditional use of non-essential packages during purge, 406362: lintian: Check for ignoring errors from (invoke|update)-rc.d, 451559: lintian: Check for insecure LD_LIBRARY_PATH usage in wrapper scripts, 495705: lintian: Please improve insecure /tmp checks, 537609: [checks/scripts] warns about commands in never-called shell functions, 567752: lintian: Improve check for conditional use of db_input, 593457: lintian: Check for dpkg-vendor use in maintainer scripts, 714706: lintian: Check for LANG=C

Full log


🔗 View this message in rfc822 format

X-Loop: [email protected]
Subject: Bug#629247: lintian: Lacks a decent shell script parser
Reply-To: "Niels Thykier" <[email protected]>, [email protected]
Resent-From: "Niels Thykier" <[email protected]>
Resent-To: [email protected]
Resent-CC: Debian Lintian Maintainers <[email protected]>
X-Loop: [email protected]
Resent-Date: Sun, 03 Jun 2012 17:27:01 +0000
Resent-Message-ID: <[email protected]>
Resent-Sender: [email protected]
X-Debian-PR-Message: followup 629247
X-Debian-PR-Package: lintian
X-Debian-PR-Keywords: 
X-Debian-PR-Source: lintian
Received: via spool by [email protected] id=B629247.133874433831255
          (code B ref 629247); Sun, 03 Jun 2012 17:27:01 +0000
Received: (at 629247) by bugs.debian.org; 3 Jun 2012 17:25:38 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.1-bugs.debian.org_2005_01_02
	(2010-03-16) on busoni.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham
	version=3.3.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 10; hammy, 97; neutral, 49; spammy, 2.
	spammytokens:0.958-+--H*c:HHHH, 0.954-+--our hammytokens:0.000-+--H*F:U*niels,
	 0.000-+--H*F:D*thykier.net, 0.000-+--lintian, 0.000-+--H*f:sk:2011060,
	0.000-+--H*rp:U*niels
Received: from webmail-out2.one.com ([91.198.169.17])
	by busoni.debian.org with esmtp (Exim 4.72)
	(envelope-from <[email protected]>)
	id 1SbEYb-00084u-Jc
	for [email protected]; Sun, 03 Jun 2012 17:25:38 +0000
Received: from bmail04.one.com (bmail04.one.com [91.198.169.179])
	by webmail-out2.one.com (Postfix) with ESMTP id 2A56F204044F8
	for <[email protected]>; Sun,  3 Jun 2012 19:25:30 +0200 (CEST)
Received: by bmail04.one.com (Postfix, from userid 33)
	id 1BDCF7D23D679; Sun,  3 Jun 2012 19:25:32 +0200 (CEST)
MIME-Version: 1.0
From: "Niels Thykier" <[email protected]>
To: [email protected]
Date: Sun, 03 Jun 2012 19:25:29 +0200
X-Mailer: One.com webmail
X-Sender: [email protected]
X-Originating-Ip: 91.198.169.179
Received: from 91.198.169.179 by webmail.one.com <http://webmail.one.com/>
 with HTTP; Sun, 03 Jun 2012 19:25:29 +0200
In-Reply-To: <[email protected]>
References: <[email protected]>
Content-Type: multipart/mixed; boundary="----------=_1338744330-3651-4"
Message-Id: <[email protected]>
[Message part 1 (text/plain, inline)]
On Jun 4, 2011 22:19 "Niels Thykier" <[email protected]> wrote:
> [...]
> Hey,
> 
> Tracker bug for stuff like #398658.
> 
> ~Niels
>  
> [...]
> 

As far as I can tell, writing a full (and correct) parser for bash
is not going to be trivial.  But we may be able improve the accuracy
of our current ad-hoc parser by adding some "Text::ParseWords" to the
mix.

A fair simple perl snippet (attached) seems to be fairly accurate in
its tokenization of private/refresh-debhelper-data.  I have noticed
two issues so far:
 * Contents of heredocs (<<EOF ... EOF) are tokenized and probably
   shouldn't be.
 * ";" are not split into a separate token if there is no space between
   it and the previous token. (e.g. "if [ ... ]; then")

~Niels


[test.pl (application/x-perl, attachment)]
[refresh-debhelper-data.tok (application/octet-stream, attachment)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 11:37:45 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.