Bug 136898 - yum ignores a local configuration file
Summary: yum ignores a local configuration file
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeremy Katz
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-22 21:45 UTC by Michal Jaegermann
Modified: 2014-01-21 22:50 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-23 03:05:58 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Michal Jaegermann 2004-10-22 21:45:25 UTC
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

   baseurl=file:///path/to/a/depository/on/a/local/disk/here

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):
yum-2.1.10-3

Comment 1 Michal Jaegermann 2004-10-22 22:16:02 UTC
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?

Comment 2 Seth Vidal 2004-10-23 03:05:33 UTC
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.


Comment 3 Michal Jaegermann 2004-10-23 05:06:47 UTC
> 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.

Comment 4 Seth Vidal 2004-10-23 12:05:25 UTC
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?


Comment 5 Michal Jaegermann 2004-10-23 17:57:52 UTC
> 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.


Comment 6 Seth Vidal 2004-10-25 03:38:31 UTC
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.
   reposdir
     directory where yum should look for .repo files for its configu-
     ration of repositories. Default is /etc/yum.repos.d





Note You need to log in before you can comment on or make changes to this bug.