This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch fix-repeated-single-quoting
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git

commit e7148ec118727b903ae3fc28d0c96f645de095eb
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Tue Mar 25 23:50:05 2025 -0400

    Fix repeated single-quoting of vm.args values
    
    Previously, values which were parsed from vm.args retained their
    single quotes when db_set. Later on, in the postinst script, when we
    replace values in vm.args they got another layer of single quotes.
    
    Fix: #178
---
 debian/couchdb.config | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/couchdb.config b/debian/couchdb.config
index e21d9e7..4d4d317 100755
--- a/debian/couchdb.config
+++ b/debian/couchdb.config
@@ -16,6 +16,7 @@ set -e
 . /usr/share/debconf/confmodule
 
 alias stripwhitespace="sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//'"
+alias stripquote="sed -e 's/^\x27//' -e 's/\x27$//'"
 
 if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
 ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
@@ -82,8 +83,8 @@ promptcookie() {
 
 # if they exist, make current settings debconf's defaults
 if [ -e /opt/couchdb/etc/vm.args ] ; then
-  cookie="$(grep '^-setcookie' /opt/couchdb/etc/vm.args | cut -d ' ' -f 2 | 
stripwhitespace)"
-  nodename="$(grep '^-name' /opt/couchdb/etc/vm.args | cut -d ' ' -f 2 | 
stripwhitespace)"
+  cookie="$(grep '^-setcookie' /opt/couchdb/etc/vm.args | cut -d ' ' -f 2 | 
stripwhitespace | stripquote)"
+  nodename="$(grep '^-name' /opt/couchdb/etc/vm.args | cut -d ' ' -f 2 | 
stripwhitespace | stripquote)"
   if [ -n "$cookie" ]; then
       db_set couchdb/cookie "${cookie}"
   fi
@@ -93,7 +94,7 @@ if [ -e /opt/couchdb/etc/vm.args ] ; then
 fi
 if [ -e /opt/couchdb/etc/local.ini ]; then
   if grep -q '^bind_address =' /opt/couchdb/etc/local.ini; then
-    bindaddress="$(grep '^bind_address' /opt/couchdb/etc/local.ini | cut -d ' 
' -f 3 | stripwhitespace)"
+    bindaddress="$(grep '^bind_address' /opt/couchdb/etc/local.ini | cut -d ' 
' -f 3 | stripwhitespace | stripquote)"
     db_set couchdb/bindaddress "${bindaddress}"
   fi
 fi
@@ -101,7 +102,7 @@ fi
 if [ -d /opt/couchdb/etc/local.d -a ls /opt/couchdb/etc/local.d/*.ini 
>/dev/null 2>&1 ]; then
   for f in $(ls /opt/couchdb/etc/local.d/*.ini); do
     if grep -q '^bind_address =' $f; then
-      bindaddress="$(grep '^bind_address' $f | cut -d ' ' -f 3 | 
stripwhitespace)"
+      bindaddress="$(grep '^bind_address' $f | cut -d ' ' -f 3 | 
stripwhitespace | stripquote)"
       db_set couchdb/bindaddress "${bindaddress}"
     fi
   done

Reply via email to