Red Hat Bugzilla – Bug 136898
yum ignores a local configuration file
Last modified: 2014-01-21 17:50:24 EST
Description of problem:
'man yum' says:
-c [config file]
Specifies the config file location - can take http, ftp
urls and local file paths.
This is indeed how yum _used_ to work and to some extent it still
does; but if I have /etc/yum.repos.d/, as populated by
fedora-release-3-rawhide package, then after
yum -c ./local.conf update
it clearly does not pay attention to what is in that file but
it tries to retrieve needed packages from some servers on the net
while I explicitely specified
Really annoying if packages in question add up to 194 Megs of
openoffice and a network connection is not that speedy DSL.
It is even hard to stop as killing it spawns the next process
which just goes to the next server on some mirrors list.
Once I hide /etc/yum.repos.d/, by renaming it to something else,
then updating with a local configuration file works just fine.
Does that mean that adding 'failovermethod=priority' would work
as expected or one has to add in a local configuration
'reposdir=/dev/null'? If so this should be clearly documented
in a description of '-c' option in 'man yum' as one expects that
a local configuration file will cause a replacement of a default
behaviour and not that it will be tucked at the end of it.
It seems to me that to follow "the least surprise principle"
an options -c should undefine 'reposdir' automatically and
one could, clearly, to set it explicitly to anything desired
(with a corresponding fragment in docs, of course).
BTW - there is a typo in 'man yum.conf'. It says "Defaul is
/etc/yum.repos.d" in a description of reposdir option.
Version-Release number of selected component (if applicable):
Adding 'reposdir=/dev/null' in a local configuration file indeed
seems to restore an expected behaviour. I checked on another
machine. Wouldn't be that clasified as a hack? Or 'reposdir=""'
is good enough?
reposdir defaults to /etc/yum.repos.d
so if you don't set it then it will read from that location.
just like if you don't set cachedir it will default to /var/cache/yum
so, how do we fix it? We don't it is correct behavior.
you can avoid the repos in your reposdir by setting it to an
alternative or a nonexistent location, any location will do.
> so, how do we fix it? We don't it is correct behavior.
My contention is that because this behaviour is surprising,
and not clearly documented as such but one has to play a
lawyer and read between lines, that this is still at least
a "documentation bug". Fixing it is quite simple. Just spell
out what you said in comment #2 on documentation pages -
preferably with a clear reference to a correct place when
dsscribing '-c' option to yum or just make that remark there.
Yes, I figured out for myself that 'reposdir=/dev/null' should do it.
If that would be equally clear to everybody is somewhat doubtful.
In general I cannot be sure that some other location is "nonexistent".
An answer to the question if reposdir set to an empty string would
work likely requires diving into details of the yum code.
If you were running bash and you told it to load your configuration
from an alternative file, would you be surprised when any option you
did not define in that alternative config file was given the default
value defined in the program itself?
So why is it different for yum?
> If you were running bash ...
So you are implying that yum has somewhere explicitely documented
what is an equivalent of 'undef'? I am afraid that I missed that.
And that there is also a yum documentation fragment which corresponds
to a section which starts with "This section describes how Bash
executes its startup files"? How about something similar to
`--rcfile', '--noprofile' and '--norc' options?
If I am using '-c some.config.file' the I am, possibly naively,
expecting that this is somewhat akin to '--rcfile' which runs some
other file _instead_ of `~/.bashrc'. What in yum docs suggests
that this interpretation is unreasonable? Or, at least, that
configuration directives from my config will be used first before
following with the other stuff only if needed.
If the above is not the case then all what I am asking is a sentence
or two in manapages which disambiguates the situation. Right now I am
convinced that I told yum to use only some specific 'baseurl' but it
turns out, surprise, surprise, that this is not the case at all.
A nice riddle but I thought that the goal was a bit different.
No, I'm saying yum has explicitly listed what is a default. Therefore
if the option is unlisted it is what the option will default to.
It's not about the path to the primary config file.
it is about the defaults assumed for values within that file.
if you look at the bash analogy. Yes, it points to a different rcfile
but the value of PS1 still has a DEFAULT.
This sentence in the yum.conf man page.
directory where yum should look for .repo files for its configu-
ration of repositories. Default is /etc/yum.repos.d