FS#57505 - [pacman-contrib] paccache doesn't support multiple CacheDir's, always uses the first one

Attached to Project: Pacman
Opened by Maxim Baz (maximbaz) - Wednesday, 14 February 2018, 11:23 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 08 March 2018, 19:01 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.0.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

This is second issue with using custom repos in addition to  FS#57503 .

It is possible to specify multiple CacheDirs, such as:

```
CacheDir = /var/cache/pacman/pkg /var/cache/pacman/myrepo
```

Or:

```
CacheDir = /var/cache/pacman/pkg
CacheDir = /var/cache/pacman/myrepo
```

However in both cases paccache only reads the first directory and exits, ignoring the rest of cache directories.

I expect paccache to read and process all cache directories.

Workaround is to use `-c` option of paccache.

Additional info:
* package version(s): pacman 5.0.2-2
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Thursday, 08 March 2018, 19:01 GMT
Reason for closing:  Fixed
Additional comments about closing:  Originally fixed in 722b66d280a15ced318d3be6d686a979ddab677d
As of commit 28e29ddfdc4c788842ba010b3660bd21575a99bd paccache actually uses pacman-conf properly.
Comment by Eli Schwartz (eschwartz) - Wednesday, 14 February 2018, 12:31 GMT
If you look at the code, it does in fact try to parse all CacheDirs. But saying that it detects the first one, /var/cache/pacman/pkg, tells us nothing as that is also the default if it detects no CacheDirs at all.

The proper solution is to migrate pacman-contrib scripts to pacman-conf instead of manual parsing. For things still in pacman's own codebase, this was already done.
Comment by Maxim Baz (maximbaz) - Wednesday, 14 February 2018, 12:54 GMT
Thanks! I did look at the code before reporting, here's what I see:

```
get_cachedir_from_config() {
local key value

while IFS=$'= \t' read -r key value _; do
if [[ $key = CacheDir ]]; then
echo "$value"
return 0 <------- exit after first result, unless I misunderstand this?
fi
done <"$1"

return 1
}
```

I also tried to swap the definitions of CacheDir and it only picked up the custom `myrepo`.
Comment by Eli Schwartz (eschwartz) - Wednesday, 14 February 2018, 15:17 GMT
Uh, oh, whoops :D

That was fixed in  FS#47024  via https://git.archlinux.org/pacman-contrib.git/commit/?id=722b66d280a15ced318d3be6d686a979ddab677d in git master, which is what I have installed.

It breaks anyway with `Include = /etc/pacman.d/base.conf`
Comment by Maxim Baz (maximbaz) - Wednesday, 14 February 2018, 15:22 GMT
Oh I didn't see that ticket...

A have a little bit off-topic request: when I go to pacman package [1] and click on "Bug reports", I am redirected to [2] which only have 10 tickets in total. Instead it should redirect to [3], which is where most of the tickets are, as I learned now. Could you change the "Bug reports" link to point to [3] instead of [2]?

[1]: https://www.archlinux.org/packages/core/x86_64/pacman/
[2]: https://bugs.archlinux.org/?project=1&string=pacman
[3]: https://bugs.archlinux.org/?project=3
Comment by Jelle van der Waa (jelly) - Wednesday, 14 February 2018, 15:36 GMT
No, the "Bug reports" link is about the pacman package and not about the pacman project.
Comment by Eli Schwartz (eschwartz) - Wednesday, 14 February 2018, 18:05 GMT
Upstream bugreports do not belong on the Arch Linux bugracker.

Unless Arch Linux is the upstream for that software, which is the case here. ;) But we still have separate bugtracker projects for package issues as opposed to upstream development issues.

Loading...