lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Check bashisms in makefiles


From: Greg Chicares
Subject: Re: [lmi] Check bashisms in makefiles
Date: Sun, 23 Oct 2016 16:07:18 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.3.0

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

No, thanks. I've tried to avoid nonportable features (in the past, I used
'ash' to detect problems), so I don't imagine there are many problems.
There will be fewer once I fix the 'dash' incompatibilities; I was just
hoping there might be a tool that already does an exhaustive analysis so
that I wouldn't have to fix things piecemeal.

But 'grep' suffices to find non-posix 'echo' options. And there are some
other oversights like this:

    An interpreter is required for all cross-compiled binaries, but
    none was specified for 'generate_passkey'.

--- a/workhorse.make
+++ b/workhorse.make
@@ -1052,7 +1052,7 @@ wrap_fardel:
        @$(CP) --preserve $(fardel_binaries) $(fardel_files) .
        @$(fardel_date_script)
        @$(MD5SUM) --binary $(fardel_checksummed_files) >validated.md5
-       @$(bin_dir)/generate_passkey > passkey
+       @$(PERFORM) $(bin_dir)/generate_passkey > passkey

that I'm going to have to fix as they arise anyway.




reply via email to

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