Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-3384

bin scripts may not be portable/POSIX compliant



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s:
    • Fix Version/s:
    • Component/s: None
    • Labels:


      We may be using some important tools in a non-POSIX compliant and non-portable way. In particular, we've discovered that we can sometimes trigger this error:

      /usr/bin/kafka-server-stop: line 22: kill: SIGTERM: invalid signal specification

      which looks like it is caused by invoking a command like kill -SIGTERM <pid>. (This is a lightly modified version of kafka-server-stop.sh, but nothing of relevance has been affected.)

      Googling seems to suggest that passing the signal in that way is not compliant – it's a shell extensions. We're using /bin/sh, but that may be aliased to other more liberal shells on some platforms. To be honest, I'm not sure exactly the requirements for triggering this since running the command directly on the same host via an interactive shell still works, but we are definitely limiting portability using the current approach.

      There are a couple of possible solutions:

      1. Standardize on bash. This lets us make more permissive wrt shell features that we use. We're already using /bin/bash in the majority of scripts anyway. Might help us avoid a bunch of assumptions people make when bash is aliased to sh: https://wiki.ubuntu.com/DashAsBinSh
      2. Try to clean up scripts as we discover incompatibilities. The immediate fix for this issue seems to be to use kill -s TERM instead of kill -SIGTERM.




            • Assignee:
              ewencp Ewen Cheslack-Postava
              ewencp Ewen Cheslack-Postava
              Ewen Cheslack-Postava
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: