diff --git a/.gitignore b/.gitignore index e91624b..37fd8ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -SOURCES/mdevctl-0.81.tar.gz +SOURCES/mdevctl-1.1.0-vendor.tar.gz +SOURCES/mdevctl-1.1.0.tar.gz diff --git a/.mdevctl.metadata b/.mdevctl.metadata index 42f0f91..88d5cc6 100644 --- a/.mdevctl.metadata +++ b/.mdevctl.metadata @@ -1 +1,2 @@ -31f9227e45d30cb9214e6683d7533d319a075d64 SOURCES/mdevctl-0.81.tar.gz +3741595d871a00830c5b3c50f383eeda9f948469 SOURCES/mdevctl-1.1.0-vendor.tar.gz +4bbd9e344db7324765572def56201d6fd6611057 SOURCES/mdevctl-1.1.0.tar.gz diff --git a/SOURCES/0001-Report-root-error-when-a-callout-can-t-be-executed.patch b/SOURCES/0001-Report-root-error-when-a-callout-can-t-be-executed.patch new file mode 100644 index 0000000..f0eb44f --- /dev/null +++ b/SOURCES/0001-Report-root-error-when-a-callout-can-t-be-executed.patch @@ -0,0 +1,43 @@ +From ff69f6c64b14282172716d4e97b4b81da7606483 Mon Sep 17 00:00:00 2001 +From: Jonathon Jongsma +Date: Wed, 1 Dec 2021 16:37:36 -0600 +Subject: [PATCH 1/2] Report root error when a callout can't be executed + +We were ignoring the error result when a callout script failed to +execute. In order to debug issues more easily, handle the error and +print it to the debug output. + +Signed-off-by: Jonathon Jongsma +--- + src/callouts.rs | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/callouts.rs b/src/callouts.rs +index 1c92d85..17b733b 100644 +--- a/src/callouts.rs ++++ b/src/callouts.rs +@@ -240,8 +240,8 @@ impl Callout { + for s in dir.as_ref().read_dir().ok()? { + let path = s.ok()?.path(); + +- match self.invoke_script(dev, &path, event, action).ok() { +- Some(res) => { ++ match self.invoke_script(dev, &path, event, action) { ++ Ok(res) => { + if res.status.code().is_none() { + warn!("callout script {:?} was terminated by a signal", path); + continue; +@@ -255,8 +255,8 @@ impl Callout { + ); + } + } +- _ => { +- debug!("failed to execute callout script {:?}", path); ++ Err(e) => { ++ debug!("failed to execute callout script {:?}: {:?}", path, e); + continue; + } + } +-- +2.33.1 + diff --git a/SOURCES/0002-tests-read-stdin-in-callout-test-scripts.patch b/SOURCES/0002-tests-read-stdin-in-callout-test-scripts.patch new file mode 100644 index 0000000..9cd616b --- /dev/null +++ b/SOURCES/0002-tests-read-stdin-in-callout-test-scripts.patch @@ -0,0 +1,57 @@ +From 70ba0298a49ccffc085da051ad553a1242f0bfe1 Mon Sep 17 00:00:00 2001 +From: Jonathon Jongsma +Date: Wed, 1 Dec 2021 16:39:06 -0600 +Subject: [PATCH 2/2] tests: read stdin in callout test scripts + +Callout scripts are intended to be passed a JSON device configuration +string on stdin. For our simple callout tests, we used single-line +test scripts that unconditionally returned a constant response code +(either error or success). This sometimes causes the tests to fail due +to the following error: + + [2021-12-01T20:33:25Z DEBUG mdevctl::callouts] failed to execute callout script "/tmp/mdevctl-testZg8CPd/etc/mdevctl.d/scripts.d/callouts/rc1.sh": Failed to write to stdin of command + + Caused by: + Broken pipe (os error 32) + +What seems to be happening is that mdevctl spawns the callout script and +then attempts to write the JSON device configuration to its stdin pipe. +However, the test scripts are so short that they may have exited before +mdevctl can finish writing to stdin, which results in the command +failing with a broken pipe error. In order to avoid this, make sure that +the test scripts read from stdin before exiting. + +Signed-off-by: Jonathon Jongsma +--- + tests/callouts/rc0.sh | 1 + + tests/callouts/rc1.sh | 1 + + tests/callouts/rc2.sh | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/tests/callouts/rc0.sh b/tests/callouts/rc0.sh +index 039e4d0..669d0ec 100755 +--- a/tests/callouts/rc0.sh ++++ b/tests/callouts/rc0.sh +@@ -1,2 +1,3 @@ + #!/usr/bin/env bash ++json=$( - 1.1.0-2 +- Create additonal directories required by installation. +- Fix sporadic callout test failures + Related: rhbz#1999687 + +* Thu Nov 18 2021 Eduardo Lima (Etrunko) - 1.1.0-1 +- Rebase mdevctl to 1.1.0 + Resolves: rhbz#1999687 * Wed Jun 30 2021 Danilo de Paula - 0.81-1 - Rebase mdevctl to 0.81.1