mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-26 01:02:25 +08:00
Extra tweaks due to feedback from kaiwangchen: ; starts comments if at the start of a line
This commit is contained in:
+1
-1
@@ -310,7 +310,7 @@ sub parse_option_file {
|
|||||||
# Parse the "var=val" lines.
|
# Parse the "var=val" lines.
|
||||||
my ($config, $dupes) = _parse_varvals(
|
my ($config, $dupes) = _parse_varvals(
|
||||||
map { $_ =~ m/^([^=]+)(?:=(.*))?$/ }
|
map { $_ =~ m/^([^=]+)(?:=(.*))?$/ }
|
||||||
grep { $_ !~ m/^\s*#/ } # no # comment lines
|
grep { $_ !~ m/^\s*[#;]/ } # no # comment lines
|
||||||
split("\n", $mysqld_section)
|
split("\n", $mysqld_section)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -849,6 +849,12 @@ is(
|
|||||||
"..and removing comments doesn't leave trailing whitespace"
|
"..and removing comments doesn't leave trailing whitespace"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
is_deeply(
|
||||||
|
[ sort keys %{$config->variables} ],
|
||||||
|
[qw( password something user )],
|
||||||
|
"start of line comments with # or ; are ignored"
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|||||||
@@ -2,3 +2,7 @@
|
|||||||
user=mysql # comment
|
user=mysql # comment
|
||||||
password="password # still part of it!"# comment
|
password="password # still part of it!"# comment
|
||||||
something='something ; or # another' # comment
|
something='something ; or # another' # comment
|
||||||
|
;semicolon="start of line comment with ;"
|
||||||
|
#pound="start of line comment with #"
|
||||||
|
;spacecolon
|
||||||
|
#spacepound
|
||||||
|
|||||||
Reference in New Issue
Block a user