diff --git a/SOURCES/bz1503979.patch b/SOURCES/bz1503979.patch new file mode 100644 index 0000000..8d52b9a --- /dev/null +++ b/SOURCES/bz1503979.patch @@ -0,0 +1,44 @@ +commit c8c24917452665d3ea42019f8700c9164bf3091a +Author: Martin Cermak +Date: Mon Aug 28 13:01:40 2017 +0200 + + PR22005: Fix @min() and @max() extractor functions. + + Commit 26382d613f4d26 introduced a regression in @min() + and @max() extractor functions. Example: + + $ stap -e 'global n probe oneshot {n<<<12 n<<<34 println(@max(n))}' + 12 + $ + + This commit fixes the regression and adds a testcase. + +diff --git a/runtime/stat-common.c b/runtime/stat-common.c +index 764d84c..835fe62 100644 +--- a/runtime/stat-common.c ++++ b/runtime/stat-common.c +@@ -307,9 +307,9 @@ static inline void __stp_stat_add(Hist st, stat_data *sd, int64_t val, + sd->count++; + if(stat_op_sum) + sd->sum += val; +- if (stat_op_min && (val > sd->max)) ++ if (stat_op_max && (val > sd->max)) + sd->max = val; +- if (stat_op_max && (val < sd->min)) ++ if (stat_op_min && (val < sd->min)) + sd->min = val; + /* + * Below, we use Welford's online algorithm for computing variance. +diff --git a/testsuite/systemtap.base/pr22005.exp b/testsuite/systemtap.base/pr22005.exp +new file mode 100644 +index 0000000..c760fdc +--- /dev/null ++++ b/testsuite/systemtap.base/pr22005.exp +@@ -0,0 +1,7 @@ ++set test_name "pr22005" ++ ++set ::result_string "34" ++stap_run2 -e "global l probe oneshot \{l<<<12 l<<<34 println(@max(l))\}" ++ ++set ::result_string "21" ++stap_run2 -e "global l probe oneshot \{l<<<43 l<<<21 println(@min(l))\}" diff --git a/SPECS/systemtap.spec b/SPECS/systemtap.spec index ad42aa8..065c0fa 100644 --- a/SPECS/systemtap.spec +++ b/SPECS/systemtap.spec @@ -72,7 +72,7 @@ Name: systemtap Version: 3.1 -Release: 3%{?dist} +Release: 4%{?dist} # for version, see also configure.ac @@ -197,6 +197,7 @@ Patch17: bz1431263.5.patch Patch18: bz1430828.patch Patch19: bz1433391.patch Patch20: bz1436845.patch +Patch21: bz1503979.patch # Install requirements Requires: systemtap-client = %{version}-%{release} @@ -495,6 +496,7 @@ cd .. %patch18 -p1 %patch19 -p1 %patch20 -p1 +%patch21 -p1 %build @@ -1163,6 +1165,9 @@ done # PRERELEASE %changelog +* Thu Oct 19 2017 Frank Ch. Eigler - 3.1-4 +- rhbz1503979 @min/@max miscalculation + * Thu Mar 30 2017 David Smith - 3.1-3 - Added patches for: - rhbz1425568 task_dentry_path() fix