FS#23110 - A different pacman --config, points to a wrong mirrolist file

Attached to Project: Pacman
Opened by M Carreira Silva (mcsilva) - Wednesday, 02 March 2011, 23:34 GMT
Last edited by Allan McRae (Allan) - Friday, 19 January 2018, 04:20 GMT
Task Type Bug Report
Category Documentation
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 3.4.3
Due in Version 5.1.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:

When using "pacman --config" pointing to another pacman.conf, the pacman.d/mirrorlist file used, is not the one expected to be, but the default /etc/pacman.d/mirrorlist.

Steps to Reproduce:

Mount a disk with another arch system in /mnt/disk/, and try to install a package in it:

# pacman --debug --config /mnt/disk/etc/pacman.conf --root /mnt/disk/ -S somepackage

Reading the debug output, one can confirm that /mnt/disk/etc/pacman.conf is not using /mnt/disk/etc/pacman.d/mirrorlist file as it would be expected, but it's using /etc/pacman.d/mirrorlist file (which is the absolute path described in pacman.conf)
This can be a tricky situation if someone is not aware of it.
I think that "pacman --config" should take care of path in pacman.conf Include options, and consider them as relative path.

This task depends upon

Closed by  Allan McRae (Allan)
Friday, 19 January 2018, 04:20 GMT
Reason for closing:  Implemented
Additional comments about closing:  --sysroot added in fae33a1faf3f
Comment by Allan McRae (Allan) - Thursday, 03 March 2011, 00:17 GMT
Does that command work at all? I would have though that specifying --root /mnt/disk also sets the root for when the config files is. i.e. that should mean that --config argument now looks in /mnt/disk/mnt/disk/etc/pacman.conf?
Comment by M Carreira Silva (mcsilva) - Thursday, 03 March 2011, 01:33 GMT
For testing purposes we can try this command and watch the output:
# pacman --debug --root /mnt/disk --dbpath /var/lib/pacman -Q | less

Then you can include also --cachedir, --config, --logfile with the values we want and watch the output.

We always get this line:

debug: config: finished parsing /etc/pacman.d/mirrorlist

So mirrorlist file is never changed.
Comment by Dan McGee (toofishes) - Thursday, 03 March 2011, 16:25 GMT
-1 from me.

First, --config is completely different than any of the rest of the options. Unfortunately this is not documented clearly enough in the manpage, but notice the wording under --root:

-r, --root <'path'>
Specify an alternative installation root (default is ‘`/''). This should not be used as a way to install software into
``/usr/local’' instead of “/usr”. This option is used if you want to install a package on a temporary mounted partition which is
"owned" by another system. NOTE: if database path or logfile are not specified on either the command line or in pacman.conf(5),
their default location will be inside this root path.

It does *not* include --config, and for good reason- the config file path has to be done before anything else, and thus can't use information from anywhere else. Why would I point it to a config in one place and expect it to go chasing files elsewhere? What do I do if I specify a root on the command line vs. in the config file? Which do I prefer over the other? What if an Include comes both before and after a DBPath option?

The only thing that needs doing here is better documentation.
Comment by M Carreira Silva (mcsilva) - Friday, 04 March 2011, 11:06 GMT
* Why would I point it to a config in one place and expect it to go chasing files elsewhere? *
This is the point! But is what pacman is doing actually!

If I try to install something in a second disk(other mountpoint/other system), with a config file in that second disk, why is pacman using mirrorlist from the first disk?
Comment by Dan McGee (toofishes) - Friday, 04 March 2011, 14:43 GMT
Because pacman doesn't care what a disk is. It does exactly what you tell it to with the paths it has available. While I understand your confusion, like I said, that can be solved with better documentation.

You failed to address any of the "when do we resolve path X" questions I asked in my previous comment, so without doing that, I don't know what you want. Patches welcome.
Comment by Eli Schwartz (eschwartz) - Friday, 04 August 2017, 04:17 GMT
As of commit fae33a1faf3f94ea46049664ef483b2a3e0d3f01 this use case is served by --sysroot.

Loading...