Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-3103

Environment Variables with spaces are truncated when written to properties file

    XMLWordPrintable

Details

    • False
    • False
    • Undefined
    • Hide

      set a CONNECT_ environment variable to a value that contains a space.  Run the docker image and inspect connect-distributed.properties.

       

      I have distilled the issue here:

      #!/usr/bin/env bash
      export CONNECT_VAR_WITH_SPACE="some text with spaces" 
      echo "old way"
      for VAR in `env` 
      do 
        env_var=`echo "$VAR" | gsed -r "s/(.*)=.*/\1/g"` 
        if [[ $env_var =~ ^CONNECT ]]; then 
          prop_name=`echo "$VAR" | gsed -r "s/^CONNECT_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .` 
          echo "$prop_name=${!env_var}" 
        fi 
      done
      echo "new way" 
      for VAR in `env` 
      do 
        env_var=`echo "$VAR" | gsed -r "s/(.*)=.*/\1/g"` 
        if [[ $env_var =~ ^CONNECT ]]; then 
          prop_name=`echo "$VAR" | gsed -r "s/^CONNECT_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .` 
          prop_value=`echo "$VAR" | gsed -r "s/^CONNECT_.*=(.*)/\1/g"` 
          echo "$prop_name=${prop_value}" 
        fi 
      done
      

      which outputs:

       

      $ ./test.sh
      old way
      var.with.space=some text with spaces
      new way
      var.with.space=some
      

       

      Show
      set a CONNECT_ environment variable to a value that contains a space.  Run the docker image and inspect connect-distributed.properties.   I have distilled the issue here: #!/usr/bin/env bash export CONNECT_VAR_WITH_SPACE= "some text with spaces" echo "old way" for VAR in `env` do env_var=`echo "$VAR" | gsed -r "s/(.*)=.*/\1/g" ` if [[ $env_var =~ ^CONNECT ]]; then prop_name=`echo "$VAR" | gsed -r "s/^CONNECT_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .` echo "$prop_name=${!env_var}" fi done echo " new way" for VAR in `env` do env_var=`echo "$VAR" | gsed -r "s/(.*)=.*/\1/g" ` if [[ $env_var =~ ^CONNECT ]]; then prop_name=`echo "$VAR" | gsed -r "s/^CONNECT_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .` prop_value=`echo "$VAR" | gsed -r "s/^CONNECT_.*=(.*)/\1/g" ` echo "$prop_name=${prop_value}" fi done which outputs:   $ ./test.sh old way var .with.space=some text with spaces new way var .with.space=some  

    Description

      DBZ-3019 introduced a regression in the ENV to properties file routine in the docker-entrypoint.sh.

      After this PR, any CONNECT_ environment value has the value truncated at the first space before it is written to the properties value.  This is problematic for anyone using JAAS.

       

       

      Attachments

        Issue Links

          Activity

            People

              jpechane Jiri Pechanec
              wadesherman Wade Sherman (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: