normanr opened a new issue #5253: URL: https://github.com/apache/incubator-nuttx/issues/5253
I get some very strange output for `df -h` on my bl602. As `dh -h` is just a wrapper around `cat /proc/fs/usage` the issue comes from `usage_entry` in fs_procfs_mount.c. Unfortunately I can not reproduce this with the sim board (I don't remember if it uses the host libc for formatting or not). Sample of invalid output: ``` nsh> df -h Filesystem Size Used Available Mounted on romfs 587767712@ 0B 0@ (null) procfs 587767712 0B 0 (null) tmpfs 587767712 0B 0 (null) ``` If I take the mount_sprintf at [line 369](https://github.com/apache/incubator-nuttx/blob/master/fs/mount/fs_procfs_mount.c#L369) and split it into separate calls then I can get: ``` nsh> df -h Filesystem Size Used Available Mounted on romfs 320 66� 320 /etc procfs 0 662 0 /proc tmpfs 512 66� 0 /tmp ``` or: ``` nsh> df -h [ 119.000000] irq_unexpected_isr: ERROR irq: 5 [ 119.000000] up_assert: Assertion failed at file:irq/irq_unexpectedisr.c line: 51 task: nsh_main ``` With only a single variable per call (and 8 calls to mount_sprintf) I get valid output: ``` nsh> df -h Filesystem Size Used Available Mounted on romfs 320B 320B 0B /etc procfs 0B 0B 0B /proc tmpfs 512B 0B 512B /tmp ``` I suspect that this might be because `usage_entry` is passing an `uint64_t` to `vsnprintf` (because `CONFIG_HAVE_LONG_LONG), but `lib_vsprintf` does not have `CONFIG_LIBC_LONG_LONG` defined, so it treats `llu` as a `long`, and doesn't iterate though the arguments correctly. If I cast the arguments to `unit32_t` when they're passed to `mount_sprintf` then they render correctly (whether or not they're formatted as `llu` or `lu`. I'm not sure if this bug is in `fs_procfs_mount` (should not be passing long long to `vsnprintf` if `CONFIG_LIBC_LONG_LONG` is not defined), or in `lib_vsprintf` (should compile fail?!? if `CONFIG_LIBC_LONG_LONG` is not defined and a long long is passed). I guess what's happening with the sim board is that it's being compiled with the system gcc (11.2.0), and the bl602 target is being compiled with the SiFive gcc (8.3.0). They probably handle "incorrect" sizes of variadic function arguments differently. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org