[PATCH] D41642: lib Fuzzer FreeBSD support

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 10:38:40 PST 2018


dim added inline comments.


================
Comment at: lib/fuzzer/build.sh:1
-#!/bin/bash
+#!/usr/bin/env bash
 LIBFUZZER_SRC_DIR=$(dirname $0)
----------------
krytarowski wrote:
> morehouse wrote:
> > Is this change necessary?  All our shell scripts use `#!/bin/sh` or `#!/bin/bash`.
> This is necessary, better to rewrite it to /bin/sh (POSIX shell) if possible. The env fallback is usually good enough for scripts with bash-specific features.
> 
> There is no bash in the basesystem of BSD. It can be installed optionally and if so, it's located in a different location dedicated for external software - in the NetBSD case, it's /usr/pkg/bin/bash.
I see nothing in this script that requires bash.  Maybe just use `/bin/sh` here?

But indeed, `/bin/bash` is normally only available on Linux.  BSDs put it in a ports or pkgsrc specific installation directory, and that directory will be in the user's `PATH`.

Something similar goes for e.g. perl and python, one should *never* use `/usr/bin/perl` or `/usr/bin/python`, always `/usr/bin/env perl` and `/usr/bin/env python`.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D41642





More information about the llvm-commits mailing list