Bug 8863

Summary: dbus did not support large-file for stat64
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: coreAssignee: Hongxu Jia <hongxu.jia>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, randy.macleod, ross.burton
Version: 2.1   
Target Milestone: 2.1 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on:    
Bug Blocks: 6803    

Description Hongxu Jia 2015-12-31 06:09:31 UTC
While starting dbus-daemon on a 32-bit linux host and it invokes
fstat to load /etc/dbus-1/system.conf through NFS. If system.conf
was created with a large indoe number on 64-bit host. The above
fstat invoking failed. Here is the log of strace:
............
root@qemu3:~# df 
Filesystem                                                                                1K-blocks       Used  Available Use% Mounted on
10.0.2.2:/buildarea/raid0/hjia/wrlinux-x-master-1120/build-20151230-qemux86/export/dist 15623790592 8566374092 7057416500  55% /

root@qemu3:~# cat /proc/cmdline 
console=ttyS0,115200 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/buildarea/raid0/hjia/wrlinux-x-master-1120/build-20151230-qemux86/export/dist,nfsvers=3,port=3349,mountprog=21411,nfsprog=11411,udp,mountport=3348 rw clock=pit oprofile.timer=1 TCF=1

root@qemu3:~# ls -i /etc/dbus-1/system.conf 
62318090305 /etc/dbus-1/system.conf

root@qemu3:~# strace /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
|open("/etc/dbus-1/system.conf", O_RDONLY) = 4
|fstat64(4, {st_mode=S_IFREG|0644, st_size=3340, ...}) = 0
|close(4) = 0
|close(3) = 0
|write(2, "Failed to start message bus: Fai"..., 109Failed to start message bus:
Failed to stat "/etc/dbus-1/system.conf": Value too large for defined data type
|) = 109
|exit_group(1) = ?
|+++ exited with 1 +++
............
Comment 1 Hongxu Jia 2015-12-31 06:10:55 UTC
In this situation, we should support large-file for stat64. Add marco
AC_SYS_LARGEFILE to do the detection at configure time. It can be disabled
by configuring with the `--disable-largefile' option.

Also file a bug and send patch to upstream:
https://bugs.freedesktop.org/show_bug.cgi?id=93545
https://bugs.freedesktop.org/attachment.cgi?id=120747

//Hongxu
Comment 3 Ross Burton 2016-01-07 17:20:40 UTC
BTW, there's also bug 6803 which covers this at the distro level.
Comment 4 Hongxu Jia 2016-01-14 06:30:36 UTC
Merged into master:
...
commit 3f4fb3936edbf42b6e94b71e0f243acd6c56b132
Author: Hongxu Jia <hongxu.jia@windriver.com>
Date:   Mon Jan 4 10:08:42 2016 +0800

    dbus: support large-file for stat64
...

//Hongxu
Comment 5 Hongxu Jia 2016-02-14 06:56:39 UTC
Accepted by upstream:

commit 96ffc2a07eb10c0265b654ade972c66e39f9fafb
Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date:   Mon Feb 8 17:25:38 2016 +0000

    configure.ac: support large-file for stat64
    
    dbus-daemon is not expected to open files with large *sizes*, but without
    large file support, calling [f]stat() on a file that happens to have a
    large inode number will fail with EOVERFLOW (see stat(2)). For example,
    files mounted from an NFS server might have large inode numbers.
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93545
    Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
    [smcv: shorten and clarify commit message; move AC_SYS_LARGEFILE
    after AC_USE_SYSTEM_EXTENSIONS because nothing should compile C before
    that point]
    Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>