oshazard / apacman

ArchLinux User Repository (AUR) helper and pacman wrapper
https://aur.archlinux.org/packages/apacman/
GNU General Public License v3.0
70 stars 11 forks source link

AUR package st-pizz #23

Closed suedi closed 9 years ago

suedi commented 9 years ago

When building package st-pizz I get following error:

installing executable file to /tmp/pkgbuild-0/st-pizz/pkg/st-pizz/usr/bin
installing manual page to /tmp/pkgbuild-0/st-pizz/pkg/st-pizz/usr/share/man/man1
Please see the README file regarding the terminfo entry of st.
"st.info", line 207, terminal 'st-meta-256color': /var/empty/.terminfo: permission denied (errno 13)
Makefile:43: recipe for target 'install' failed
make: *** [install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...

==> ERROR: the build failed
  -> Status failed (1): st-pizz
==> apacman exited with an error!

I solved it with applying patch from https://aur.archlinux.org/packages/makepkg-asroot/

and building the package by hand with "makepkg --asroot"

Maybe you have a better way of handling this?

comments?

oshazard commented 9 years ago

@suedi So it builds as a regular user but not the aurbuild user (when running as root)... It seems to be creating ~/.terminfo/ during the build process but that should NOT be possible.

This is not specific to the AUR wrapper either, running makepkg manually creates the same directory, ignoring the fakeroot jail. I cannot even find where in the source code for st-pizz this is being called. What is going on?!

oshazard commented 9 years ago

Okay figured out where it's creating those untracked files.

Makefile: Line 52 tic -s st.info

4 entries written to ~/.terminfo

From the tic manpage

First, you may override the system default by setting the variable TERMINFO in your shell environment to a valid (existing) directory name. Secondly, if tic cannot get access to /usr/share/terminfo or your TERMINFO directory, it looks for the directory $HOME/.terminfo; if that directory exists, the entry is placed there.

Still investigating

oshazard commented 9 years ago

So, the Makefile provided for that program calls external commands directly, which is bad practice for exactly this reason.

Moreover, the fact that those files are able to be written to the user's home directory, points towards a possible bug in makepkg or fakeroot, which will require a follow-up inquiry.

In the meantime, I have left a comment for the AUR maintainer and here's a proper PKGBUILD that works as it should.

suedi commented 9 years ago

Thanks for speedy handling.

Tried your PKGBUILD and can confirm it is working.

So is there no known package that still require --asroot option of makepkg in your opinion?

Good job!

oshazard commented 9 years ago

The AUR maintainer for st-pizz has fixed the PKGBUILD, so you will no longer need to use my patched version.

So, I filed a report with the pacman developer mailing list. Apparently the behavior is a well known limitation for the all major package build environments and why it's important that maintainers are vigilant to check for untracked files.

In the future, apacman will always build packages as the unprivileged aurbuild user. However, for now I'm closing this bug.