Bug 105939

Summary: libinput install phase failure
Product: Wayland Reporter: huaicheng <lhcwhu>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: email garbage

Description huaicheng 2018-04-07 04:13:15 UTC
Hi, I met an error when compiling libinput, it gave me the following error during "install" phase.

➜  libinput git:(master) ✗ sudo ninja -C builddir/ install
Password:
ninja: Entering directory `builddir/'
[306/307] Installing files.
Installing libinput-device-group to /usr/lib/udev/libinput-device-group
Installing libinput-model-quirks to /usr/lib/udev/libinput-model-quirks
Installing libinput.so.10.13.0 to /usr/lib64/libinput.so.10.13.0
Installing libinput-debug-events to /usr/libexec/libinput/libinput-debug-events
Installing libinput-list-devices to /usr/libexec/libinput/libinput-list-devices
Installing libinput-measure to /usr/libexec/libinput/libinput-measure
Installing libinput-record to /usr/libexec/libinput/libinput-record
Installing libinput-debug-gui to /usr/libexec/libinput/libinput-debug-gui
Installing libinput to /usr/bin/libinput
Installing libinput.h to /usr/include/
Installing /home/psdrv/Downloads/libinput/builddir/80-libinput-device-groups.rules to /usr/lib/udev/rules.d
Installing /home/psdrv/Downloads/libinput/builddir/90-libinput-model-quirks.rules to /usr/lib/udev/rules.d
Installing /home/psdrv/Downloads/libinput/builddir/90-libinput-model-quirks.hwdb to /usr/lib/udev/hwdb.d
Installing /home/psdrv/Downloads/libinput/builddir/meson-private/libinput.pc to /usr/lib64/pkgconfig
Installing /home/psdrv/Downloads/libinput/builddir/libinput-debug-events.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/builddir/libinput-list-devices.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/builddir/libinput-measure.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/tools/libinput-measure-touchpad-tap to /usr/libexec/libinput
Installing /home/psdrv/Downloads/libinput/builddir/libinput-measure-touchpad-tap.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/tools/libinput-measure-touchpad-pressure to /usr/libexec/libinput
Installing /home/psdrv/Downloads/libinput/builddir/libinput-measure-touchpad-pressure.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/tools/libinput-measure-touch-size to /usr/libexec/libinput
Installing /home/psdrv/Downloads/libinput/builddir/libinput-measure-touch-size.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/tools/libinput-measure-trackpoint-range to /usr/libexec/libinput
Installing /home/psdrv/Downloads/libinput/builddir/libinput-measure-trackpoint-range.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/builddir/libinput-record.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/tools/libinput-replay to /usr/libexec/libinput
Installing /home/psdrv/Downloads/libinput/builddir/libinput-replay.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/builddir/libinput-debug-gui.1 to /usr/share/man/man1
Installing /home/psdrv/Downloads/libinput/builddir/libinput.1 to /usr/share/man/man1
Failed to restore SELinux context of installed files...
Standard output:

Standard error:
No such file or directory

Running custom install script '/bin/sh /home/psdrv/Downloads/libinput/src/libinput-restore-selinux-context.sh /usr/lib64 /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0'
Restoring SELinux context on /usr/lib64/libinput.so.10.13.0
No such file or directory
Failed to run install script '/bin/sh /home/psdrv/Downloads/libinput/src/libinput-restore-selinux-context.sh /usr/lib64 /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0'
FAILED: meson-install
/usr/bin/python3.5 /usr/lib/python-exec/python3.5/meson --internal install /home/psdrv/Downloads/libinput/builddir/meson-private/install.dat
ninja: build stopped: subcommand failed.


-------------------------
It seems "libinput-restore-selinux-context.sh" failed, however, i have disabled selinux on my machine. Even when I manually edit meson.build to not run this script, the install phase still fails.

I would appreciate if you can give any hints on how to solve this problem.

Who prints the message "Failed to restore SELinux context"? I grep through the code base, but no matches.

The software versions I use:
Python 3.5
meson 0.45.1
ninja 1.8.2


Thanks.
Comment 1 Peter Hutterer 2018-04-09 00:10:33 UTC
> Failed to restore SELinux context of installed files...

That bit is printed by meson itself, see the source file mesonbuild/scripts/meson_install.py

But there's something rather weird:

> restore-selinux-context.sh /usr/lib64 /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0'
> Restoring SELinux context on /usr/lib64/libinput.so.10.13.0
> No such file or directory

Invocation is correct, the echo from the script is correct but it says "no such file or directory", even though above it says:

> Installing libinput.so.10.13.0 to /usr/lib64/libinput.so.10.13.0

Don't know what exactly is going on her but they both seem to be the same issue - even though the file is installed to that location, restorecon fails to find it. I don't know why that could be, tbh, but this seems to be the bit worthy of investigation.
Comment 2 huaicheng 2018-04-09 02:11:00 UTC
Created attachment 138688 [details]
email garbage

Thanks for the analysis.

When I added "exit 0" to the end of restore-selinux-context.sh file, it can
fool the building system to
continue the installation process without further complaining.

On Sun, Apr 8, 2018 at 7:10 PM, <bugzilla-daemon@freedesktop.org> wrote:

> Peter Hutterer <peter.hutterer@who-t.net> changed bug 105939
> <https://bugs.freedesktop.org/show_bug.cgi?id=105939>
> What Removed Added
> CC   peter.hutterer@who-t.net
> Status NEW NEEDINFO
>
> *Comment # 1 <https://bugs.freedesktop.org/show_bug.cgi?id=105939#c1> on
> bug 105939 <https://bugs.freedesktop.org/show_bug.cgi?id=105939> from Peter
> Hutterer <peter.hutterer@who-t.net> *
>
> > Failed to restore SELinux context of installed files...
>
> That bit is printed by meson itself, see the source file
> mesonbuild/scripts/meson_install.py
>
> But there's something rather weird:
> > restore-selinux-context.sh /usr/lib64 /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0'
> > Restoring SELinux context on /usr/lib64/libinput.so.10.13.0
> > No such file or directory
>
> Invocation is correct, the echo from the script is correct but it says "no such
> file or directory", even though above it says:
> > Installing libinput.so.10.13.0 to /usr/lib64/libinput.so.10.13.0
>
> Don't know what exactly is going on her but they both seem to be the same issue
> - even though the file is installed to that location, restorecon fails to find
> it. I don't know why that could be, tbh, but this seems to be the bit worthy of
> investigation.
>
> ------------------------------
> You are receiving this mail because:
>
>    - You reported the bug.
>
>
Comment 3 Peter Hutterer 2018-04-09 02:51:33 UTC
please trim your emails when replying via email. otherwise you're dumping all email content into the bugzilla comments and creating random attachments.

Replace the shebang in the script with #!/bin/sh -x and run it again, what's the output then? What does restorecon /usr/lib64/libinput.so.10.13.0 say when run manually (after install)?
Comment 4 huaicheng 2018-04-09 05:41:27 UTC
>please trim your emails when replying via email. otherwise you're dumping all email >content into the bugzilla comments and creating random attachments.

Sorry about that.

>Replace the shebang in the script with #!/bin/sh -x and run it again, what's the output >then? 

Adding "-x" after "#!/bin/bash" gives me nothing more in the output, instead, I add "set -x" to restore-selinux.sh. The relevant output is below:

Installing /home/psdrv/Downloads/libinput/builddir/libinput.1 to /usr/share/man/man1
Failed to restore SELinux context of installed files...
Standard output:

Standard error:
No such file or directory

Running custom install script '/bin/sh /home/psdrv/Downloads/libinput/src/libinput-restore-selinux-context.sh /usr/lib64 /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0'
+ libdir=/usr/lib64
++ basename /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0
+ sofile=libinput.so.10.13.0
+ command -v restorecon
+ echo 'Restoring SELinux context on /usr/lib64/libinput.so.10.13.0'
Restoring SELinux context on /usr/lib64/libinput.so.10.13.0
+ restorecon /usr/lib64/libinput.so.10.13.0
No such file or directory
Failed to run install script '/bin/sh /home/psdrv/Downloads/libinput/src/libinput-restore-selinux-context.sh /usr/lib64 /home/psdrv/Downloads/libinput/builddir/libinput.so.10.13.0'
FAILED: meson-install 
/usr/bin/python3.5 /usr/lib/python-exec/python3.5/meson --internal install /home/psdrv/Downloads/libinput/builddir/meson-private/install.dat
ninja: build stopped: subcommand failed.

>What does restorecon /usr/lib64/libinput.so.10.13.0 say when run manually (after >install)?

It reports "No such file or directory", but /usr/lib64/libinput.so.10.13.0 exits in my system.

$ ll /usr/lib64/libinput.so.10.13.0
-rwxr-xr-x 1 root root 752K Apr  8 20:17 /usr/lib64/libinput.so.10.13.0


It's also strange when I manually run the restore-selinux script, it doesn't enter the "if" statement, however, the above output shows that statements inside "if" are executed.
Comment 5 Peter Hutterer 2018-04-09 06:02:42 UTC
ok, there's something wrong with restorecon on your system. not sure what exactly it is, but it ls shows the file but both meson and this script fail to restore it (independently), the issue with outside our influence, sorry.

If it ends up being a libinput bug please re-open but if restorecon doesn't find a file that's clearly there, something else is the matter.
Comment 6 huaicheng 2018-04-09 06:07:57 UTC
I see. Thank you for the help!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.