Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.

FS#62912 - [repo-add] Database not updated, if encountering ERROR (while indicating skipping)

Attached to Project: Pacman
Opened by David Runge (dvzrv) - Sunday, 16 June 2019, 12:43 GMT
Last edited by David Runge (dvzrv) - Sunday, 16 June 2019, 12:44 GMT
Task Type Bug Report
Category Scripts & Tools
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.1.3
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Summary and Info:
When (accidentally) running repo-add with an expansion, that is too broad, or a file that is not a package, no package will be added.
The ERROR message indicates, that it is skipping the file (e.g. package.pkg.tar.xz.sig), but it leads to the database (e.g. db-file.db.tar.gz) not being updated.

When run with multiple files, that are no packages, repo-add still evaluates all files, but also doesn't update db-file.db.tar.gz.

I think a better behavior could be to either fail early (on the first ERROR encountered), or to allow additions to fail (e.g. demoting to WARNING and really skip them) and eventually update the database with additions, that didn't fail.

The current behavior is relatively unexpected as the ERROR message indicates skipping, but then the db-file.db.tar.gz is never updated.

Steps to Reproduce:

Create package.pkg.tar.xz and a detached signature for it (or just touch a file name package.pkg.tar.xz.log)

`repo-add -s db-file.db.tar.gz package.pkg.tar.xz*`

==> Extracting database to a temporary location...
==> Extracting database to a temporary location...
==> Adding package 'package.pkg.tar.xz'
-> Adding package signature...
-> Computing checksums...
-> Creating 'desc' db entry...
-> Creating 'files' db entry...
==> ERROR: 'package.pkg.tar.xz.sig' is not a package file, skipping
==> No packages modified, nothing to do.
This task depends upon

Comment by Allan McRae (Allan) - Sunday, 16 June 2019, 13:26 GMT
The "No packages modified" bit is correct. "nothing to do" is not... Could probably improve on "skipping" too.
Comment by Eli Schwartz (eschwartz) - Sunday, 16 June 2019, 16:15 GMT
I guess this was behavior which changed in

At that time, the log message for skipped packages should have been changed, because now it is no longer true. At the same time, simply switching "success" to "fail" was an incomplete way to implement the desired functionality, because we should have hoisted the "nothing to do" message to a check on the length of $#, and broken on the first failure instead of blindly going forth and doing things that are useless.

Allan -- this makes the second way this commit was broken, after  FS#58505  :p