ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-722

zkServer.sh uses sh's builtin echo on BSD, behaves incorrectly.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.0
    • Fix Version/s: 3.3.1, 3.4.0
    • Component/s: scripts
    • Labels:
      None
    • Environment:

      Mac OS X

    • Hadoop Flags:
      Reviewed
    • Release Note:
      Fix zkServer.sh script for BSD systems.

      Description

      zkServer.sh output the PID of the zookeeper process with:
      echo -n $! > "$ZOOPIDFILE"

      This uses -n which sh's builtin echo does not support. From echo's manpage.
      <snip>
      Some shells may provide a builtin echo command which is similar or identical to this utility. Most notably, the builtin echo in sh(1) does not accept
      the -n option. Consult the builtin(1) manual page.
      </snip>

      This means that echo -n PID > ZOOPIDFILE will mean the contents of ZOOPIDFILE will be "-n PID". This stops zkServer.sh stop from working correctly.

      1. zk-722.diff
        0.4 kB
        Ivan Kelly

        Activity

        Hide
        Ivan Kelly added a comment -

        Fix by making zk use the echo executable directly when -n in use.

        Show
        Ivan Kelly added a comment - Fix by making zk use the echo executable directly when -n in use.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12439463/zk-722.diff
        against trunk revision 925362.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no tests are needed for this patch.

        -1 patch. The patch command could not apply the patch.

        Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/35/console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12439463/zk-722.diff against trunk revision 925362. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no tests are needed for this patch. -1 patch. The patch command could not apply the patch. Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/35/console This message is automatically generated.
        Hide
        Henry Robinson added a comment -

        Hi Ivan -

        Thanks for the patch - it looks good.

        Hudson can't apply it because - I think - you used git diff to generate the patch file which doesn't produce patch -p0 compatible patchfiles. Could you regenerate with git diff --no-prefix and resubmit? Hudson will be able to apply the patch then.

        Thanks.
        Henry

        Show
        Henry Robinson added a comment - Hi Ivan - Thanks for the patch - it looks good. Hudson can't apply it because - I think - you used git diff to generate the patch file which doesn't produce patch -p0 compatible patchfiles. Could you regenerate with git diff --no-prefix and resubmit? Hudson will be able to apply the patch then. Thanks. Henry
        Hide
        Ivan Kelly added a comment -

        Hi Henry,

        I had assumed it used -p1, I've resubmitted the patch now without the
        prefixes.

        -Ivan

        Show
        Ivan Kelly added a comment - Hi Henry, I had assumed it used -p1, I've resubmitted the patch now without the prefixes. -Ivan
        Hide
        Henry Robinson added a comment -

        Assigning back to Ivan after I gave Hudson a kick

        Show
        Henry Robinson added a comment - Assigning back to Ivan after I gave Hudson a kick
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12439471/zk-722.diff
        against trunk revision 925362.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no tests are needed for this patch.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed core unit tests.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/36/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/36/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/36/console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12439471/zk-722.diff against trunk revision 925362. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no tests are needed for this patch. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/36/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/36/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h1.grid.sp2.yahoo.net/36/console This message is automatically generated.
        Hide
        Patrick Hunt added a comment -

        this is a shell script change, no test for those currently.

        Please review for commit, prolly should verify on unix/mac/cygwin.

        Show
        Patrick Hunt added a comment - this is a shell script change, no test for those currently. Please review for commit, prolly should verify on unix/mac/cygwin.
        Hide
        Patrick Hunt added a comment -

        Patch looks good, verified for linux/cygwin.

        Show
        Patrick Hunt added a comment - Patch looks good, verified for linux/cygwin.
        Hide
        Patrick Hunt added a comment -

        +1 Thanks Ivan!

        Show
        Patrick Hunt added a comment - +1 Thanks Ivan!

          People

          • Assignee:
            Ivan Kelly
            Reporter:
            Ivan Kelly
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development