著者: Simon Wise 日付: To: dng 題目: Re: [DNG] systemd is haunting me
On 02/02/16 00:13, Simon Hobson wrote: > Florian Zieboll<f.zieboll@???> wrote:
>
>> For the fun of it, I just ran an "apt-get install --install-recommends
>> --no-install-recommends" and it chose to not install the recommends.
>> The same with contradicting lines in apt.conf(.d/*):
>>
>> APT::Install-Recommends "0";
>> APT::Install-Recommends "1";
>>
>> This will install the recommends, the other way around it won't.
>> Apparently there's still some behavior left in modern Linux that is
>> coherent with an autistic mindset, hahaha.
>
> Makes sense to me too - first entry sets/resets option, next entry resets/sets the same option - the last one taking effect.
that is simply the apt.conf syntax ... like many, but not all, such files the
last setting you give overrides all previous, and the file is read top to
bottom, in a well-defined position wrt other config locations.
Any config system needs some rule on this, reading man pages should tell the
specific details for a program ... and if (as is typical) there is more than one
place to add configurations then the order they are read is also carefully
defined for each.
For example many tools read the ENV, accept options as args, have a per user
config and a system wide default. This is complicated, but I would not want to
lose any of them. So it is very likely that some of these will contradict the
others. So a definition that "the last value read overrides all previous" makes
sense. Then it may be necessary to add some special options to be able to
prevent reading some local options.
Debian adds to this with a .d/ directory of file snippets that read and included
in the standard .conf file, in lexical order, at the same time as a single .conf
in that location would be. Hence those numbers at the start of those files to
determine order transparently and consistently ... there are debian tools
provided to read this directory so that this behaviour is predictable, it is
also consistent in many many debian packages. Packages sometimes use a master
.conf file with an 'include' copying all the little files, or sometimes do this
reading the snippets directly simply increasing the number of available files to
configure so that individual packages have one each.