touch raises panic when running with QEMU for arm64
Affected images versions
v2024dev3
Unaffected images versions
Older versions
Background
After merging pkg/rust-coreutils!27 (merged) bootstrap process in arm64 and armhf fails with
2023/08/08 00:50:06 debootstrap.log | thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IndeterminateOffset', /usr/src/packages/BUILD/src/uu/touch/src/touch.rs:89:72
2023/08/08 00:50:06 debootstrap.log | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2023/08/08 00:50:07 debootstrap.log | qemu: uncaught target signal 6 (Aborted) - core dumped
2023/08/08 00:50:07 debootstrap.log | Aborted
After testing the different changes in the MR, the cause of the issue is:
diff --git a/debian/rules b/debian/rules
index e8b1089..cc1a443 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,6 +6,9 @@ export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
VERSION := $(shell dpkg-parsechangelog -S Version|sed -e "s|.*~\(.*\)-.*|\1|g")
+# Strip symbols from the binary to reduce the storage
+# footprint in Apertis
+export RUSTFLAGS=-C link-arg=-s
# Build a multicall binary instead of multiple binaries
# to reduce the storage footprint
In order to locally reproduce the issue:
- Download an older Fixed Function OSpack
- Use systemd-nspawn to chroot into it
- Install the new rust-coreutils
- run
touch tmpfile
to create a new file - run
touch tmpfile
to update the file, this will trigger the issue
Root cause
The code that raises the error is here with:
local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
which tries to return the local time taking into account timezone offset is here with:
local_offset_at(datetime).ok_or(error::IndeterminateOffset)
Reproducibility
How often the issue is hit when repeating the test and changing nothing (same device, same image, etc.)?
Put the
-
✅ always - often, but not always
- rarely
Impact of bug
This bug prevents bootstraping process to complete, causing all the images for arm64 and armhf to fail in the development release v2024dev3
Outcomes
Management data
This section is for management only, it should be the last one in the description.
/cc @andrunko @em @sagar @sudarshan @wlozano
Phabricator link: https://phabricator.apertis.org/T9971