[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt-get autoclean configuration



On 2017-07-19, <tomas@tuxteam.de> <tomas@tuxteam.de> wrote:
>
>> 
>> $ cat /etc/apt/apt.conf.d/80autoclean 
>> APT::Clean-Installed "false";
>
> Didn't find any ref in the docs, so I downloaded the package source
> (with a tip o' the hat to the "video driver/free software" thread,
> esp. to Doug there: hi, Doug :-)

The man page sends you to '/usr/share/doc/apt/examples/configure-index.gz', where
the boolean values are exclusively (I think) "true" or "false", as are
all the default values in the /etc/apt/apt/apt.conf.d "fragments."

> There is this function StringToBool in apt-pkg/contrib/strutl.cc:
>
> | // StringToBool - Converts a string into a boolean                      /*{{{*/
> | // ---------------------------------------------------------------------
> | /* This inspects the string to see if it is true or if it is false and
> |    then returns the result. Several varients on true/false are checked. */
> | int StringToBool(const string &Text,int Default)
> | {
> |    char *ParseEnd;
> |    int Res = strtol(Text.c_str(),&ParseEnd,0);
> |    // ensure that the entire string was converted by strtol to avoid
> |    // failures on "apt-cache show -a 0ad" where the "0" is converted
> |    const char *TextEnd = Text.c_str()+Text.size();
> |    if (ParseEnd == TextEnd && Res >= 0 && Res <= 1)
> |       return Res;
> |    
> |    // Check for positives
> |    if (strcasecmp(Text.c_str(),"no") == 0 ||
> |        strcasecmp(Text.c_str(),"false") == 0 ||
> |        strcasecmp(Text.c_str(),"without") == 0 ||
> |        strcasecmp(Text.c_str(),"off") == 0 ||
> |        strcasecmp(Text.c_str(),"disable") == 0)
> |       return 0;
> |    
> |    // Check for negatives
> |    if (strcasecmp(Text.c_str(),"yes") == 0 ||
> |        strcasecmp(Text.c_str(),"true") == 0 ||
> |        strcasecmp(Text.c_str(),"with") == 0 ||
> |        strcasecmp(Text.c_str(),"on") == 0 ||
> |        strcasecmp(Text.c_str(),"enable") == 0)
> |       return 1;
> |    
> |    return Default;
>
> That seems to be it: no/false/without/off/disable versus yes/true/with/on/enable.
> Should that be in the docs?

I don't know; the program is tolerant without befuddling you with a
host of possibilites (like a menu in a Chinese restaurant).

However this thread is proof that confusion arises and has arisen. I
would be for stating clearly and exclusively in the man page the options
"true" and "false" while leaving the tolerance in the code.

> Cheers
> - -- tomás
>
>


-- 
“We’ll sit around talking about the good old days, when we wished that we were dead.”
--Samuel Beckett, speculating on the nature of the afterlife.


Reply to: