Skip to contentSkip to conversation

master - tests: Die on bad argument

PATCH Marian Csontos 2 participants 2 messages Nov 28, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7665304604bad894afed5e372263e48b309927d7
Commit:        7665304604bad894afed5e372263e48b309927d7
Parent:        591ac0828af73ac9a134660a643ef234ff57c02e
Author:        Marian Csontos <[email protected]>
AuthorDate:    Tue Nov 28 09:05:02 2017 +0100
Committer:     Marian Csontos <[email protected]>
CommitterDate: Tue Nov 28 09:21:05 2017 +0100

tests: Die on bad argument

---
 test/lib/aux.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
test/lib/aux.sh +1 -0
index b8a0cc0..97111c7 100644
@@ -911,6 +911,7 @@ common_dev_() {
 
 	for fromlen in "${@-0:}"; do
 		from=${fromlen%%:*}
+		test "$from" = "$fromlen" || die "Bad argument: Missing ':' in FROM:[LEN] argument"
 		len=${fromlen##*:}
 		test -n "$len" || len=$(( size - from ))
 		diff=$(( from - pos ))
#1 lore raw
Quoted 19 lines · Marian Csontos
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7665304604bad894afed5e372263e48b309927d7
Commit:        7665304604bad894afed5e372263e48b309927d7
Parent:        591ac0828af73ac9a134660a643ef234ff57c02e
Author:        Marian Csontos <[email protected]>
AuthorDate:    Tue Nov 28 09:05:02 2017 +0100
Committer:     Marian Csontos <[email protected]>
CommitterDate: Tue Nov 28 09:21:05 2017 +0100

tests: Die on bad argument

---
  test/lib/aux.sh |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
test/lib/aux.sh +0 -0
index b8a0cc0..97111c7 100644

test/lib/aux.sh common_dev_() { · line 914

Quoted 4 lines
test/lib/aux.sh +1 -0
@@ -911,6 +911,7 @@ common_dev_() {
 
  	for fromlen in "${@-0:}"; do
  		from=${fromlen%%:*}
+		test "$from" = "$fromlen" || die "Bad argument: Missing ':' in FROM:[LEN] argument"

Doh! Written the condition reverted.

Quoted 9 lines
test/lib/aux.sh +0 -1
  		len=${fromlen##*:}
  		test -n "$len" || len=$(( size - from ))
  		diff=$(( from - pos ))
 
--

lvm-devel mailing list
lvm-devel at redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

Kabi suggested the intention was to run till the end of device, if : was missing. The actual implementation assigned len=$from without :
- definitely incorrect behavior.

I checked all occurrences and either colon is used, or till the end of device was supposed.

I documented the colon, and are force pushing the fix to remove the noise.

-- Martian