apply upstream patches to fix crash with powerdevil [release 2.1.0-2mamba;Sat Jan 27 2024]

This commit is contained in:
Silvan Calarco 2024-01-27 12:52:02 +01:00
parent a39d21a091
commit 6175b62d68
3 changed files with 104 additions and 2 deletions

View File

@ -0,0 +1,66 @@
From 7f157f620b7f4c3862e140b5b77ff9215f0b7497 Mon Sep 17 00:00:00 2001
From: Sanford Rockowitz <rockowitz@minsoft.com>
Date: Sat, 20 Jan 2024 10:04:36 -0500
Subject: [PATCH] ddci_init(): submaster_initializer not called if implicit
initialization
ddci_init() can be called "explicitly" or "implicitly". An explicit
call is when it is called either from ddca_init() or ddca_init2().
If an API function dependent on initialization is called before
explicit initialization, ddci_init() is called with arguments such
that it can never fail. This is an implicit call. In particular,
it is called with option DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE and
a null libopts string. Otherwise failure would be possible.
The bug was that some initialization did not occur with this
combination of ddci_init() args. In particular,
submaster_initializer(), which among other things sets the value of
sys_drm_connectors, was not called. Also any options in the
ddcutilrc configuration file that turned on tracing were not
processed, making debugging more difficult.
PowerDevil calls API functions requiring initialization before calling
ddca_init(). As a result, there's an implicit call to ddci_init(),
and because of the bug sys_drm_connectors is not set, resulting
in the "assert(sys_drm_connectors)" failure in function i2c_check_bus().
---
src/libmain/api_base.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/libmain/api_base.c b/src/libmain/api_base.c
index 8f2c6e06..d862a361 100644
--- a/src/libmain/api_base.c
+++ b/src/libmain/api_base.c
@@ -660,20 +660,19 @@ ddci_init(const char * libopts,
*infomsg_loc = g_ptr_array_to_ntsa(infomsgs, /*duplicate=*/true);
}
g_ptr_array_free(infomsgs, true);
-
- if (!master_error) {
- if (parsed_cmd->trace_destination) {
- DBGF(debug, "Setting library trace file: %s", parsed_cmd->trace_destination);
- init_library_trace_file(parsed_cmd->trace_destination, enable_syslog, debug);
- }
- master_error = init_tracing(parsed_cmd);
- requested_stats = parsed_cmd->stats_types;
- ptd_api_profiling_enabled = parsed_cmd->flags & CMD_FLAG_PROFILE_API;
- per_display_stats = parsed_cmd->flags & CMD_FLAG_VERBOSE_STATS;
- dsa_detail_stats = parsed_cmd->flags & CMD_FLAG_INTERNAL_STATS;
- if (!submaster_initializer(parsed_cmd))
- master_error = ERRINFO_NEW(DDCRC_UNINITIALIZED, "Initialization failed");
+ }
+ if (!master_error) {
+ if (parsed_cmd->trace_destination) {
+ DBGF(debug, "Setting library trace file: %s", parsed_cmd->trace_destination);
+ init_library_trace_file(parsed_cmd->trace_destination, enable_syslog, debug);
}
+ master_error = init_tracing(parsed_cmd);
+ requested_stats = parsed_cmd->stats_types;
+ ptd_api_profiling_enabled = parsed_cmd->flags & CMD_FLAG_PROFILE_API;
+ per_display_stats = parsed_cmd->flags & CMD_FLAG_VERBOSE_STATS;
+ dsa_detail_stats = parsed_cmd->flags & CMD_FLAG_INTERNAL_STATS;
+ if (!submaster_initializer(parsed_cmd))
+ master_error = ERRINFO_NEW(DDCRC_UNINITIALIZED, "Initialization failed");
}
}

View File

@ -0,0 +1,28 @@
From 8fd63cfd3f4378aff737be9f4402f0435dd1e367 Mon Sep 17 00:00:00 2001
From: Sanford Rockowitz <rockowitz@minsoft.com>
Date: Wed, 24 Jan 2024 01:09:35 -0500
Subject: [PATCH] check_how_unsupported_reported(): eliminate invalid assert()
does not allow for case of ambiguous -EIO response
---
src/ddc/ddc_displays.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ddc/ddc_displays.c b/src/ddc/ddc_displays.c
index 8cefd063..e081a1b7 100644
--- a/src/ddc/ddc_displays.c
+++ b/src/ddc/ddc_displays.c
@@ -421,11 +421,12 @@ check_how_unsupported_reported(Display_Handle * dh) {
}
errinfo_free(erec);
dh->dref->flags |= DREF_UNSUPPORTED_CHECKED;
+#ifdef OUT // EIO case fails this assertion
assert(dh->dref->flags & (DREF_DDC_USES_DDC_FLAG_FOR_UNSUPPORTED |
DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED |
DREF_DDC_USES_MH_ML_SH_SL_ZERO_FOR_UNSUPPORTED |
DREF_DDC_DOES_NOT_INDICATE_UNSUPPORTED ) );
-
+#endif
DBGTRC_DONE(debug, TRACE_GROUP, "dref->flags=%s", interpret_dref_flags_t(dref->flags));
}

View File

@ -1,6 +1,6 @@
Name: ddcutil
Version: 2.1.0
Release: 1mamba
Release: 2mamba
Summary: Query and change Linux monitor settings using DDC/CI and USB
Group: System/Kernel and Hardware
Vendor: openmamba
@ -8,6 +8,8 @@ Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.ddcutil.com
Source: https://github.com/rockowitz/ddcutil.git/v%{version}/ddcutil-%{version}.tar.bz2
Patch0: ddcutil-2.1.0-upstream-fix-with-powerdevil-1.patch
Patch1: ddcutil-2.1.0-upstream-fix-with-powerdevil-2.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
@ -44,7 +46,10 @@ This package contains libraries and header files for developing applications tha
%prep
%setup -q
./autogen.sh
%patch 0 -p1 -b .upstream-fix-with-powerdevil-1
%patch 1 -p1 -b .upstream-fix-with-powerdevil-2
NOCONFIGURE=1 ./autogen.sh
%build
%configure
@ -86,6 +91,9 @@ This package contains libraries and header files for developing applications tha
%doc README.md
%changelog
* Sat Jan 27 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.0-2mamba
- apply upstream patches to fix crash with powerdevil
* Thu Jan 18 2024 Automatic Build System <autodist@openmamba.org> 2.1.0-1mamba
- automatic version update by autodist