You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Samkit Jain Ksolves Nifi Expertise (Jira)" <ji...@apache.org> on 2025/08/18 03:11:00 UTC
[jira] (NIFI-14575) awk in prop_add_or_replace in common.sh missing target file, causes script to hang
[ https://issues.apache.org/jira/browse/NIFI-14575 ]
Samkit Jain Ksolves Nifi Expertise deleted comment on NIFI-14575:
-----------------------------------------------------------
was (Author: JIRAUSER310019):
Hi [~jian659]
Tested on the current NiFi codebase (2.6.0-SNAPSHOT).
* The bash function {{prop_add_or_replace}} in {{common.sh}} no longer exists in the codebase.
* Properties are now handled by the Java bootstrap ({{{}BootstrapProcess.java{}}}).
* Starting NiFi using {{./nifi.sh start}} works normally.
* Verified that a non-existent property (e.g., {{{}java.arg.20{}}}) does not cause the script to hang.
* {{bootstrap.conf}} confirms that {{java.arg.20}} is not defined.
*Conclusion:* The original issue reported in NIFI-14575 is obsolete in the current codebase. No hang occurs during startup, so no changes are required on the bash scripts.
> 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)