Kafka
  1. Kafka
  2. KAFKA-1230

shell script files under bin don't work with cygwin (bash on windows)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 0.8.0
    • Fix Version/s: 0.8.3
    • Component/s: tools
    • Labels:
      None
    • Environment:
      The change have been tested under GNU bash, version 4.1.11(2)-release (x86_64-unknown-cygwin) running on Windows 7 Enterprise.

      Description

      Introduction

      This bug is being created for a pull request that I had submitted earlier for these. Per Jun this is so changes confirm to Apache license.

      Background

      The script files to run Kafka under Windows don't work as is. One needs to hand tweak them since their location is not bin but bin/windows. Further, the script files under bin/windows are not a complete replica of those under bin. To be sure, this isn't a complaint. To the contrary most projects now-a-days don't bother to support running on Windows or do so very late. Just that because of these limitation it might be more prudent to make the script files under bin itself run under windows rather than trying to make the files under bin/windows work or to make them complete.

      Change Summary

      Most common unix-like shell on windows is the bash shell which is a part of the cygwin project. Out of the box the scripts don't work mostly due to peculiarities of the directory paths and class path separators. This change set makes a focused change to a single file under bin so that all of the script files under bin would work as is on windows platform when using bash shell of Cygwin distribution.

      Motivation

      Acceptance of this change would enable a vast body of developers that use (or have to use) Windows as their development/testing/production platform to use Kafka's with ease. More importantly by making the running of examples smoothly on Windoes+Cygwin-bash it would make the process of evaluation of Kafka simpler and smoother and potentially make for a favorable evaluation. For, it would show commitment of the Kafka team to espouse deployments on Windows (albeit only under cygwin). Further, as the number of people whom use Kafka on Windows increases, one would attract people who can eventually fix the script files under bin/Windows itself so that need to run under Cygwin would also go away, too.

        Activity

        Hide
        Guozhang Wang added a comment -

        Hi Alok, could you try to rebase on trunk? The current patch failed to apply:

        ---------------------------

        patch p1 < 0001-Added-changes-so-that-bin.sh-files-can-work-with-CY.patch
        patching file bin/kafka-run-class.sh
        Hunk #2 succeeded at 43 with fuzz 1 (offset 3 lines).
        Hunk #3 FAILED at 51.
        1 out of 3 hunks FAILED – saving rejects to file bin/kafka-run-class.sh.rej
        [guwang@guwang-ld2 kafka]$ git diff
        diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh
        index d2fc8c0..a8ddd55 100755
        — a/bin/kafka-run-class.sh
        +++ b/bin/kafka-run-class.sh
        @@ -20,6 +20,18 @@ then
        exit 1
        fi

        +
        +# running with cygwin bash under unix
        +if [[ $(uname -s) = CYGWIN* ]]; then
        + $CYGWIN=1
        +fi
        +
        +if [ -z "$CYGWIN" ]; then
        + PATH_SEPERATOR=":"
        +else
        + PATH_SEPERATOR=";"
        +fi
        +
        base_dir=$(dirname $0)/..

        1. create logs directory
          @@ -31,6 +43,10 @@ if [ ! -d "$LOG_DIR" ]; then
          mkdir -p "$LOG_DIR"
          fi

        +if [ -n "$CYGWIN" ]; then
        + LOG_DIR=`cygpath -m $LOG_DIR`
        +fi
        +
        if [ -z "$SCALA_VERSION" ]; then
        SCALA_VERSION=2.8.0
        fi

        Show
        Guozhang Wang added a comment - Hi Alok, could you try to rebase on trunk? The current patch failed to apply: --------------------------- patch p1 < 0001-Added-changes-so-that-bin .sh-files-can-work-with-CY.patch patching file bin/kafka-run-class.sh Hunk #2 succeeded at 43 with fuzz 1 (offset 3 lines). Hunk #3 FAILED at 51. 1 out of 3 hunks FAILED – saving rejects to file bin/kafka-run-class.sh.rej [guwang@guwang-ld2 kafka] $ git diff diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index d2fc8c0..a8ddd55 100755 — a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -20,6 +20,18 @@ then exit 1 fi + +# running with cygwin bash under unix +if [[ $(uname -s) = CYGWIN* ]]; then + $CYGWIN=1 +fi + +if [ -z "$CYGWIN" ]; then + PATH_SEPERATOR=":" +else + PATH_SEPERATOR=";" +fi + base_dir=$(dirname $0)/.. create logs directory @@ -31,6 +43,10 @@ if [ ! -d "$LOG_DIR" ]; then mkdir -p "$LOG_DIR" fi +if [ -n "$CYGWIN" ]; then + LOG_DIR=`cygpath -m $LOG_DIR` +fi + if [ -z "$SCALA_VERSION" ]; then SCALA_VERSION=2.8.0 fi
        Hide
        Alok Lal added a comment -

        This is from the head of my fork. Please advise if you'd rather get it by me applying on a branch, etc.

        Show
        Alok Lal added a comment - This is from the head of my fork. Please advise if you'd rather get it by me applying on a branch, etc.
        Hide
        Neha Narkhede added a comment -

        Alok Lal Would you like to attach a patch here?

        Show
        Neha Narkhede added a comment - Alok Lal Would you like to attach a patch here?
        Hide
        Jun Rao added a comment -

        Could you generate a patch and attach it to this jira?

        Thanks,

        Show
        Jun Rao added a comment - Could you generate a patch and attach it to this jira? Thanks,
        Hide
        Alok Lal added a comment -

        Hi Jun,
        The changes for these had been submitted via this pull request. Please advise if this is sufficient or if you would like the changes to be sent/attached to this JIRA via some alternate way.

        Show
        Alok Lal added a comment - Hi Jun, The changes for these had been submitted via this pull request. Please advise if this is sufficient or if you would like the changes to be sent/attached to this JIRA via some alternate way.

          People

          • Assignee:
            Unassigned
            Reporter:
            Alok Lal
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 24h
              24h
              Remaining:
              Remaining Estimate - 24h
              24h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development