Skip to content

Commit

Permalink
fix: Don't alert on possible confusion when reading a quoted value in…
Browse files Browse the repository at this point in the history
…cluding a dash in configuration file

Closes #789
  • Loading branch information
g-bougard committed Oct 11, 2024
1 parent dbf463a commit 525217b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Revision history for GLPI agent
core:
* fix #780: Avoid module loading path check error on windows if path includes a
parenthesis
* fix #789: Avoid warning on commandline about possible confusion when reading quoted
configuration value including a dash from configuration file

inventory:
* Fix rare windows perl error during drives, ipv6 network or videos inventory
Expand Down
12 changes: 2 additions & 10 deletions lib/GLPI/Agent/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,7 @@ sub loadFromFile {

# Extract value from quotes or clean any comment including preceding spaces
if ($val =~ /^(['"])([^\1]*)\1/) {
my ($quote, $extract) = ( $1, $2 );
$val =~ s/\s*#.+$//;
warn "Config: We may have been confused for $key quoted value, our extracted value: '$extract'\n"
if ($val ne "$quote$extract$quote");
$val = $extract ;
$val = $2;
} else {
$val =~ s/\s*#.+$//;
}
Expand All @@ -277,11 +273,7 @@ sub loadFromFile {
} elsif ($line =~ /^\s*include\s+(.+)$/i) {
my $include = $1;
if ($include =~ /^(['"])([^\1]*)\1/) {
my ($quote, $extract) = ( $1, $2 );
$include =~ s/\s*#.+$//;
warn "Config: We may have been confused for include quoted path, our extracted path: '$extract'\n"
if ($include ne "$quote$extract$quote");
$include = $extract ;
$include = $2;
} else {
$include =~ s/\s*#.+$//;
}
Expand Down

0 comments on commit 525217b

Please sign in to comment.