yay icon indicating copy to clipboard operation
yay copied to clipboard

AUR devel packages get added to vcs.json even when the package fails to build/install

Open LRFLEW opened this issue 3 years ago • 1 comments

Affected Version

Tested: yay v11.1.0 - libalpm v13.0.1 yay v11.1.0.r4.g09695c6 - libalpm v13.0.1 The issue likely goes back for many versions.

Describe the bug

If you attempt to install an AUR devel package and it fails for whatever reason, the package still gets added to vcs.json. This means that the git repository for the package will be checked on any system upgrade with the devel option, even though the package is not actually installed. The package also seems to be stuck in vcs.json unless the user manually removes the entry. (There may be a way to remove it I don't know, but I do know that yay -R <package> doesn't work since the package isn't installed).

Reproduction Steps

For the reproduction steps, I'm going to use the AUR package run_scaled-git. This package fails to install because one of its dependencies (xpra) provides the run_scaled script already.

  1. yay -S run_scaled-git
  2. Confirm that run_scaled-git was not installed (eg, looking at the output of the previous call, or running yay -Qi run_scaled-git)
  3. Look in vcs.json for an entry for run_scaled-git

Expected behavior

Since the package was not installed, it should not be added to vcs.json.

Output

I truncated the build output for brevity.

$ yay -S run_scaled-git
...
Packages (1) run_scaled-git-r20.6699934-1
 
Total Installed Size:  0.01 MiB
 
:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                               [#################################] 100%
(1/1) checking package integrity                             [#################################] 100%
(1/1) loading package files                                  [#################################] 100%
(1/1) checking for file conflicts                            [#################################] 100%
error: failed to commit transaction (conflicting files)
run_scaled-git: /usr/bin/run_scaled exists in filesystem (owned by xpra)
Errors occurred, no packages were upgraded.
 -> exit status 1
$ yay -Qi run_scaled-git
error: package 'run_scaled-git' was not found
$ grep run_scaled-git ~/.cache/yay/vcs.json
        "run_scaled-git": {
$

LRFLEW avatar Jan 22 '22 08:01 LRFLEW

I think I'm running into this problem too.

$ yay -Syu --devel
...
:: Checking development packages...
 -> devel check for package failed: '/usr/bin/git ls-remote git://github.com/neheb/libhashab.git HEAD' encountered an error
 -> devel check for package failed: '/usr/bin/git ls-remote git://github.com/AnthonyDiGirolamo/todotxt-machine HEAD' encountered an error
 -> devel check for package failed: '/usr/bin/git ls-remote git://github.com/a-sk/node-imapnotify.git HEAD' encountered an error
 -> devel check for package failed: '/usr/bin/git ls-remote git://github.com/OpenICC/xcalib.git HEAD' encountered an error

I checked in ~/.cache/yay/vcs.json and 12 of the 30 packages listed there aren't installed. (FWIW you can check with grep -oP '(?<=^\t")[^"]*' ~/.cache/yay/vcs.json | while IFS= read -r line ; do pacman -Q $line; done.) The packages listed above are those I've previously installed then uninstalled. Some of them don't exist in the AUR any more.

I asked this previously, but is there a way to reset the database, especially given it occasionally seems to get corrupted and --devel doesn't work properly? I did as per my linked comment above, i.e. rm ~/.cache/yay/vcs.json; yay -Y --gendb, and this indeed did remove the extraneous packages. I'm still not sure if it "properly" resets the database for vcs updates though (as per the issue linked above).

Also, possibly related, I used yay to search for all of my -git packages, then grepped for them in ~/.cache/yay/vcs.json. Almost all of them were there with the exception of one (qtodotxt2-git). I tried reinstalling, but it never gets added.

protist avatar May 14 '22 01:05 protist