[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Check bashisms in makefiles
From: |
Greg Chicares |
Subject: |
[lmi] Check bashisms in makefiles |
Date: |
Sun, 23 Oct 2016 11:38:58 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.3.0 |
Vadim, do you know of a better tool to check for bashisms in makefiles
than 'checkbashisms'? Here's what that script says:
--------8<--------8<--------8<--------8<--------8<--------
$checkbashisms --extra --force --posix *make* 2>&1 |sed -e'/does not appear to
have a #! interpreter line/d' -e'/^you may get strange results$/d'
possible bashism in install_mingw.make line 108 (type):
type "$(WGET)" >/dev/null || { $(ECHO) -e $(wget_missing) && false; }
possible bashism in workhorse.make line 983 (echo -n):
fardel_date_script := \
d0=`$(DATE) +%Y-%m-01`; \
d1=`$(DATE) --utc --date="$$d0 + 1 month " +%s`; \
d2=`$(DATE) --utc --date="$$d0 + 2 months" +%s`; \
j1=`expr 2440588 + $$d1 / 86400`; \
j2=`expr 2440588 + $$d2 / 86400`; \
echo -n "$$j1 $$j2" >expiry; \
possible bashism in workhorse.make line 1317 ('$(< foo)' should be '$(cat
foo)'):
@$(DIFF) --brief $(system_test_md5sums) $(touchstone_md5sums) \
&& $(ECHO) "All `<$(touchstone_md5sums) $(WC) -l` files match." \
|| $(MAKE) --file=$(this_makefile) system_test_discrepancies
-------->8-------->8-------->8-------->8-------->8--------
The last one (line 1317) is a false positive: there, $(foo) is a 'make'
variable representing the name of a file we redirect from. The others
are valid, but the list is incomplete--I know that because when I tried
$make release_candidate
I saw this, where the last quoted line has an unwanted literal "-e":
$git diff
diff --git a/version.hpp b/version.hpp
index cb53c48..2cf5edb 100644
--- a/version.hpp
+++ b/version.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Gregory W. Chicares.
+-e // Copyright (C) 2016 Gregory W. Chicares.
Of course, 'dash' has exposed a latent error here:
release_candidate:
@$(ECHO) -e \
$(gpl_notices) \
and it would be best to fix bashisms or zshisms all at once, if only I
had a tool that could detect them all.
- [lmi] Check bashisms in makefiles,
Greg Chicares <=