Closed kabe-gh closed 8 months ago
Additional patch for compiling in chroot environment invoked by setarch i686. patch-nobypass-selinux.patch
on 32bit environment with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS-64,
How exactly do you build this? The BITS-64
is apparently a typo, but:
$ meson setup /tmp/t64 --buildtype debug --prefix /usr --werror -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64
meson.build:1:0: ERROR: Unknown options: "_FILE_OFFSET_BITS, _TIME_BITS"
$ CFLAGS="-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" meson setup /tmp/t64 --buildtype debug --prefix /usr --werror && meson test -C /tmp/t64/
...
/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
I get the same failure with
--- meson.build
+++ meson.build
@@ -55,6 +55,9 @@ if cc.has_function('__fxstatat', prefix: '#include <sys/stat.h>')
add_project_arguments('-DHAVE_FXSTATAT', language: 'c')
endif
+add_project_arguments('-D_TIME_BITS=64', language: 'c')
+add_project_arguments('-D_FILE_OFFSET_BITS=64', language: 'c')
+
meson.add_dist_script(srcdir / 'getversion.sh')
So I think the CFLAGS=
approach works in general.
I tried this in current Debian testing i386. So how exactly did you try this?
CFLAGS="-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" meson . redhat-linux-build
meson compile -C redhat-linux-build --verbose
emits following error as you saw:
In file included from /usr/include/features.h:392,
from /usr/include/assert.h:35,
from ../src/libumockdev-preload.c:31:
/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
|
So, first, add #undef _TIME_BITS in src/libumockdev-preload.c:
diff -up ./src/libumockdev-preload.c.t64 ./src/libumockdev-preload.c
--- ./src/libumockdev-preload.c.t64 2022-05-30 19:16:30.000000000 +0900
+++ ./src/libumockdev-preload.c 2023-09-29 21:07:37.990392403 +0900
@@ -24,6 +24,9 @@
/* override -D_FILE_OFFSET_BITS, it breaks us */
#undef _FILE_OFFSET_BITS
+#ifdef _TIME_BITS
+# undef _TIME_BITS
+#endif
/* for getting stat64 */
#define _GNU_SOURCE
meson compile -C redhat-linux-build --verbose
../tests/test-umockdev.c: In function ‘t_testbed_script_replay_evdev_event_framing’:
../tests/test-umockdev.c:1542:8: error: incompatible types when initializing type ‘long unsigned int’ using type ‘struct timeval’
1542 | {dummy, 0003, 0000, 2534},
| ^~~~~
../tests/test-umockdev.c:1543:8: error: incompatible types when initializing type ‘long unsigned int’ using type ‘struct timeval’
1543 | {dummy, 0000, 0000, 0000},
| ^~~~~
../tests/test-umockdev.c:1544:8: error: incompatible types when initializing type ‘long unsigned int’ using type ‘struct timeval’
1544 | {dummy, 0003, 0000, 2200},
| ^~~~~
../tests/test-umockdev.c:1545:8: error: incompatible types when initializing type ‘long unsigned int’ using type ‘struct timeval’
1545 | {dummy, 0000, 0000, 0000}
| ^~~~~
So fix that too:
diff --git a/tests/test-umockdev.c b/tests/test-umockdev.c
index e8a5462..fba19d8 100644
--- a/tests/test-umockdev.c
+++ b/tests/test-umockdev.c
@@ -1536,13 +1536,17 @@ t_testbed_script_replay_evdev_event_framing(UMockdevTestbedFixture * fixture, UN
int fd;
char buf[1024];
- struct timeval dummy = {0};
+#if !defined(_TIME_BITS) && _TIME_BITS != 64
+ struct timeval dummy_timeval = {0};
+#else
+# define dummy_timeval 0,0
+#endif
/* Simple evdev stream - x coordinate followed by SYN, times 2 */
struct input_event dummy_events[] = {
- {dummy, 0003, 0000, 2534},
- {dummy, 0000, 0000, 0000},
- {dummy, 0003, 0000, 2200},
- {dummy, 0000, 0000, 0000}
+ {dummy_timeval, 0003, 0000, 2534},
+ {dummy_timeval, 0000, 0000, 0000},
+ {dummy_timeval, 0003, 0000, 2200},
+ {dummy_timeval, 0000, 0000, 0000}
};
umockdev_testbed_add_from_string(fixture->testbed,
Now meson compile
will pass. Do the test:
========================
/usr/bin/meson test -C redhat-linux-build --print-errorlogs
ninja: Entering directory `/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build'
ninja: no work to do.
1/7 umockdev / ioctl-tree OK 0.02s
2/7 umockdev:fails-valgrind / umockdev-record FAIL 0.15s killed by signal 6 SIGABRT
>>> LD_LIBRARY_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build:/home/kabe/.local/bin:/home/kabe/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly TOP_SRCDIR=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13 GI_TYPELIB_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build MALLOC_CHECK_=3 MALLOC_PERTURB_=222 /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/src/umockdev-wrapper /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build/test-umockdev-record
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stdout:
# random seed: R02Sa722e23a511b9c8f2efb730be8adb335
1..17
# Start of umockdev-record tests
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.VJ8XB2
# DEBUG: umockdev.vala:137: Removing test bed /tmp/umockdev.VJ8XB2
# GLib-DEBUG: unsetenv() is not thread-safe and should not be used after threads are created
ok 1 /umockdev-record/testbed-all-empty
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.Z9NXB2
Bail out! ERROR:../tests/test-umockdev-record.vala:111:t_testbed_one: assertion failed (_tmp22_ == "P: /devices/dev1\n" "E: SIMPLE_PROP=1\n" "E: SUBSYSTEM=pci\n" "H: binary_attr=41FF0005FF00\n" "L: driver=../../drivers/foo\n" "A: knobs/red=off\n" "A: multiline_attr=a\\\\b\\nc\\\\d\\nlast\n" "L: power/fiddle=../some/where\n" "A: simple_attr=1\n" "\n"): ("" == "P: /devices/dev1\nE: SIMPLE_PROP=1\nE: SUBSYSTEM=pci\nH: binary_attr=41FF0005FF00\nL: driver=../../drivers/foo\nA: knobs/red=off\nA: multiline_attr=a\\\\b\\nc\\\\d\\nlast\nL: power/fiddle=../some/where\nA: simple_attr=1\n\n")
stderr:
**
ERROR:../tests/test-umockdev-record.vala:111:t_testbed_one: assertion failed (_tmp22_ == "P: /devices/dev1\n" "E: SIMPLE_PROP=1\n" "E: SUBSYSTEM=pci\n" "H: binary_attr=41FF0005FF00\n" "L: driver=../../drivers/foo\n" "A: knobs/red=off\n" "A: multiline_attr=a\\\\b\\nc\\\\d\\nlast\n" "L: power/fiddle=../some/where\n" "A: simple_attr=1\n" "\n"): ("" == "P: /devices/dev1\nE: SIMPLE_PROP=1\nE: SUBSYSTEM=pci\nH: binary_attr=41FF0005FF00\nL: driver=../../drivers/foo\nA: knobs/red=off\nA: multiline_attr=a\\\\b\\nc\\\\d\\nlast\nL: power/fiddle=../some/where\nA: simple_attr=1\n\n")
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
3/7 umockdev:fails-valgrind / umockdev-vala FAIL 0.19s killed by signal 6 SIGABRT
>>> LD_LIBRARY_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build:/home/kabe/.local/bin:/home/kabe/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin MALLOC_PERTURB_=249 G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly TOP_SRCDIR=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13 GI_TYPELIB_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build MALLOC_CHECK_=3 /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/src/umockdev-wrapper /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build/test-umockdev-vala
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stdout:
# random seed: R02Scf26839327a5b09dcd3a0b8b6de95a7e
1..19
# Start of umockdev-testbed-vala tests
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.GE8XB2
# DEBUG: umockdev.vala:137: Removing test bed /tmp/umockdev.GE8XB2
# GLib-DEBUG: unsetenv() is not thread-safe and should not be used after threads are created
ok 1 /umockdev-testbed-vala/empty
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.YVNYB2
Bail out! ERROR:../tests/test-umockdev-vala.vala:85:t_testbed_add_device: assertion failed (_tmp25_ == "0815"): (NULL == "0815")
stderr:
**
ERROR:../tests/test-umockdev-vala.vala:85:t_testbed_add_device: assertion failed (_tmp25_ == "0815"): (NULL == "0815")
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
4/7 umockdev / umockdev FAIL 0.20s killed by signal 6 SIGABRT
>>> LD_LIBRARY_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build:/home/kabe/.local/bin:/home/kabe/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly TOP_SRCDIR=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13 MALLOC_PERTURB_=29 GI_TYPELIB_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build MALLOC_CHECK_=3 /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/src/umockdev-wrapper /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build/test-umockdev
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stdout:
# random seed: R02S5445fb8b33c55297d1a3e24e542e81b8
1..37
# Start of umockdev-testbed tests
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.JC8XB2
# DEBUG: umockdev.vala:137: Removing test bed /tmp/umockdev.JC8XB2
# GLib-DEBUG: unsetenv() is not thread-safe and should not be used after threads are created
ok 1 /umockdev-testbed/empty
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.6TNYB2
Bail out! ERROR:../tests/test-umockdev.c:172:_t_testbed_check_extkeyboard1: assertion failed (g_udev_device_get_sysfs_attr(device, "idVendor") == "0815"): (NULL == "0815")
stderr:
**
ERROR:../tests/test-umockdev.c:172:_t_testbed_check_extkeyboard1: assertion failed (g_udev_device_get_sysfs_attr(device, "idVendor") == "0815"): (NULL == "0815")
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
5/7 umockdev / static-code OK 0.11s
6/7 umockdev / umockdev-run FAIL 0.49s killed by signal 6 SIGABRT
>>> LD_LIBRARY_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build MALLOC_PERTURB_=179 PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build:/home/kabe/.local/bin:/home/kabe/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly TOP_SRCDIR=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13 GI_TYPELIB_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build MALLOC_CHECK_=3 /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/src/umockdev-wrapper /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build/test-umockdev-run
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stdout:
# random seed: R02S084d99989447f4b450a4c12df8a36ca7
1..16
# Start of umockdev-run tests
ok 1 /umockdev-run/exit_code
ok 2 /umockdev-run/version
ok 3 /umockdev-run/pipes
Bail out! ERROR:../tests/test-umockdev-run.vala:201:t_run_udevadm_block: assertion failed (serr == ""): ("selinux_status_open() failed to open the status page, using the netlink fallback.\nUnknown device \"/dev/loop23\": No such device\n" == "")
stderr:
**
ERROR:../tests/test-umockdev-run.vala:201:t_run_udevadm_block: assertion failed (serr == ""): ("selinux_status_open() failed to open the status page, using the netlink fallback.\nUnknown device \"/dev/loop23\": No such device\n" == "")
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
7/7 umockdev:fails-valgrind / umockdev.py FAIL 1.41s exit status 1
>>> LD_LIBRARY_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build:/home/kabe/.local/bin:/home/kabe/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly TOP_SRCDIR=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13 GI_TYPELIB_PATH=/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build MALLOC_PERTURB_=161 MALLOC_CHECK_=3 /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/src/umockdev-wrapper /usr/bin/python3 -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/tests/test-umockdev.py
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
test_add_device (__main__.Testbed)
testbed with adding one device ... FAIL
test_add_from_string (__main__.Testbed) ... FAIL
test_add_from_string_errors (__main__.Testbed) ... ok
test_empty (__main__.Testbed)
empty testbed without any devices ... ok
test_root_dir (__main__.Testbed) ... ok
test_set_attribute (__main__.Testbed)
testbed set_attribute() ... FAIL
test_set_property (__main__.Testbed)
testbed set_property() ... ok
test_uevent (__main__.Testbed)
testbed uevent() ... FAIL
======================================================================
FAIL: test_add_device (__main__.Testbed)
testbed with adding one device
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/tests/test-umockdev.py", line 68, in test_add_device
self.assertEqual(dev.get_sysfs_attr('idVendor'), '0815')
AssertionError: None != '0815'
======================================================================
FAIL: test_add_from_string (__main__.Testbed)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/tests/test-umockdev.py", line 191, in test_add_from_string
self.assertEqual (device.get_sysfs_attr('simple_attr'), '1')
AssertionError: None != '1'
======================================================================
FAIL: test_set_attribute (__main__.Testbed)
testbed set_attribute()
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/tests/test-umockdev.py", line 103, in test_set_attribute
self.assertEqual(dev.get_sysfs_attr('idVendor'), '0815')
AssertionError: None != '0815'
======================================================================
FAIL: test_uevent (__main__.Testbed)
testbed uevent()
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/tests/test-umockdev.py", line 162, in test_uevent
self.assertEqual(counter, [1, 0, 0, syspath, '0815', '1'])
AssertionError: Lists differ: [1, 0, 0, '/sys/devices/mydev', None, '1'] != [1, 0, 0, '/sys/devices/mydev', '0815', '1']
First differing element 4:
None
'0815'
- [1, 0, 0, '/sys/devices/mydev', None, '1']
? ^^^^
+ [1, 0, 0, '/sys/devices/mydev', '0815', '1']
? ^^^^^^
----------------------------------------------------------------------
Ran 8 tests in 0.860s
FAILED (failures=4)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Summary of Failures:
2/7 umockdev:fails-valgrind / umockdev-record FAIL 0.15s killed by signal 6 SIGABRT
3/7 umockdev:fails-valgrind / umockdev-vala FAIL 0.19s killed by signal 6 SIGABRT
4/7 umockdev / umockdev FAIL 0.20s killed by signal 6 SIGABRT
6/7 umockdev / umockdev-run FAIL 0.49s killed by signal 6 SIGABRT
7/7 umockdev:fails-valgrind / umockdev.py FAIL 1.41s exit status 1
Ok: 2
Expected Fail: 0
Fail: 5
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/kabe/r9builds/umockdev-r9/BUILD/umockdev-0.17.13/redhat-linux-build/meson-logs/testlog.txt
You have to re-wrap every functions otherwise redirected to __ioctl_time64 et al in src/libumockdev-preload.c . hence the large patch in https://github.com/martinpitt/umockdev/issues/216#issue-1885882960 .
on 32bit environment with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS-64,
/usr/bin/meson test
fails as below. Attached patch seems to fix this, but a dirty hack; maybe should left out as open issue.patch-time64.patch