** Description changed:

+ [ Impact ]
+ On 32-bit architectures (armhf, i386), rust-coreutils utilities (chmod, du, 
rm) fail with:
+ "Value too large for defined data type" (EOVERFLOW)
+ when operating on files 2 GiB or larger, or on filesystems with 64-bit inodes.
+ 
+ This breaks package builds in stonking during the finish/cleanup step
+ where debhelper or sbuild runs chmod/rm on large build trees or debug
+ symbol packages (for example gcc-snapshot-dbgsym > 2 GiB). Affected
+ packages fail to build or clean up, blocking migration into the release
+ pocket.
+ 
+ [ Fix ]
+ The failure occurs in `uucore::safe_traversal::DirFd::stat_at` and `fstat`. 
On 32-bit Linux architectures, `nix::sys::stat::fstatat` and `fstat` invoke 
non-LFS libc wrappers with a 32-bit `off_t`. When the kernel statx/stat64 
reports a file size >= 2 GiB, glibc returns EOVERFLOW.
+ 
+ The fix intercepts `Err(nix::errno::Errno::EOVERFLOW)` in both `stat_at`
+ and `fstat`, and falls back to `libc::fstatat64` and `libc::fstat64`.
+ For 32-bit consumers of the FileStat structure, `st_size` is saturated
+ to `libc::off_t::MAX` (2,147,483,647 bytes), while retaining valid mode,
+ dev, ino, and block metadata. This allows chmod, du, and rm to traverse
+ and process large files without crashing.
+ 
+ [ Test Plan ]
+ 1. On an i386 or armhf system (or using a 32-bit chroot/LXC container):
+    mkdir -p /tmp/large_test
+    truncate -s 5G /tmp/large_test/bigfile.img
+ 
+ 2. Run chmod recursively on the directory:
+    chmod -Rv u+rw /tmp/large_test
+    - Without fix: fails immediately with "chmod: Value too large for defined 
data type", exit code 1.
+    - With fix: succeeds with "mode of '/tmp/large_test/bigfile.img' retained 
as 0644", exit code 0.
+ 
+ 3. Run du on the directory:
+    du -sh /tmp/large_test
+    - Without fix: fails with "Value too large for defined data type", exit 
code 1.
+    - With fix: reports size without error, exit code 0.
+ 
+ 4. Run rm on the directory:
+    rm -rf /tmp/large_test
+    - Without fix: fails with "cannot remove ...: Value too large for defined 
data type", exit code 1.
+    - With fix: removes directory cleanly, exit code 0.
+ 
+ 5. Run package test suite:
+    cargo test --target i686-unknown-linux-gnu -p uucore --features 
safe-traversal --lib -- safe_traversal
+    - All 37 safe_traversal unit tests pass (including new 
test_dirfd_stat_and_fstat_large_file).
+ 
+ [ Where problems could occur ]
+ The fallback is restricted strictly to Linux targets (`#[cfg(target_os = 
"linux")]`) and only activates when `nix::sys::stat::fstatat` or `fstat` 
explicitly returns `EOVERFLOW`. On 64-bit systems and on 32-bit systems with 
files under 2 GiB, the existing standard code path runs unchanged.
+ 
+ On 32-bit systems for files larger than 2 GiB, `st_size` is clamped to
+ `off_t::MAX` (2 GiB - 1). Callers in coreutils safe traversal (`chmod`,
+ `rm`, `du`) rely on `st_mode`, `st_dev`, `st_ino`, and `st_blocks`
+ (which are preserved accurately), so clamping `st_size` prevents integer
+ overflow without breaking traversal logic.
+ 
+ [ Other Info ]
+ - Upstream status: Varun Varma opened upstream PR #14798 
(https://github.com/uutils/coreutils/pull/14798) addressing upstream issue 
#11848 (https://github.com/uutils/coreutils/issues/11848).
+ - Related Launchpad bug: LP #2148301 
(https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2148301).
+ - Target release: Ubuntu 26.04 (stonking), uploaded as debdiff 
0.12.0-1ubuntu2.
+ - Regression testing: 0 regressions across uucore test suite.
+ 
+ --- [ Original Report ]
  seen with 
  
https://launchpad.net/ubuntu/+source/gcc-snapshot/1:20260920-0ubuntu1/+build/33611952
  
  setting this to critical, and block-proposed, as it breaks successful builds 
in stonking
  [...]
  
  dpkg-genchanges: info: binary-only arch-specific upload (source code and 
arch-indep packages not included)
   dpkg-source --after-build .
  dpkg-buildpackage: info: binary-only upload (no source included)
  
--------------------------------------------------------------------------------
  Build finished at 2026-09-20T12:31:04Z
  
  Finished
  --------
  
  I: Built successfully
  chmod: Value too large for defined data type
  E: Can't chmod /<<BUILDDIR>> to g+w: 
  E: chmod g+w /<<BUILDDIR>> failed.
  
  
+------------------------------------------------------------------------------+
  | Cleanup                                      Sun, 20 Sep 2026 12:31:08 
+0000 |
  
+------------------------------------------------------------------------------+
  
  Purging /<<BUILDDIR>>
  rm: cannot remove 
'/<<BUILDDIR>>/gcc-snapshot-dbgsym_20260920-0ubuntu1_armhf.ddeb': Value too 
large for defined data type
  E: Can't unlink /<<BUILDDIR>>: 
  E: unable to remove build directory
  Not removing build depends: as requested

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167794

Title:
  chmod: Value too large for defined data type on armhf and i386

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2167794/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to