Config file corrupted by options containing the ampersand character (&)

Bug #1983816 reported by Nobuhiro MIKI
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
devstack
Fix Released
High
Unassigned

Bug Description

Attempting to set a value containing the ampersand character (&) by iniset would corrupt the value.
Here is an example.

$ iniset /etc/glance/glance-api.conf database connection 'mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8&plugin=dbcounter'

When the above iniset is called multiple times, the value would be corrupted as follows.

# First time
connection = mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8&plugin=dbcounter

# Second time
connection = mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8connection = mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8&plugin=dbcounterplugin=dbcounter

# Third time
connection = mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8connection = mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8connection = mysql+pymysql://root:stackdb@127.0.0.1/glance?charset=utf8&plugin=dbcounterplugin=dbcounterplugin=dbcounter

This is reproduced in a very simple example as follows
$ iniset /tmp/dummy database connection '&y'

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to devstack (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/devstack/+/852378

Changed in devstack:
status: New → In Progress
Changed in devstack:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to devstack (master)

Reviewed: https://review.opendev.org/c/openstack/devstack/+/852378
Committed: https://opendev.org/openstack/devstack/commit/d266c87b1d3ecae1b40589832efc9bf7cf3e524c
Submitter: "Zuul (22348)"
Branch: master

commit d266c87b1d3ecae1b40589832efc9bf7cf3e524c
Author: Nobuhiro MIKI <email address hidden>
Date: Mon Aug 8 16:45:31 2022 +0900

    iniset: fix handling of values containg ampersand

    Attempting to set a value containing the ampersand
    character (&) by iniset would corrupt the value.
    So, add an escaping process.

    Signed-off-by: Nobuhiro MIKI <email address hidden>
    Closes-Bug: #1983816
    Change-Id: Ie2633bacd2d761d110e6cb12f95382325c329415

Changed in devstack:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.