Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RFC: Letting bash print an XML syntax dump

0 views
Skip to first unread message

jens.sc...@arcor.de

unread,
Dec 4, 2009, 4:46:45 AM12/4/09
to bug-...@gnu.org
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!

savelog
savelog.xml
0 new messages