[ 
https://issues.apache.org/jira/browse/NIFI-14575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Samkit Jain Ksolves Nifi Expertise reassigned NIFI-14575:
---------------------------------------------------------

    Assignee: Samkit Jain Ksolves Nifi Expertise

> awk in prop_add_or_replace in common.sh missing target file, causes script to 
> hang
> ----------------------------------------------------------------------------------
>
>                 Key: NIFI-14575
>                 URL: https://issues.apache.org/jira/browse/NIFI-14575
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Configuration
>            Reporter: jason
>            Assignee: Samkit Jain Ksolves Nifi Expertise
>            Priority: Minor
>
> In NiFi's {{{}start.sh{}}}, the {{prop_add_or_replace}} function uses {{awk}} 
> to check if a property exists, but does not specify a target file. When the 
> property is not found, {{awk}} waits for stdin, causing the script to hang.
> *Steps to Reproduce:*
> 1. Pick a property key that does *not exist* in your {{nifi.bootstrap.conf}} 
> file, such as:
> export CUSTOM_JAVA_OPT="-Dcustom.option.enabled=true"
>  
> 2. Add the following line to the end of start.sh or run it manually for 
> testing:
> prop_add_or_replace 'java.arg.20' "${CUSTOM_JAVA_OPT}" ${nifi_bootstrap_file} 
>  
>  
> 3. Execute {{{}start.sh{}}}.
> 4. The script will hang at this line because {{awk}} in 
> {{prop_add_or_replace}} does not specify a target file, and the property 
> {{java.arg.20}} does not exist yet.
> h3. *Suggested Fix:*
> Update the {{awk}} command to include the {{{}$target_file{}}}, like so:
> property_found=$(awk -v property="${1}" 'index($0, property) == 1' 
> "$target_file")
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to