summaryrefslogtreecommitdiff
path: root/debian/patches/0110-fix_malformed_messages.patch
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-07-09 13:45:27 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-07-09 13:45:27 +0200
commit98174eb94ca345f6567455bc9d33fe94381e5587 (patch)
treeed3ff1924425904e37e9e441fc3fc58cd71eb234 /debian/patches/0110-fix_malformed_messages.patch
parent1b768f75a3b056c2482867359d9928776788bf95 (diff)
New d/p/0110-fix_malformed_messages.patch
Diffstat (limited to 'debian/patches/0110-fix_malformed_messages.patch')
-rw-r--r--debian/patches/0110-fix_malformed_messages.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/debian/patches/0110-fix_malformed_messages.patch b/debian/patches/0110-fix_malformed_messages.patch
new file mode 100644
index 0000000..d9c744a
--- /dev/null
+++ b/debian/patches/0110-fix_malformed_messages.patch
@@ -0,0 +1,66 @@
+Description: do not abort if sensor command fails
+Origin: upstream
+Bug: https://github.com/arcress0/ipmiutil/issues/17
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040349
+Forwarded: no
+Last-Update: 2023-07-09
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/util/isensor.c
+===================================================================
+--- trunk.orig/util/isensor.c
++++ trunk/util/isensor.c
+@@ -1332,13 +1332,14 @@ int GetSDR(int r_id, int *r_next, uchar
+ if (sresp < (thislen+2)) {
+ /* There are some SDRs that may report the wrong length, and
+ * return less bytes than they reported, so just truncate. */
++ fprintf(stderr,"SDR record %x is malformed, length %d is less than minimum %d\n",r_id,sresp,thislen+2);
+ if (fdebug) printf("sdr[%x] off=%d, expected %d, got %d\n",
+ r_id,off,thislen+2,sresp);
+ if (sresp >= 2) thislen = sresp - 2;
+ else thislen = 0;
+ reclen = off + thislen; /* truncate, stop reading */
+- fprintf(stderr,"SDR record %x is malformed, length %d is less than minimum %d\n",r_id,sresp,thislen+2);
+- rc = ERR_SDR_MALFORMED;
++ /* auto-corrected, so not a fatal error */
++ // rc = ERR_SDR_MALFORMED;
+ }
+ /* successful */
+ memcpy(&resp[off],&respchunk[2],thislen);
+Index: trunk/doc/ipmiutil.spec
+===================================================================
+--- trunk.orig/doc/ipmiutil.spec
++++ trunk/doc/ipmiutil.spec
+@@ -210,6 +210,10 @@ rm -rf %{buildroot}
+ vardir=%{_var}/lib/%{name}
+ scr_dir=%{_datadir}/%{name}
+
++if [ ! -f %{_datadir}/%{name}/ipmiutil.env ]; then
++ cp %{_datadir}/%{name}/ipmiutil.env.template %{_datadir}/%{name}/ipmiutil.env
++fi
++
+ # Install right scripts/service files no matter install or upgrade
+ %if 0%{?req_systemd}
+ %service_add_post ipmi_port.service ipmiutil_evt.service ipmiutil_asy.service ipmiutil_wdt.service
+@@ -217,9 +221,6 @@ scr_dir=%{_datadir}/%{name}
+ if [ -x /bin/systemctl ] && [ -d %{unit_dir} ]; then
+ # Replace if exists, append if not.
+ # Use # as the sed delimiter to prevent handling slash in the path.
+- if [ ! -f %{_datadir}/%{name}/ipmiutil.env ]; then
+- cp %{_datadir}/%{name}/ipmiutil.env.template %{_datadir}/%{name}/ipmiutil.env
+- fi
+ grep -q 'IINITDIR' %{_datadir}/%{name}/ipmiutil.env \
+ && sed -i 's#^IINITDIR=.*#IINITDIR=%{init_dir}#' %{_datadir}/%{name}/ipmiutil.env \
+ || echo "IINITDIR=%{init_dir}" >> %{_datadir}/%{name}/ipmiutil.env
+@@ -274,8 +275,9 @@ then
+ # Capture a snapshot of IPMI sensor data once now for later reuse.
+ sensorout=$vardir/sensor_out.txt
+ if [ ! -f $sensorout ]; then
+- %{_bindir}/ipmiutil sensor -q >$sensorout || :
+- if [ $? -ne 0 ]; then
++ IPMIret=1
++ %{_bindir}/ipmiutil sensor -q >$sensorout && IPMIret=0
++ if [ $IPMIret -ne 0 ]; then
+ # remove file if error, try again in ipmi_port on reboot.
+ rm -f $sensorout
+ fi