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

Creating pkgfiledb symbolic link causes apacman to have exit status 1 #72

Closed jeroenrnl closed 7 years ago

jeroenrnl commented 7 years ago

This line (660)

runasroot ln -s ${database}/raw/pkgfile.tar.gz "$pkgfiledb" 2>/dev/null

causes apacman to exit with status 1 - which causes my script to fail. Initially it failed because /var/cache/pkgfile did not exist. I modified my script to create it - which made it run correctly with the first run, but then on the second run, it failed again, now because /var/cache/pkgfile/aur.files already exists. The 2>/dev/null made this very hard to troubleshoot. In all above cases the packages in question were installed without a problem - it just exited with status 1, in my opinion it should not exit with another status than 0 on success. For now, my script deletes /var/cache/pkgfile/aur.files before running - which makes it work, but does defy the purpose of a cache :smile:

oshazard commented 7 years ago

In the meantime, instead of deleting that DB, you should be able to apacman run with the --nodatabase option or uncomment nodatabase='1' in apacman.conf

But yeah I'll take a look at it later today.

oshazard commented 7 years ago

@jeroenrnl I cannot seem to reproduce this issue on a fresh install of ArchLinux.

Can you provide more information? Also for debugging, try bash -x /usr/bin/apacman -S <pkg>; echo $?

jeroenrnl commented 7 years ago

I probably should have added that this was on the first run, where apacman installs itself by running bash /tmp/apacman --gendb --skipcache --quiet --noconfirm -S apacman

oshazard commented 7 years ago

@jeroenrnl Okay, yeah pkgfile is an optional dependency, so apacman now checks if it is installed (also checks if /var/cache/pkgfile directory exists), otherwise it skips updating the local DB.

However, unless you add --nodatabase (or nodatabase='1' in the config), it will still grab the packages.gz file from AUR which is used for regex matching (soon to be replaced with glob syntax).

Additionally, to improve debugging, I've modified the exit codes to follow this (see man 8 apacman)

# Exit Code Meaning
0 Success
1 Miscellaneous errors
2 Invalid parameters
3 Fatal errors, not warnings
4 No package matches found
5 Package does not exist
6 No internet connection
7 ---
8 One or more package(s) failed to build, keep going
9 One package failed to build, do not continue
10 Permission problem -- fakeroot
11 Permission problem -- root user
12 Permission problem -- sudo
13 Permission problem -- su