Project

General

Profile

Bug #2729

Potential error in set_var

Added by Burt Holzman over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
02/10/2013
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
First Occurred:
Occurs In:
Stakeholders:
Duration:

Description

While thinking about disabling JAVA, I noticed:

We have this line:
var_val=`grep "^$var_name " $config_file | awk '{print substr($0,index($0,$2))}'`

where it's trying to parse something like
FOO BAR BAZ
$var_name=FOO
$var_val=BAR BAZ

However, if the config file mistakenly only has a single argument:
FOO
then var_val=FOO -- because $2 is empty, the awk expression does something that wasn't intended.

I'll add some code to address this (although if people use the helper functions, this should never happen).


Subtasks

Bug #3454: set_var still fails under certain condtionsClosedParag Mhashilkar

History

#1 Updated by Burt Holzman almost 8 years ago

  • Target version set to v2_7_x

#2 Updated by Burt Holzman almost 8 years ago

  • Status changed from Assigned to Feedback
  • Assignee changed from Burt Holzman to John Weigand

Committed to branch_v2plus_2729.

#3 Updated by John Weigand almost 8 years ago

Burt,

Can you indicate what modules you changed or, at the least,
when the hash codes are? Unless there is an easier way to find
it, let me know.

John Weigand

#4 Updated by Burt Holzman almost 8 years ago

Oh, sorry, it's branch_v2plus_2729. After a git fetch origin:

git log -p branch_v2plus..branch_v2plus_2729

(or git show 5059fca)

- B

#5 Updated by John Weigand almost 8 years ago

  • Assignee changed from John Weigand to Burt Holzman

After talking with Burt, the condition that potentially
causes the problem is one in which whitespace after the
first value mistakenly generates the incorrect behavior
due to the way the 'index' command works in awk. With the old
code In this case, there is no $2
This works:
"FOO"
This does not:
"FOO "
Very subtle and hard to catch.

Change looks good.
OK to merge.

John Weigand

#6 Updated by Burt Holzman almost 8 years ago

  • Status changed from Feedback to Resolved

Merged in v2plus and master.

#7 Updated by Parag Mhashilkar over 7 years ago

  • Target version changed from v2_7_x to v2_7

#8 Updated by Parag Mhashilkar over 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF