Project

General

Profile

Bug #9122

set_simple_config_key is buggy

Added by kytv over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
03/28/2015
Due date:
% Done:

100%

Feature Branch:
bugfix/9122-fix-set_simple_config_key
Type of work:
Code
Blueprint:
Starter:
Affected tool:

Description

set_simple_config_key() in /usr/local/lib/tails-shell-library/common.sh doesn't update config keys but sets them, replacing whatever is in the file.

Here's simple testcase:

root@amnesia:/tmp# cat > testfile << EOF
value1=a
value2=b
value3=c
EOF
root@amnesia:/tmp# cat testfile 
value1=a
value2=b
value3=c
root@amnesia:/tmp# . /usr/local/lib/tails-shell-library/common.sh 
root@amnesia:/tmp# set_simple_config_key value2 "bird" /tmp/testfile
root@amnesia:/tmp# cat /tmp/testfile
value2=bird

Associated revisions

Revision 5bbddc2e (diff)
Added by anonym over 4 years ago

Fix set_simple_config_key() (Will-fix: #9122).

If the key already existed in the config file before the call, all
other lines would be removed due to the sed option -n and p combo.

Revision a9f85067
Added by intrigeri over 4 years ago

Merge branch 'bugfix/9122-fix-set_simple_config_key' into stable

Fix-committed: #9122

History

#1 Updated by intrigeri over 4 years ago

I guess that removing -n and the p command should be enough to fix that.

#2 Updated by anonym over 4 years ago

  • Status changed from Confirmed to In Progress

#3 Updated by anonym over 4 years ago

  • Target version changed from Tails_1.3.2 to Tails_1.4
  • % Done changed from 0 to 50
  • QA Check set to Ready for QA
  • Feature Branch set to bugfix/9122-fix-set_simple_config_key

Indeed, good catch! I've pushed a fix.

Luckily, we weren't hit by the bug in the only placed that function was used, config/chroot_local-includes/usr/local/lib/tails-shell-library/i2p.sh, since by default, the line we want to set doesn't already exist in ${I2P_DEFAULT_CONFIG}/router.config. Delaying until Tails 1.4 since it doesn't affect anything that will end up in Tails 1.3.2.

#4 Updated by intrigeri over 4 years ago

  • Assignee set to intrigeri

#5 Updated by intrigeri over 4 years ago

  • % Done changed from 50 to 60

Code review passes.

#6 Updated by intrigeri over 4 years ago

  • Status changed from In Progress to 11
  • % Done changed from 60 to 100

#7 Updated by BitingBird over 4 years ago

  • QA Check changed from Ready for QA to Pass

#8 Updated by intrigeri over 4 years ago

  • Assignee deleted (intrigeri)

#9 Updated by BitingBird over 4 years ago

  • Status changed from 11 to Resolved

Also available in: Atom PDF