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

Bug 728416

Summary: sys-apps/file-5.39[seccomp][ppc64]: error: invalid application of 'sizeof' to incomplete type 'struct termios'
Product: Gentoo Linux Reporter: Georgy Yakovlev <gyakovlev>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugs.astron.com/view.php?id=168
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: file-5.39-add-missing-termios.patch

Description Georgy Yakovlev archtester gentoo-dev 2020-06-15 20:20:53 UTC
Fails to build on ppc64


In file included from /var/tmp/portage/sys-apps/file-5.39/work/file-5.39/src/seccomp.c:34:
/var/tmp/portage/sys-apps/file-5.39/work/file-5.39/src/seccomp.c: In function 'enable_sandbox_full':
/var/tmp/portage/sys-apps/file-5.39/work/file-5.39/src/seccomp.c:194:19: error: invalid application of 'sizeof' to incomplete type 'struct termios'
  194 |  ALLOW_IOCTL_RULE(TCGETS);
      |                   ^~~~~~
/var/tmp/portage/sys-apps/file-5.39/work/file-5.39/src/seccomp.c:194:2: note: in expansion of macro 'ALLOW_IOCTL_RULE'
  194 |  ALLOW_IOCTL_RULE(TCGETS);
      |  ^~~~~~~~~~~~~~~~
make[3]: *** [Makefile:558: seccomp.o] Error 1
make[3]: *** Waiting for unfinished jobs...



seems to be related to 
https://bugs.astron.com/view.php?id=130
Comment 1 Georgy Yakovlev archtester gentoo-dev 2020-06-15 20:26:19 UTC
On PPC64, TCGETS is defined in terms of struct termios, so it must include termios.h

adding 
#ifdef __powerpc64__
#include <termios.h>
#endif

to src/seccomp.c fixes the build.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2020-06-15 21:27:27 UTC
Created attachment 644934 [details, diff]
file-5.39-add-missing-termios.patch

after speaking to some folks we figured it's ok to include unconditionally.

on ppc, TCGETS relies on struct termios being complete, on other
architectures it does not.
so termios.h should be included before ioctl.h


patch attached.
it may need autoconf file changes to check for header probably.
Comment 3 Larry the Git Cow gentoo-dev 2020-06-28 02:10:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d32972fa6671b911726d7a2abd4128afd35a36b

commit 3d32972fa6671b911726d7a2abd4128afd35a36b
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-06-28 02:07:30 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-06-28 02:08:13 +0000

    sys-apps/file: revbump 5.39, add include termios.h patch
    
    Closes: https://bugs.gentoo.org/728416
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Acked-by: Lars Wendler <polynomial-c@gentoo.org>
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 sys-apps/file/file-5.39-r2.ebuild                  | 141 +++++++++++++++++++++
 .../file/files/file-5.39-add-missing-termios.patch |  27 ++++
 2 files changed, 168 insertions(+)