Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 353939 - Ctrl+C while running etc-update updates all config files (like selecting '-5') before exiting
Summary: Ctrl+C while running etc-update updates all config files (like selecting '-5'...
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-07 08:16 UTC by Joshua Kinard
Modified: 2011-02-28 07:43 UTC (History)
1 user (show)

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 Joshua Kinard gentoo-dev 2011-02-07 08:16:02 UTC
Hitting Ctrl+C while in etc-update to break out of the program will auto-update all remaining config files in the list.  This is the same behavior as selecting "-5" while interactively in the program.

Reproducible: Always

Steps to Reproduce:
1. Update some packages that include updates to config files.
2. Run etc-update.
3. Hit Ctrl+C while in etc-update

Actual Results:  
Remaining config file updates get merged without warning, then programs exits.  If there were pending updates for key configuration files, this could cause them to get overwritten by package defaults, which may lead to system breakage.  In my case, sshd_config got overwritten, but I was able to recover from a backup.

Expected Results:  
Program should simply exit.
Comment 1 Zac Medico gentoo-dev 2011-02-07 08:23:59 UTC
The signal handlers look like this:

trap "die terminated 1" SIGTERM
trap "die interrupted 1" SIGINT

And the die function looks like this:

die() {
	trap SIGTERM
	trap SIGINT

	if [ "$2" -eq 0 ]; then
		echo "Exiting: ${1}"
		scan > /dev/null
		[ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
	else
		echo "ERROR: ${1}"
	fi

	rm -rf "${TMP}"
	exit ${2}
}

So, it seems like it should simply say "ERROR: interrupted", remove temp files, and exit. What am I missing?
Comment 2 SpanKY gentoo-dev 2011-02-07 21:36:55 UTC
i certainly hit CTRL+C in the middle of an etc-update from time to time and have yet to his this behavior ...
Comment 3 Joshua Kinard gentoo-dev 2011-02-09 21:41:33 UTC
Okay, I've tried reproducing this several different ways on one of my MIPS machines, but it exits normally.

The amd64 box, which is where I saw this happen, hasn't updated any packages yet to require running etc-update again.  I believe it couldn't have been me typing '-5' and then forgetting, because sshd_config was one of the last files that wanted to be updated (after webapp-config's vhost setup).  But I only looked at the merge differences for /etc/rc.conf (the first config file that wanted an update), merged that, then thought I'd messed something up.  So I was sitting back at the etc-update prompt when I hit Ctrl+C, looked at /etc/rc.conf, then exited nano.

Since I was in a screen session, I scrolled up (Ctrl+A up/down), and saw that all the remaining config files had been replaced.  I assumed it was the Ctrl+C keypress that did that.

Commented it (somewhat snarkily) in #gentoo-dev, and robbat2 mentioned he'd run into the same issue a few times, randomly, and suggested I open a bug.

Could it be possible that there's some random issue that makes it difficult to reproduce?  I'll keep trying Ctrl+C at etc-update prompts to see if it re-occurs.
Comment 4 Joshua Kinard gentoo-dev 2011-02-28 07:43:42 UTC
Still can't reproduce.  Assuming this is a heisenbug, or I had a minor temporal accident and fat fingered it somehow.