lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Check bashisms in makefiles


From: Vadim Zeitlin
Subject: Re: [lmi] Check bashisms in makefiles
Date: Sun, 23 Oct 2016 19:33:02 +0200

On Sun, 23 Oct 2016 16:07:18 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2016-10-23 13:06, Vadim Zeitlin wrote:
GC> > On Sun, 23 Oct 2016 11:38:58 +0000 Greg Chicares <address@hidden> wrote:
GC> > 
GC> > GC> Vadim, do you know of a better tool to check for bashisms in makefiles
GC> > GC> than 'checkbashisms'?
GC> [...]
GC> > https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md
GC> [...]
GC> >  Unfortunately after testing it (it's in Debian, so this was simple,
GC> > although somewhat disappointing as I was almost looking forward to dusting
GC> > off my (barely existent) Haskell skills and compiling it myself), I can 
say
GC> > that running it directly on the makefiles results in tons of warnings
GC> > because it detects make constructs as bad shell code. So to use it, the
GC> > makefiles would need to be preprocessed and shell code extracted from 
them.
GC> > FWIW the project author considered and rejected the idea of doing it (see
GC> > https://github.com/koalaman/shellcheck/issues/58), but I believe it could
GC> > be done reasonably well (with my more advanced Perl skills...), if not
GC> > perfectly, however it would certainly require more time... Should I look
GC> > into doing this?

 Immediately after posting this, I realized that this could, perhaps, be as
simple as just piping the commands shown by "make -n" through shellcheck.
This might not cover everything (although I have trouble coming up with any
examples), but wouldn't this be still useful?

GC> No, thanks. I've tried to avoid nonportable features (in the past, I used
GC> 'ash' to detect problems), so I don't imagine there are many problems.

 As usual, my main concern is not about finding all the problems now, as
I'm indeed quite confident that you will do it and probably in less time
than trying to automate it, but in ensuring no problems are introduced
again in the future -- and an automatic check would be really useful for
that.

 Regards,
VZ


reply via email to

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