File: unescaped-left-brace-in-regex.patch

package info (click to toggle)
nagios-plugin-check-multi 0.26-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,172 kB
  • sloc: perl: 2,296; makefile: 415; sh: 239
file content (37 lines) | stat: -rw-r--r-- 1,546 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: Escape left brace in regex.
 Quoting perldelta:
 "
  A literal "{" should now be escaped in a pattern
 .
  If you want a literal left curly bracket (also called a left brace) in
  a regular expression pattern, you should now escape it by either
  preceding it with a backslash ("\{") or enclosing it within square
  brackets "[{]", or by using \Q; otherwise a deprecation warning will be
  raised. This was first announced as forthcoming in the v5.16 release;
  it will allow future extensions to the language to happen.
 "
 http://search.cpan.org/dist/perl-5.22.0/pod/perldelta.pod#A_literal_%22{%22_should_now_be_escaped_in_a_pattern
Author: Bas Couwenberg <sebastic@debian.org>
Bug: https://github.com/flackem/check_multi/issues/12
Forwarded: https://github.com/flackem/check_multi/pull/16

--- a/plugins/check_multi.in
+++ b/plugins/check_multi.in
@@ -1227,7 +1227,7 @@ sub parse_objects_cache {
 	}
 	while (<OBJECTS_CACHE>) {
 		#--- begin of object, determine type
-		if (/^define ([a-z0-9\_\-]+) {$/) {
+		if (/^define ([a-z0-9\_\-]+) \{$/) {
 			$type="$1";
 			$typelist{$type}++;
 			$objectcount++;
@@ -3217,7 +3217,7 @@ sub report_all {
 
 	#--- some debugging first
 	DEBUG4("MULTI Environment (sorted):\n\t".join("\n\t",get_env_vars('^MULTI')));
-	DEBUG4("${NAGIOS} Environment (sorted):\n\t".join("\n\t",get_env_vars('^${NAGIOS}')));
+	DEBUG4("${NAGIOS} Environment (sorted):\n\t".join("\n\t",get_env_vars('^$\{NAGIOS}')));
 
 	#--- construction site for persistence
 	if ($opt{set}{test} && $opt{set}{persistent}) {