unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/4] configure: fix some shellcheck warnings
@ 2016-04-13 18:32 Jani Nikula
  2016-04-13 18:32 ` [PATCH 1/4] configure: SC2006: Use $(..) instead of deprecated `..` Jani Nikula
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Jani Nikula @ 2016-04-13 18:32 UTC (permalink / raw)
  To: notmuch

TIL about shellcheck [1]. Played with it a bit. Seems useful.

$ shellcheck --exclude 2086 --shell sh configure

BR,
Jani.

[1] http://www.shellcheck.net/


Jani Nikula (4):
  configure: SC2006: Use $(..) instead of deprecated `..`
  configure: SC2059: Don't use variables in the printf format string.
  configure: SC2034: glib_cflags and glib_ldflags appear unused.
  configure: SC2016: Expressions don't expand in single quotes

 configure | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] configure: SC2006: Use $(..) instead of deprecated `..`
  2016-04-13 18:32 [PATCH 0/4] configure: fix some shellcheck warnings Jani Nikula
@ 2016-04-13 18:32 ` Jani Nikula
  2016-04-13 18:32 ` [PATCH 2/4] configure: SC2059: Don't use variables in the printf format string Jani Nikula
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2016-04-13 18:32 UTC (permalink / raw)
  To: notmuch

Fix shellcheck warnings.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 4fc31ccf8e79..0c6cdb01bbe0 100755
--- a/configure
+++ b/configure
@@ -250,7 +250,7 @@ if [ -z "$LIBDIR" ] ; then
     libdir_expanded="${PREFIX}/lib"
 else
     # very non-general variable expansion
-    libdir_expanded=`echo "$LIBDIR" | sed "s|\\${prefix}|${PREFIX}|g; s|\\$prefix/|${PREFIX}/|; s|//*|/|g"`
+    libdir_expanded=$(echo "$LIBDIR" | sed "s|\\${prefix}|${PREFIX}|g; s|\\$prefix/|${PREFIX}/|; s|//*|/|g")
 fi
 
 cat <<EOF
@@ -542,7 +542,7 @@ fi
 libdir_in_ldconfig=0
 
 printf "Checking which platform we are on... "
-uname=`uname`
+uname=$(uname)
 if [ $uname = "Darwin" ] ; then
     printf "Mac OS X.\n"
     platform=MACOSX
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] configure: SC2059: Don't use variables in the printf format string.
  2016-04-13 18:32 [PATCH 0/4] configure: fix some shellcheck warnings Jani Nikula
  2016-04-13 18:32 ` [PATCH 1/4] configure: SC2006: Use $(..) instead of deprecated `..` Jani Nikula
@ 2016-04-13 18:32 ` Jani Nikula
  2016-04-13 18:32 ` [PATCH 3/4] configure: SC2034: glib_cflags and glib_ldflags appear unused Jani Nikula
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2016-04-13 18:32 UTC (permalink / raw)
  To: notmuch

Fix shellcheck warnings. Use printf "..%s.." "$foo".
---
 configure | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 0c6cdb01bbe0..d4f56b905cce 100755
--- a/configure
+++ b/configure
@@ -387,7 +387,7 @@ EOF
     else
 	default_xapian_backend=chert
     fi
-    printf "${default_xapian_backend}\n";
+    printf "%s\n" "${default_xapian_backend}";
     rm -rf test.db _default_backend _default_backend.cc
 fi
 # we need to have a version >= 2.6.5 to avoid a crypto bug. We need
@@ -461,7 +461,7 @@ for name in ${PYTHON} python python2 python3; do
     if command -v $name > /dev/null; then
 	have_python=1
 	python=$name
-	printf "Yes ($name).\n"
+	printf "Yes (%s).\n" "$name"
 	break
     fi
 done
@@ -560,11 +560,11 @@ elif [ $uname = "OpenBSD" ] ; then
     platform=OPENBSD
     linker_resolves_library_dependencies=0
 elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
-    printf "$uname\n"
+    printf "%s\n" "$uname"
     platform="$uname"
     linker_resolves_library_dependencies=1
 
-    printf "Checking for $libdir_expanded in ldconfig... "
+    printf "Checking for %s in ldconfig... " "$libdir_expanded"
     ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
     # Separate ldconfig_paths only on newline (not on any potential
     # embedded space characters in any filenames). Note, we use a
@@ -815,7 +815,7 @@ for flag in -Wall -Wextra -Wwrite-strings; do
 	WARN_CXXFLAGS="${WARN_CXXFLAGS}${WARN_CXXFLAGS:+ }${flag}"
     fi
 done
-printf "\n\t${WARN_CXXFLAGS}\n"
+printf "\n\t%s\n" "${WARN_CXXFLAGS}"
 
 WARN_CFLAGS="${WARN_CXXFLAGS}"
 printf "Checking for available C compiler warning flags... "
@@ -825,7 +825,7 @@ for flag in -Wmissing-declarations; do
 	WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
     fi
 done
-printf "\n\t${WARN_CFLAGS}\n"
+printf "\n\t%s\n" "${WARN_CFLAGS}"
 
 rm -f minimal minimal.c _libversion.c _libversion _libversion.sh
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] configure: SC2034: glib_cflags and glib_ldflags appear unused.
  2016-04-13 18:32 [PATCH 0/4] configure: fix some shellcheck warnings Jani Nikula
  2016-04-13 18:32 ` [PATCH 1/4] configure: SC2006: Use $(..) instead of deprecated `..` Jani Nikula
  2016-04-13 18:32 ` [PATCH 2/4] configure: SC2059: Don't use variables in the printf format string Jani Nikula
