-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7X] gpconfig does not escape '$' char
Issue: gpconfig is not able to set the guc correctly if the value contains '$'. It considers the string as a shell var and evaluates it, instead of escaping the '$' character [~/workspace/gpdb/gpMgmt: {main} ?]$ gpconfig --verbose -c dynamic_library_path -v '$libdir:/foo/bar' 20230906:11:33:38:023885 gpconfig:-[INFO]:-completed successfully with parameters '--verbose -c dynamic_library_path -v '$libdir:/foo/bar'' [~/workspace/gpdb/gpMgmt: {main} ?]$ gpstop -u 20230906:11:35:17:024203 gpstop:xx-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 7.0.0-beta.4+dev.254.g1621aed51f build dev' 20230906:11:35:17:024203 gpstop:xx-[INFO]:-Signalling all postmaster processes to reload [~/workspace/gpdb/gpMgmt: {main} ?]$ gpconfig -s dynamic_library_path Values on all segments are consistent GUC : dynamic_library_path Coordinator value: :/foo/bar Segment value: :/foo/bar Reason: gpconfig does not encode the guc value when invoking the gpconfig_helper script to add the guc parameter to postgressql.conf. Just quotes the value using shlex.quote().Value is sent as qouted plain text hence the $ char is not escaped and the value string is considered as shell variable. shlex.quote() is not efficient enough to add escape char ('/') before '$' in guc value. This issue does not exist in 6X as value is encoded using base64.urlsafe_b64encode() then sent to segment hosts. Fix: Encoding the value at coordinator and then decoding it on segment host will make sure that value string is intact. Reverted the gpconfig changes done in commit 50b06308db1e3f0b4e310c25f4501e6f11884d6a which introduced the use of shlex.quote() to qoute the guc values instead of encoding it. After fix: [~/workspace/gpdb/gpMgmt: {gpconfig-issue} ?]$ gpconfig -c dynamic_library_path -v '$libdir:/foo/bar' 20230915:16:55:55:054429 gpconfig:-[INFO]:-completed successfully with parameters '-c dynamic_library_path -v '$libdir:/foo/bar'' [~/workspace/gpdb/gpMgmt: {gpconfig-issue} ?]$ gpstop -u 20230915:16:56:11:054645 gpstop:-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 7.0.0-beta.4+dev.254.g1621aed51f build dev' 20230915:16:56:11:054645 gpstop:-[INFO]:-Signalling all postmaster processes to reload [~/workspace/gpdb/gpMgmt: {gpconfig-issue} ?]$ gpconfig -s dynamic_library_path Values on all segments are consistent GUC : dynamic_library_path Coordinator value: $libdir:/foo/bar Segment value: $libdir:/foo/bar (cherry picked from commit 9383cb7612dbd7e2e05100e85e0ac47c763fa03c)
- Loading branch information
1 parent
2e16543
commit be6897c
Showing
4 changed files
with
18 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters