Skip to content

hack scripts doesn't respect $PATH #1104

Closed

Description

@Lillecarl

What steps did you take:

Attempted to run kapp's build and test scripts (located in hack/ directory) on a system where bash is not located at /bin/bash (e.g., NixOS, some BSD variants, or custom configurations).

What happened:

Scripts fail to execute because they use hardcoded shebang paths like #!/bin/bash and #!/bin/sh, which assume the shell interpreter is in a specific location.

What did you expect:

Scripts should be portable and work across different Unix-like systems regardless of where the shell interpreter is installed. Using #!/usr/bin/env bash and #!/usr/bin/env sh allows the system to locate the interpreter via the PATH environment variable.

Anything else you would like to add:

This affects all shell scripts in the hack/ directory:

  • hack/build-and-lint.sh
  • hack/build-binaries.sh
  • hack/build.sh
  • hack/linter.sh
  • hack/test-all.sh
  • hack/test-e2e.sh
  • hack/test-external-loop-cert-manager.sh
  • hack/test-external.sh
  • hack/test.sh
  • hack/verify-no-dirty-files.sh

Systems where this is particularly relevant:

  • NixOS: Bash is located at /run/current-system/sw/bin/bash
  • Some BSD systems: May have bash in /usr/local/bin/bash
  • Custom environments: Where bash is installed in non-standard locations

Using /usr/bin/env is the POSIX-recommended approach for portable shell scripts and is already widely adopted in the Go ecosystem (many vendor scripts already use this pattern).

Environment:

  • kapp version: N/A (affects repository scripts, not runtime)
  • OS: Any non-standard Unix-like system (NixOS, BSD variants, etc.)
  • Kubernetes version: N/A (repository/build issue)

Activity

  1. added
    bugThis issue describes a defect or unexpected behavior
    carvel triageThis issue has not yet been reviewed for validity
    on Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a defect or unexpected behavior

    Type

    No type

    Projects

    • Status
      Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions