bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: Letting bash print an XML syntax dump


From: jens . schmidt35
Subject: RFC: Letting bash print an XML syntax dump
Date: Fri, 4 Dec 2009 10:46:45 +0100 (CET)

Hi, bash folks,

for a larger shell-based project I wanted to have definit answers to questions 
like

- are all redirections to log handle 3 done when the log handle is actually 
open?
- are all calls to grep handled properly (either return value or output 
ignored)?
- are all calls to exit valid?

Parsing shell syntax by means of Perl regexps turned to out to be hard and 
unreliable.

So I added a new bash commandline option '--dump-syntax' that lets bash dump an 
XML-based syntax tree of the input script.  The rest of the job was relatively 
easy using Perl and Perl-based XPath queries.  (As a side-effect, bash also 
checks the syntax of process and command substitutions, what option "-n" would 
not do.)  And now that I have my bashlint perl script I start getting adicted 
to it - every time I come across a stupid bug in my code I start thinking how 
bashlint could have detected that bug.

I work for a closed-source software company and I would need extra paperwork to 
release the (bash-4.0-based) patch under the GPL.  I already asked the bash 
maintainer (who found the idea interesting) and he proposed to ask the bash 
society for feedback before starting the paperwork.

Please let me know what you think.

Regards

Jens

Es weihnachtet sehr! Vom leckerem Backrezept bis zum leckeren Schneehasen 
finden Sie alles im Weihnachtsspecial von Arcor.de:
http://www.arcor.de/rd/footer.weihnachten
Feliz Navidad, God Yul, Merry X-Mas und ein frohes Fest!

Attachment: savelog
Description: Binary data

Attachment: savelog.xml
Description: XML document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]