Skip to contentSkip to conversation

scripts/config: allow setting a string which value contains a colon

PATCH In review Clement Chauplannaz 2 participants 2 messages Nov 17, 2013 – Nov 18, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/config: allow setting a string which value contains a colon

A bug in script config' prevented from modifying an existing variable's value to a string that contains a colon ':'. The reason behind it is that colons are used as a separator in sed' commands that script `config' relies on.

Escape colons in `sed' commands to allow values containing colons.

---
 scripts/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/config +1 -1
index 6804179..4b16260 100755
@@ -78,7 +78,7 @@ txt_append() {
 
 txt_subst() {
 	local before="$1"
-	local after="$2"
+	local after="${2//:/\:}"
 	local infile="$3"
 	local tmpfile="$infile.swp"
 
Signature · 1 line
1.8.3.2.dirty
Acked-by on v1 1/1
#1 lore raw

Clément, All,

On 2013-11-17 12:55 +0100, Clement Chauplannaz spake thusly:

Quoted 8 lines

A bug in script config' prevented from modifying an existing variable's value to a string that contains a colon ':'. The reason behind it is that colons are used as a separator in sed' commands that script `config' relies on.

Escape colons in `sed' commands to allow values containing colons.

It'll be in my tree soon, as a rc-fix. Thank you.

Regards,
Yann E. MORIN.

Quoted 20 lines
---
 scripts/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/config +1 -1
index 6804179..4b16260 100755
@@ -78,7 +78,7 @@ txt_append() {
 
 txt_subst() {
 	local before="$1"
-	local after="$2"
+	local after="${2//:/\:}"
 	local infile="$3"
 	local tmpfile="$infile.swp"
 
Signature · 1 line
1.8.3.2.dirty
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'