Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 579968

Summary: etc-update: config file overwrites command line parameters
Product: Portage Development Reporter: Patrick Lauer <patrick>
Component: ToolsAssignee: Portage Tools Team <tools-portage>
Status: CONFIRMED ---    
Severity: normal CC: erkiferenc, felix.wischke
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: etc-update: fix automode -9 handling of rm_opts

Description Patrick Lauer gentoo-dev 2016-04-14 14:52:50 UTC
"etc-update --automode -9" will ask for file removal since it by default uses rm -i.

There's a workaround: Setting rm_opts in /etc/etc-update.conf, but that's changing behaviour of other automodes.


The core of the problem is wrong ordering of option parsing and config parsing:

   731                  --automode)   parse_automode_flag $2 && shift || usage 1 "Invalid mode '$2'";;

this parses the --automode flag and runs the parse_automode_flag function that sets DELETE_ALL and rm_opts

then:

   781  cfg_vars=(

   784          rm_opts

   793  eval ${cfg_vars[@]/%/=}


So here the config file is evaluated and overwrites the settings. The fix would be to move this whole block above the cli option parsing...
Comment 1 Felix W. 2018-01-30 15:18:07 UTC
Created attachment 517132 [details, diff]
etc-update: fix automode -9 handling of rm_opts

Walked into the same issue today.

Since somebody else also seems to have walked into the same issue with "etc-update --automode -5" (noninteractive mv), I've created a patch in the same vein.