Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 526528 - sys-apps/portage-2.2.8-r2: etc-update clobbers command-line settings when it loads the config file
Summary: sys-apps/portage-2.2.8-r2: etc-update clobbers command-line settings when it ...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-22 21:36 UTC by W. Trevor King
Modified: 2014-10-23 00:29 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description W. Trevor King 2014-10-22 21:36:10 UTC
Usually precedence is:

1. Command-line flags, falling back to
2. Environment variables, falling back to
3. Config files

But etc-update has:

  while [[ -n $1 ]] ; do
    case $1 in
      -d|--debug)   SET_X=true;;
      …
    esac
    shift
  done
  …
  get_config "($(printf '%s|' "${cfg_vars[@]}")NOVARFOROLDMEN)"

which means things like the rm_opts set by parse_automode_flag is getting clobbered by the config-file version.


Reproducible: Always

Steps to Reproduce:
1. Have some /etc config script to update
2. echo 'YES' | etc-update --automode -9

Actual Results:  
Scanning Configuration files...
Deleting /etc/layman/._cfg0000_layman.cfg
rm: remove regular file '/etc/layman/._cfg0000_layman.cfg'? Exiting: Nothing left to do; exiting. :)
NOTE: 1 updates remaining

Expected Results:  
Actually remove the update.


Shifting the argument-parsing while-loop after the get_config command fixed the problem.
Comment 1 W. Trevor King 2014-10-22 21:39:50 UTC
Although obviously you'd want to keep stuff like `${SET_X} && set -x` after the argument parsing.  I wouldn't be surprised if things like NONINTERACTIVE_MV could be removed (sticking to mv_opts) too.  I haven't had time to internalize the script well enough to write a patch addressing that sort of thing, but I'll get to that eventually if this languishes for too long ;).
Comment 2 Brian Dolbec (RETIRED) gentoo-dev 2014-10-22 22:56:46 UTC
almost the correct assignee ;)
Comment 3 W. Trevor King 2014-10-22 23:00:42 UTC
(In reply to Brian Dolbec from comment #2)
> almost the correct assignee ;)

Ah, thanks :p.  I usually just peak at a few existing bugs to figure out what these should be for a package (maybe we should list them in metadata.xml?).  In this case "Tools" and "Core Configuration" seemed popular [1] ;).

[1]: https://bugs.gentoo.org/buglist.cgi?quicksearch=etc-update