Uploaded image for project: 'Chukwa'
  1. Chukwa
  2. CHUKWA-453

Shell scripts should use !/bin/bash not !/bin/sh

    Details

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

      Description

      Some of the scripts uses the function key word which is a feature in bash and not supported in shell.
      Running the agent.sh for example gives bin/agent.sh: 24: function: not found

      The script headers should be changes to !/bin/bash and then it works.
      I propose this be done for all of the sh scripts for consistency.

      I'll attach a patch today.

      1. CHUKWA-453-ENVBASH.patch
        14 kB
        Gerrit Jansen van Vuuren
      2. CHUKWA-453.patch
        9 kB
        Gerrit Jansen van Vuuren

        Activity

        Hide
        hudson Hudson added a comment -
        Show
        hudson Hudson added a comment - Integrated in Chukwa-trunk #330 (See http://hudson.zones.apache.org/hudson/job/Chukwa-trunk/330/ )
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        Great!!.

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - Great!!.
        Hide
        asrabkin Ari Rabkin added a comment -

        Committed new patch.

        Show
        asrabkin Ari Rabkin added a comment - Committed new patch.
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        Ignore the unable to render embedded object message this should be:

        changed all entries of /bin/bash to /usr/bin/env bash as per Eric's request above

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - Ignore the unable to render embedded object message this should be: changed all entries of /bin/bash to /usr/bin/env bash as per Eric's request above
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        changed all entries of #Unable to render embedded object: File (/bin/bash to #) not found./usr/bin/env bash

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - changed all entries of # Unable to render embedded object: File (/bin/bash to #) not found. /usr/bin/env bash
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        Resubmitting patch with change #Unable to render embedded object: File (/bin/bash to #) not found./usr/bin/env bash

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - Resubmitting patch with change # Unable to render embedded object: File (/bin/bash to #) not found. /usr/bin/env bash
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        Pleasure.

        Eric mentioned changing the /bin/bash to #!/usr/bin/env bash.
        I've finally got round to applying these changes, I'll submit the patch with these new changes.

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - Pleasure. Eric mentioned changing the /bin/bash to #!/usr/bin/env bash. I've finally got round to applying these changes, I'll submit the patch with these new changes.
        Hide
        asrabkin Ari Rabkin added a comment -

        Err, should have said "thanks, Gerrit." Momentary brain damage on my part.

        Show
        asrabkin Ari Rabkin added a comment - Err, should have said "thanks, Gerrit." Momentary brain damage on my part.
        Hide
        asrabkin Ari Rabkin added a comment -

        I just committed this; thanks, Jensen!

        Show
        asrabkin Ari Rabkin added a comment - I just committed this; thanks, Jensen!
        Hide
        eyang Eric Yang added a comment -

        Yes please go ahead.

        Show
        eyang Eric Yang added a comment - Yes please go ahead.
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        Yep better, shall I make the change on the other scripts that already had #!/bin/bash?
        That way all the .sh scripts start with #!/usr/bin/env bash

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - Yep better, shall I make the change on the other scripts that already had #!/bin/bash? That way all the .sh scripts start with #!/usr/bin/env bash
        Hide
        eyang Eric Yang added a comment -

        I think it should be:

        #!/usr/bin/env bash

        Just in case.

        Show
        eyang Eric Yang added a comment - I think it should be: #!/usr/bin/env bash Just in case.
        Hide
        gerritjvv Gerrit Jansen van Vuuren added a comment -

        The patch only modifies the sh files that have !/bin/sh and makes it !/bin/bash

        I've noticed that some of the .sh files already had !/bin/bash and some of the helper scripts like start-all.sh have !/usr/bin/env bash.

        Show
        gerritjvv Gerrit Jansen van Vuuren added a comment - The patch only modifies the sh files that have !/bin/sh and makes it !/bin/bash I've noticed that some of the .sh files already had !/bin/bash and some of the helper scripts like start-all.sh have !/usr/bin/env bash.

          People

          • Assignee:
            Unassigned
            Reporter:
            gerritjvv Gerrit Jansen van Vuuren
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development