Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-14976

Set HADOOP_SHELL_EXECNAME explicitly in scripts

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Some Hadoop shell scripts infer their own name using this bit of shell magic:

       18     MYNAME="${BASH_SOURCE-$0}"
       19     HADOOP_SHELL_EXECNAME="${MYNAME##*/}"
      

      e.g. see the hdfs script.

      The inferred shell script name is later passed to hadoop-functions.sh which uses it to construct the names of some environment variables. E.g. when invoking hdfs datanode, the options variable name is inferred as follows:

      # HDFS + DATANODE + OPTS -> HDFS_DATANODE_OPTS
      

      This works well if the calling script name is standard hdfs or yarn. If a distribution renames the script to something like foo.bar, , then the variable names will be inferred as FOO.BAR_DATANODE_OPTS. This is not a valid bash variable name.

        Attachments

        1. HADOOP-14976.01.patch
          2 kB
          Arpit Agarwal
        2. HADOOP-14976.02.patch
          9 kB
          Arpit Agarwal
        3. HADOOP-14976.03.patch
          7 kB
          Arpit Agarwal
        4. HADOOP-14976.04.patch
          7 kB
          Arpit Agarwal

          Activity

            People

            • Assignee:
              arpitagarwal Arpit Agarwal
              Reporter:
              arpitagarwal Arpit Agarwal
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: