Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 438734

Summary: linux-mod.eclass - KERNEL_DIR/KBUILD_OUTPUT version mismatch is not detected, KERNEL_DIR is not inferred from $KBUILD_OUTPUT/source
Product: Gentoo Linux Reporter: Dennis Schridde <dschridde+gentoobugs>
Component: EclassesAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED NEEDINFO    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
emerge --info
aufs3-3_p20121015.ebuild.patch

Description Dennis Schridde 2012-10-17 19:25:13 UTC
CC [M]  /var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/super.o
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/super.c: In function 'aufs_destroy_inode_cb':
When building sys-fs/aufs3-3_p20121015 I see issues like:
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/super.c:52:2: warning: passing argument 1 of 'INIT_LIST_HEAD' from incompatible pointer type [enabled by default]
/usr/src/linux-3.6.2-gentoo/include/linux/list.h:24:20: note: expected 'struct list_head *' but argument is of type 'struct hlist_head *'

And:
  CC [M]  /var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.o
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c: In function 'vfsub_dentry_open':
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:58:7: warning: passing argument 1 of 'dentry_open' from incompatible pointer type [enabled by default]
/usr/src/linux-3.6.2-gentoo/include/linux/fs.h:2202:22: note: expected 'const struct path *' but argument is of type 'struct dentry *'
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:58:7: warning: passing argument 2 of 'dentry_open' makes integer from pointer without a cast [enabled by default]
/usr/src/linux-3.6.2-gentoo/include/linux/fs.h:2202:22: note: expected 'int' but argument is of type 'struct vfsmount *'
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:58:7: warning: passing argument 3 of 'dentry_open' makes pointer from integer without a cast [enabled by default]
/usr/src/linux-3.6.2-gentoo/include/linux/fs.h:2202:22: note: expected 'const struct cred *' but argument is of type 'int'
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:58:7: error: too many arguments to function 'dentry_open'
/usr/src/linux-3.6.2-gentoo/include/linux/fs.h:2202:22: note: declared here
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c: In function 'vfsub_lookup_hash':
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:122:2: error: implicit declaration of function 'lookup_hash' [-Werror=implicit-function-declaration]
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:122:14: warning: assignment makes pointer from integer without a cast [enabled by default]
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c: In function 'vfsub_create':
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:209:7: error: 'struct nameidata' has no member named 'intent'
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:211:7: error: 'struct nameidata' has no member named 'intent'
/var/tmp/portage/sys-fs/aufs3-3_p20121015/work/aufs3-standalone/fs/aufs/vfsub.c:215:3: warning: the address of 'h_nd' will always evaluate as 'true' [-Waddress]
cc1: some warnings being treated as errors

Reproducible: Always
Comment 1 Dennis Schridde 2012-10-17 19:26:09 UTC
Created attachment 326784 [details]
build.log
Comment 2 Dennis Schridde 2012-10-17 19:26:20 UTC
Created attachment 326786 [details]
emerge --info
Comment 3 Dennis Schridde 2012-10-17 19:40:19 UTC
Created attachment 326788 [details, diff]
aufs3-3_p20121015.ebuild.patch

Attached is the patch to the ebuild that I use. (addresses the non-x86 issues)
Comment 4 Dennis Schridde 2012-10-17 19:44:36 UTC
My kernel was patched using aufs3-base-6.patch and aufs3-standalone-6.patch.

The same issue affects sys-fs/aufs3-3_p20120813-r1.
Comment 5 Dennis Schridde 2012-10-17 23:06:04 UTC
Same issue with aufs3-*-5.patch. dentry_open is defined in include/linux/fs.h:
/usr/src/linux-3.6.2-gentoo/include/linux/fs.h:extern struct file * dentry_open(const struct path *, int, const struct cred *);

/usr/src/linux-3.5.3-gentoo/include/linux/fs.h:extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
/usr/src/linux-3.5.3-gentoo/include/linux/fs.h-                          const struct cred *);

Apparently the definition changed between linux-3.5 and linux-3.6 and aufs3 needs to adapt.
Comment 6 Dennis Schridde 2012-10-17 23:17:36 UTC
Figured it out. It seems linux-mod.eclass does by default not detect the version based on KBUILD_OUTPUT, but on KERNEL_DIR. If the latter is not set, it defaults to the running kernel, which does not match the version in KBUILD_OUTPUT.

After I set both variables the build succeeds. I'll hence blame it on linux-mod.eclass not detecting that the KERNEL_DIR it selected does not match the KBUILD_OUTPUT. The latter should contain a "source" symlink to KERNEL_DIR, and hence allow to detect its version in the same way as for KERNEL_DIR.

Further KERNEL_DIR could be automatically set to $KBUILD_OUTPUT/source, if the latter is set but not the former.
Comment 7 Dennis Schridde 2012-10-18 07:40:38 UTC
The patch is not to solve this problem (but bug #432392 and its children), but just informative to tell you what modifications I made. Hence I remove Keywords:PATCH.
Comment 8 Mike Pagano gentoo-dev 2021-09-07 12:26:03 UTC
If this is still an issue after the latest fixes please re-open with reproducible steps.