@ 2016-04-13 18:32 ` Jani Nikula
  2016-04-13 18:32 ` [PATCH 4/4] configure: SC2016: Expressions don't expand in single quotes Jani Nikula
  2016-04-27 18:14 ` [PATCH 0/4] configure: fix some shellcheck warnings Tomi Ollila
  4 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2016-04-13 18:32 UTC (permalink / raw)
  To: notmuch

Fix shellcheck warnings.

---

The alternative would be to actually set and and use the results, but
it's a bit redundant as it's all in the gime flags anyway.
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d4f56b905cce..f3498e3ef244 100755
--- a/configure
+++ b/configure
@@ -413,8 +413,9 @@ have_glib=0
 if pkg-config --exists 'glib-2.0 >= 2.22'; then
     printf "Yes.\n"
     have_glib=1
-    glib_cflags=$(pkg-config --cflags glib-2.0)
-    glib_ldflags=$(pkg-config --libs glib-2.0)
+    # these are included in gmime cflags and ldflags
+    # glib_cflags=$(pkg-config --cflags glib-2.0)
+    # glib_ldflags=$(pkg-config --libs glib-2.0)
 else
     printf "No.\n"
     errors=$((errors + 1))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] configure: SC2016: Expressions don't expand in single quotes
  2016-04-13 18:32 [PATCH 0/4] configure: fix some shellcheck warnings Jani Nikula
                   ` (2 preceding siblings ...)
  2016-04-13 18:32 ` [PATCH 3/4] configure: SC2034: glib_cflags and glib_ldflags appear unused Jani Nikula
@ 2016-04-13 18:32 ` Jani Nikula
  2016-04-27 18:14 ` [PATCH 0/4] configure: fix some shellcheck warnings Tomi Ollila
  4 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2016-04-13 18:32 UTC (permalink / raw)
  To: notmuch

Fix shellcheck warnings. Use double quotes but escape $ to make it
look more intentional.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index f3498e3ef244..6231d2b7ed2b 100755
--- a/configure
+++ b/configure
@@ -491,11 +491,11 @@ else
 fi
 
 if [ -z "${EMACSLISPDIR}" ]; then
-    EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
+    EMACSLISPDIR="\$(prefix)/share/emacs/site-lisp"
 fi
 
 if [ -z "${EMACSETCDIR}" ]; then
-    EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
+    EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
 fi
 
 printf "Checking if emacs is available... "
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] configure: fix some shellcheck warnings
  2016-04-13 18:32 [PATCH 0/4] configure: fix some shellcheck warnings Jani Nikula
                   ` (3 preceding siblings ...)
  2016-04-13 18:32 ` [PATCH 4/4] configure: SC2016: Expressions don't expand in single quotes Jani Nikula
@ 2016-04-27 18:14 ` Tomi Ollila
  2016-05-02  0:25   ` David Bremner
  4 siblings, 1 reply; 7+ messages in thread
From: Tomi Ollila @ 2016-04-27 18:14 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Wed, Apr 13 2016, Jani Nikula <jani@nikula.org> wrote:

> TIL about shellcheck [1]. Played with it a bit. Seems useful.
>
> $ shellcheck --exclude 2086 --shell sh configure
>
> BR,
> Jani.
>
> [1] http://www.shellcheck.net/
>
>
> Jani Nikula (4):

This series looks tolerable to me, with a slight change in first commit msg:

>   configure: SC2006: Use $(..) instead of deprecated `..`

This is what older shellcheck outputs, but newer has fixed this to be

   configure: SC2006: Use $(..) instead of legacy `..`

When testing in http://www.shellcheck.net/

Line 1:
foo=`echo x`
^-- SC2034: foo appears unused. Verify it or export it.
    ^-- SC2006: Use $(..) instead of legacy `..`.
    ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd
    foo'.

This is the shellcheck commit (s/deprecated/legacy/ for backtick warnings.):

https://github.com/koalaman/shellcheck/commit/895d83afc5f4dec7dc9813a2688c45b96d6f7b7c

based on these I suggest commit message amend before pushing (?)

Tomi


>   configure: SC2059: Don't use variables in the printf format string.
>   configure: SC2034: glib_cflags and glib_ldflags appear unused.
>   configure: SC2016: Expressions don't expand in single quotes
>
>  configure | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
>
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] configure: fix some shellcheck warnings
  2016-04-27 18:14 ` [PATCH 0/4] configure: fix some shellcheck warnings Tomi Ollila
@ 2016-05-02  0:25   ` David Bremner
  0 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2016-05-02  0:25 UTC (permalink / raw)
  To: Tomi Ollila, Jani Nikula, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

>
> This is the shellcheck commit (s/deprecated/legacy/ for backtick warnings.):
>
> https://github.com/koalaman/shellcheck/commit/895d83afc5f4dec7dc9813a2688c45b96d6f7b7c
>
> based on these I suggest commit message amend before pushing (?)
>

OK, amended and pushed.

d

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-05-02  0:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 18:32 [PATCH 0/4] configure: fix some shellcheck warnings Jani Nikula
2016-04-13 18:32 ` [PATCH 1/4] configure: SC2006: Use $(..) instead of deprecated `..` Jani Nikula
2016-04-13 18:32 ` [PATCH 2/4] configure: SC2059: Don't use variables in the printf format string Jani Nikula
2016-04-13 18:32 ` [PATCH 3/4] configure: SC2034: glib_cflags and glib_ldflags appear unused Jani Nikula
2016-04-13 18:32 ` [PATCH 4/4] configure: SC2016: Expressions don't expand in single quotes Jani Nikula
2016-04-27 18:14 ` [PATCH 0/4] configure: fix some shellcheck warnings Tomi Ollila
2016-05-02  0:25   ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).