Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14920

Bash build issues in `devel' branch due to -Werror compiler flag

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Eduardo A. Bustamante López <dualbus@gmail.com>
Newsgroups gnu.bash.bug
Subject Bash build issues in `devel' branch due to -Werror compiler flag
Date Sat, 15 Dec 2018 23:35:49 -0800
Lines 155
Approved bug-bash@gnu.org
Message-ID <mailman.5796.1544945758.1284.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1544945759 28394 208.118.235.17 (16 Dec 2018 07:35:59 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=+FQXCimeUbFif3ZEdY1dLsCogIEG/BynQmeW/6k0TaA=; b=UEYTn96p/coYdKVf5eBY4GydKOWpXxLXFjypoYoSOO1qppgxQjdcX7AvKY5BsgRaDh HOjGBMmGZifbGWULylNBflAOFLFPqJ2t/0WX8WsbCQ9c+4ON9XFS178xEDamkOPEeqFj 9ZASAs6e09irEyj/GuKko17+nMsxNLK+OBafLIpGaCQsa8ubOnvm4yNuRzpkfdG7eTeN 45pQAdAZwpE0XYK3FE3+9wRK31IDFqehPBo0WFEDuFQXaGMfkSTeVe2RafT70L5U8MZV 2smY64m/IOKrVICB6RqNoR8BV8VDqudb4zQfvGg7ob1GPuOaTqQ8DwKPcEVDFo1SbPa6 d9RA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:content-transfer-encoding :user-agent; bh=+FQXCimeUbFif3ZEdY1dLsCogIEG/BynQmeW/6k0TaA=; b=CEkwP+m92GI4SdJTQLTW2jpXd6yT5XlGpLIGIf7dEcvbCQQZGQXq5hen/heiI7a7rW nBupbGWFQWm5xv0u5z1Y3DkPVbPa03BwZdEf0h2Ty6UqG7fb1QBUpLLlgzAy1vQ2fI+V BH3uPFGPaTq/fiOouI18nm2QsMC7dnI746CI7Fga5CIRvAQcdfXAS2Vw5D9gegailGFT hqiJitnDz5x9EpReS5eLXh5hgNrou7TrqjCxA78uTnduTE2rxr077SbXATMVEbs81YyB 4gMle7DaTBkPZvjI8cHKf059Y5WY4NFKfp8ZjXpHseeOwpy1XxK49Rw5b7UunDzIATjR jbdw==
X-Gm-Message-State AA+aEWYdQewzYfbKGAHszFae1Q8c3uU+C86MDabSQsorwshDA83ksvgK Q57Pk3Ja+Iajxh6seTyq7UMKYo66
X-Google-Smtp-Source AFSGD/VC8YpxOATZ8C1UtYEopoGDOpNCj89R//EuiiJBTjmYl8iY0m2zH6MZK/wNyWBoajJmf59tLA==
X-Received by 2002:a62:cf02:: with SMTP id b2mr9200964pfg.183.1544945751574; Sat, 15 Dec 2018 23:35:51 -0800 (PST)
Mail-Followup-To bug-bash@gnu.org
Content-Disposition inline
User-Agent Mutt/1.10.1 (2018-07-13)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::52d
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14920

Show key headers only | View raw


Commit 9d80be9ab5cc17011c634e0348c64c15fcba95bf adds the following compiler flag:

  dualbus@debian:~/src/gnu/bash$ cat -n configure.ac | grep Werror -C3
    1159		CFLAGS="$CFLAGS -Wno-parentheses -Wno-format-security"
    1160		if test -n "$DEBUG"
    1161		then
  ~>1162			CFLAGS="$CFLAGS -Werror"
    1163		fi
    1164	fi
    1165	

During build (with gcc):

  dualbus@debian:~/src/gnu/bash$ make -j$(nproc) -s
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  ./parse.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  expr.c:217:17: error: conflicting types for built-in function ‘exp2’ [-Werror=builtin-declaration-mismatch]
   static intmax_t exp2 __P((void));
                   ^~~~
  cc1: all warnings being treated as errors


I know the `exp2' function here has nothing to do with the built-in exponential
function, and that it has had that name for a long time, but the build breaks due to that.

To hack around it, I renamed it from `exp2' to `exp22', and then it broke here:

  dualbus@debian:~/src/gnu/bash$ make -j$(nproc) -s
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  
        ***********************************************************
        *                                                         *
        * GNU bash, version 5.0.0(1)-rc1 (x86_64-pc-linux-gnu)
        *                                                         *
        ***********************************************************
  
  making lib/glob/libglob.a in ./lib/glob
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  smatch.c: In function ‘_fnmatch_fallback_wc’:
  smatch.c:318:11: error: implicit declaration of function ‘fnmatch’; did you mean ‘gmatch’? [-Werror=implicit-function-declaration]
     return (fnmatch ((const char *)w2, (const char *)w1, 0));
             ^~~~~~~
             gmatch


Which I believe is an actual issue and I assume the fix is along the lines of:

  dualbus@debian:~/src/gnu/bash$ git diff -- lib/
  diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c
  index 3826c93e..9150a28e 100644
  --- a/lib/glob/smatch.c
  +++ b/lib/glob/smatch.c
  @@ -25,6 +25,7 @@
                                  
   #include "strmatch.h"
   #include <chartypes.h>
  +#include <fnmatch.h>
   
   #include "bashansi.h"
   #include "shmbutil.h"


I'm not sure what to do about `exp2' though. Personally, I'd love for these
functions to have slighly more meaningful names.


I also tried clang version 7.0.1-+rc3-2, which gives an additional error:

  making lib/sh/libsh.a in ./lib/sh
  (...)
  getenv.c:55:7: error: comparison of nonnull parameter 'name' equal to a null pointer is 'false' on first encounter [-Werror,-Wtautological-pointer-compare]
    if (name == 0 || *name == '\0')
        ^~~~    ~
  /usr/include/stdlib.h:631:50: note: declared 'nonnull' here
  extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
                                                   ^
  /usr/include/x86_64-linux-gnu/sys/cdefs.h:293:44: note: expanded from macro '__nonnull'
  # define __nonnull(params) __attribute__ ((__nonnull__ params))


This is due to the stdlib.h header being pulled by bashansi.h in
lib/sh/getenv.c, thus, providing a function signature that doesn't match Bash's
re-definition of getenv():

  dualbus@debian:~/src/gnu/bash$ grep bashansi.h lib/sh/getenv.c 
  #include <bashansi.h>
  
  dualbus@debian:~/src/gnu/bash$ grep stdlib.h bashansi.h 
  #  include <stdlib.h>
  #  include "ansi_stdlib.h"


~~~


Additional information:

gcc:

  dualbus@debian:~/src/gnu/bash$ cc -v
  Using built-in specs.
  COLLECT_GCC=cc
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
  OFFLOAD_TARGET_NAMES=nvptx-none
  OFFLOAD_TARGET_DEFAULT=1
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Debian 8.2.0-12' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 8.2.0 (Debian 8.2.0-12) 

clang:

  dualbus@debian:~/src/gnu/bash$ clang -v
  clang version 7.0.1-+rc3-2 (tags/RELEASE_701/rc3)
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/bin
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
  Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
  Candidate multilib: .;@m64
  Selected multilib: .;@m64

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Bash build issues in `devel' branch due to -Werror compiler flag Eduardo A. Bustamante López <dualbus@gmail.com> - 2018-12-15 23:35 -0800

csiph-web