[packages/nagios-notify] All these macros seem to be off by one producing '' instead of just 'XYZ'.

arekm arekm at pld-linux.org
Tue May 4 09:30:49 CEST 2021


commit b14b62f80762051569b07122681453ae1372211c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue May 4 09:30:31 2021 +0200

    All these macros seem to be off by one producing '' instead of just 'XYZ'.

 nagios-notify.spec |  2 ++
 off-by.patch       | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
---
diff --git a/nagios-notify.spec b/nagios-notify.spec
index 15c5755..e09a802 100644
--- a/nagios-notify.spec
+++ b/nagios-notify.spec
@@ -9,6 +9,7 @@ Source0:	%{name}-%{version}.tar.bz2
 # Source0-md5:	47c06d14e2944f222fe08298a62ef607
 Patch0:		headers.patch
 Patch1:		duration.patch
+Patch2:		off-by.patch
 URL:		http://glen.alkohol.ee/nagios-notify/
 Requires:	awk
 Requires:	nagios-common
@@ -57,6 +58,7 @@ Powody, dla których dobrze jest używać tego skryptu:
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/off-by.patch b/off-by.patch
new file mode 100644
index 0000000..2357cf2
--- /dev/null
+++ b/off-by.patch
@@ -0,0 +1,57 @@
+diff -urN nagios-notify-0.14.org/nagios-notify nagios-notify-0.14/nagios-notify
+--- nagios-notify-0.14.org/nagios-notify	2021-05-04 09:12:22.586849116 +0200
++++ nagios-notify-0.14/nagios-notify	2021-05-04 09:29:15.795337592 +0200
+@@ -265,7 +265,7 @@
+ 		while (match($0, /\$\(base64:([^)]+)\)/)) {
+ 			pos = length("$(base64:")
+ 			file = substr($0, RSTART + pos, RLENGTH - pos - 1);
+-			left = substr($0, 0, RSTART);
++			left = substr($0, 0, RSTART - 1);
+ 			right = substr($0, RSTART + RLENGTH);
+ 			$0 = left base64(file) right;
+ 		}
+@@ -274,7 +274,7 @@
+ 		while (match($0, /\$\(encode_mime_header:([^,]*,[^)]+)\)/)) {
+ 			pos = length("$(encode_mime_header:")
+ 			params = substr($0, RSTART + pos, RLENGTH - pos - 1);
+-			left = substr($0, 0, RSTART);
++			left = substr($0, 0, RSTART - 1);
+ 			right = substr($0, RSTART + RLENGTH);
+ 			charset = substr(params, 1, index(params, ",") - 1)
+ 			data = substr(params, index(params, ",") + 1)
+@@ -285,7 +285,7 @@
+ 		while (match($0, /\$\(timestamp_date:([^)]+)\)/)) {
+ 			pos = length("$(timestamp_date:")
+ 			data = substr($0, RSTART + pos, RLENGTH - pos - 1);
+-			left = substr($0, 0, RSTART);
++			left = substr($0, 0, RSTART - 1);
+ 			right = substr($0, RSTART + RLENGTH);
+ 			$0 = left timestamp_date(data) right;
+ 		}
+@@ -294,7 +294,7 @@
+ 		while (match($0, /\$\(urlencode:([^)]+)\)/)) {
+ 			pos = length("$(urlencode:")
+ 			data = substr($0, RSTART + pos, RLENGTH - pos - 1);
+-			left = substr($0, 0, RSTART);
++			left = substr($0, 0, RSTART - 1);
+ 			right = substr($0, RSTART + RLENGTH);
+ 			$0 = left urlencode(data) right;
+ 		}
+@@ -302,7 +302,7 @@
+ 		while (match($0, /\$\(unescape:([^)]*)\)/)) {
+ 			pos = length("$(unescape:")
+ 			data = substr($0, RSTART + pos, RLENGTH - pos - 1);
+-			left = substr($0, 0, RSTART);
++			left = substr($0, 0, RSTART - 1);
+ 			right = substr($0, RSTART + RLENGTH);
+ 			$0 = left unescape(data) right;
+ 		}
+@@ -311,7 +311,7 @@
+ 		while (match($0, "\$\(math:("MATH_EXPR") *("MATH_OPS") *("MATH_EXPR")\)")) {
+ 			pos = length("$(math:")
+ 			expr = substr($0, RSTART + pos, RLENGTH - pos - 1);
+-			left = substr($0, 0, RSTART);
++			left = substr($0, 0, RSTART - 1);
+ 			right = substr($0, RSTART + RLENGTH);
+ 			$0 = left math(expr) right;
+ 		}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios-notify.git/commitdiff/b14b62f80762051569b07122681453ae1372211c



More information about the pld-cvs-commit mailing list