Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 579968 - etc-update: config file overwrites command line parameters
Summary: etc-update: config file overwrites command line parameters
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
Depends on:
Reported: 2016-04-14 14:52 UTC by Patrick Lauer
Modified: 2018-01-30 15:18 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

etc-update: fix automode -9 handling of rm_opts (etc-update_non-interactive_rm.patch,681 bytes, patch)
2018-01-30 15:18 UTC, Felix W.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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


   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.