hughsie / colord

Making color management just work
GNU General Public License v2.0
75 stars 51 forks source link

1.4.7: test suite fails in `colord-test-private` unit #163

Closed kloczek closed 9 months ago

kloczek commented 10 months ago
Meson output ```console + /usr/bin/meson setup --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-redhat-linux-gnu -D argyllcms_sensor=false -D bash_completion=false -D daemon_user=colord -D installed_tests=true -D libcolordcompat=true -D print_profiles=false -D sane=false -D vapi=true The Meson build system Version: 1.3.1 Source dir: /home/tkloczko/rpmbuild/BUILD/colord-1.4.7 Build dir: /home/tkloczko/rpmbuild/BUILD/colord-1.4.7/x86_64-redhat-linux-gnu Build type: native build Project name: colord Project version: 1.4.7 C compiler for the host machine: /usr/bin/gcc (gcc 14.0.1 "gcc (GCC) 14.0.1 20240118 (Red Hat 14.0.1-0)") C linker for the host machine: /usr/bin/gcc ld.bfd 2.41-29 Host machine cpu family: x86_64 Host machine cpu: x86_64 Found pkg-config: YES (/usr/bin/pkg-config) 2.1.0 Run-time dependency gio-2.0 found: YES 2.79.1 Run-time dependency glib-2.0 found: YES 2.79.1 Run-time dependency gmodule-2.0 found: YES 2.79.1 Run-time dependency gio-unix-2.0 found: YES 2.79.1 Run-time dependency lcms2 found: YES 2.15 Run-time dependency sqlite3 found: YES 3.45.0 Run-time dependency gusb found: YES 0.4.8 Run-time dependency gudev-1.0 found: YES 238 Library m found: YES Run-time dependency libudev found: YES 251 Run-time dependency udev found: YES 251 Run-time dependency systemd found: YES 251 Run-time dependency libsystemd found: YES 251 Has header "pwd.h" : YES Has header "syslog.h" : YES Has header "unistd.h" : YES Checking for function "getuid" : YES Program vapigen found: YES (/usr/bin/vapigen) Run-time dependency polkit-gobject-1 found: YES 124 Run-time dependency valgrind found: NO (tried pkgconfig) Configuring config.h using configuration Configuring cd-version.h using configuration Run-time dependency gobject-introspection-1.0 found: YES 1.79.1 Dependency gobject-introspection-1.0 found: YES 1.79.1 (cached) Program /usr/bin/g-ir-scanner found: YES (/usr/bin/g-ir-scanner) Dependency gobject-introspection-1.0 found: YES 1.79.1 (cached) Program /usr/bin/g-ir-compiler found: YES (/usr/bin/g-ir-compiler) Program vapigen found: YES (/usr/bin/vapigen) Configuring colord-daemon.test using configuration Configuring colord-private.test using configuration Configuring ch-version.h using configuration Program msgfmt found: YES (/usr/bin/msgfmt) Program msginit found: YES (/usr/bin/msginit) Program msgmerge found: YES (/usr/bin/msgmerge) Program xgettext found: YES (/usr/bin/xgettext) Configuring colord-session.service using configuration Configuring org.freedesktop.ColorHelper.service using configuration Program gtkdoc-scan found: YES (/usr/bin/gtkdoc-scan) Program gtkdoc-scangobj found: YES (/usr/bin/gtkdoc-scangobj) Program gtkdoc-mkdb found: YES (/usr/bin/gtkdoc-mkdb) Program gtkdoc-mkhtml found: YES (/usr/bin/gtkdoc-mkhtml) Program gtkdoc-fixxref found: YES (/usr/bin/gtkdoc-fixxref) Configuring colord.service using configuration Configuring colord.conf using configuration Configuring org.freedesktop.ColorManager.service using configuration Configuring org.freedesktop.ColorManager.conf using configuration Program xsltproc found: YES (/usr/bin/xsltproc) WARNING: You should add the boolean check kwarg to the run_command call. It currently defaults to false, but it will default to true in future releases of meson. See also: https://github.com/mesonbuild/meson/issues/9300 Configuring 69-cd-sensors.rules using configuration Configuring org.freedesktop.color.policy.in using configuration Dependency gio-2.0 found: YES 2.79.1 (cached) Program /usr/bin/glib-compile-resources found: YES (/usr/bin/glib-compile-resources) Build targets in project: 168 NOTICE: Future-deprecated features used: * 0.56.0: {'dependency.get_pkgconfig_variable', 'meson.build_root', 'meson.source_root'} colord 1.4.7 User defined options auto_features : enabled bindir : /usr/bin buildtype : plain datadir : /usr/share includedir : /usr/include infodir : /usr/share/info libdir : /usr/lib64 libexecdir : /usr/libexec localedir : /usr/share/locale localstatedir : /var mandir : /usr/share/man prefix : /usr sbindir : /usr/sbin sharedstatedir : /var/lib sysconfdir : /etc wrap_mode : nodownload argyllcms_sensor: false bash_completion : false daemon_user : colord installed_tests : true libcolordcompat : true print_profiles : false sane : false vapi : true ```

And ..

test suite fails with ```console + cd /home/tkloczko/rpmbuild/BUILD + cd colord-1.4.7 + /usr/bin/meson test -C x86_64-redhat-linux-gnu --num-processes 48 --print-errorlogs ninja: Entering directory `/home/tkloczko/rpmbuild/BUILD/colord-1.4.7/x86_64-redhat-linux-gnu' ninja: no work to do. 1/4 colord-test-daemon SKIP 0.02s exit status 77 2/4 colorhug-self-test OK 0.04s 3/4 cd-self-test FAIL 0.11s killed by signal 6 SIGABRT >>> MALLOC_PERTURB_=33 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 LD_LIBRARY_PATH=/home/tkloczko/rpmbuild/BUILD/colord-1.4.7/x86_64-redhat-linux-gnu/lib/colord ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 /home/tkloczko/rpmbuild/BUILD/colord-1.4.7/x86_64-redhat-linux-gnu/src/cd-self-test ――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――― stdout: TAP version 13 # random seed: R02S4230d5d2f64aa6985d3ab44e014a6ce1 1..9 # Start of colord tests ok 1 /colord/common # Cd-DEBUG: CdMappingDb: trying to open database '/tmp/mapping.db' # Cd-INFO: Using mapping database file /tmp/mapping.db # Cd-DEBUG: CdMappingDb: altering table to repair: no such column: timestamp # Cd-DEBUG: CdMappingDb: altering table to convert: no such table: mappings_v2 ok 2 /colord/mapping-db{alter} # Cd-DEBUG: CdMappingDb: trying to open database '/tmp/mapping.db' # Cd-INFO: Using mapping database file /tmp/mapping.db # Cd-DEBUG: CdMappingDb: altering table to convert: no such table: mappings_v2 ok 3 /colord/mapping-db{convert} # Cd-DEBUG: CdMappingDb: trying to open database '/tmp/mapping.db' # Cd-INFO: Using mapping database file /tmp/mapping.db # Cd-DEBUG: CdMappingDb: creating table to repair: no such table: mappings # Cd-DEBUG: CdMappingDb: altering table to convert: no such table: mappings_v2 # Cd-DEBUG: CdMappingDb: add device1<=>profile1 # Cd-DEBUG: CdMappingDb: add device1<=>profile2 # Cd-DEBUG: CdMappingDb: add device1<=>profile3 # Cd-DEBUG: CdMappingDb: clearing timestamp device1<=>profile2 # Cd-DEBUG: CdMappingDb: get checksum for device1<->profile2 # Cd-DEBUG: CdMappingDb: got sql entry 0 # Cd-DEBUG: CdMappingDb: get profiles for device1 # Cd-DEBUG: CdMappingDb: got sql entry profile1 # Cd-DEBUG: CdMappingDb: got sql entry profile3 # Cd-DEBUG: CdMappingDb: get devices for profile1 # Cd-DEBUG: CdMappingDb: got sql entry device1 ok 4 /colord/mapping-db # Cd-DEBUG: CdDeviceDb: trying to open database '/tmp/device.db' # Cd-INFO: Using device database file /tmp/device.db # Cd-DEBUG: CdDeviceDb: creating table to repair: no such table: devices # Cd-DEBUG: CdDeviceDb: add device device1 # Cd-DEBUG: CdDeviceDb: add device device2 # Cd-DEBUG: CdDeviceDb: add device device3 # Cd-DEBUG: CdDeviceDb: remove device device1 # Cd-DEBUG: CdDeviceDb: get devices # Cd-DEBUG: CdDeviceDb: got sql result device2 # Cd-DEBUG: CdDeviceDb: got sql result device3 # Cd-DEBUG: CdDeviceDb: add device property device2 [kind=display] # Cd-DEBUG: CdDeviceDb: get property xxx for device2 # Cd-DEBUG: CdDeviceDb: get property kind for device2 # Cd-DEBUG: CdDeviceDb: got sql result display # Cd-DEBUG: CdDeviceDb: get properties for device device2 # Cd-DEBUG: CdDeviceDb: got sql result kind # Cd-DEBUG: CdDeviceDb: remove device device2 # Cd-DEBUG: CdDeviceDb: remove device device3 # Cd-DEBUG: CdDeviceDb: get devices # Cd-DEBUG: CdDeviceDb: get property kind for device2 ok 5 /colord/device-db ok 6 /colord/profile # Cd-DEBUG: CdProfileDb: trying to open database '/tmp/profile.db' # Cd-INFO: Using profile database file /tmp/profile.db stderr: free(): invalid pointer ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 4/4 colord-test-private OK 6.37s Summary of Failures: 3/4 cd-self-test FAIL 0.11s killed by signal 6 SIGABRT Ok: 2 Expected Fail: 0 Fail: 1 Unexpected Pass: 0 Skipped: 1 Timeout: 0 ```
Cellesti commented 10 months ago

I have also encountered this test failure, and tried to debug it. The test seems to fail when /tmp/profile.db doesn't exist. So, running it a second time after that has been created allows the test to pass.

Based on my limited knowledge (not being a C programmer), i think this is caused by passing to sqlite3_exec a pointer marked with g_autofree, instead of free'ing it manually with sqlite3_free.

I found another instance in cd-mapping-db.c where sqlite3_exec is passed a pointer marked with g_autofree. However, that SQLite statement doesn't seem to fail when its db file is not found, so this problem isn't triggered there.