Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 8423 - Split CONFIG_PROTECT into separate installing and uninstalling options (nuke untouched files)
Summary: Split CONFIG_PROTECT into separate installing and uninstalling options (nuke ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 15421 20223 24476 25759 30287 37905 42027 43066 46162 56291 66609 83538 98913 125655 125722 135918 136461 158934 164765 165258 166083 (view as bug list)
Depends on:
Blocks: 147007
  Show dependency tree
 
Reported: 2002-09-26 14:13 UTC by Jozsa Kristof
Modified: 2012-01-23 23:45 UTC (History)
36 users (show)

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


Attachments
disable config protect when unmerging (portage-unmerge-disable-cfgpro.patch,599 bytes, patch)
2005-02-28 20:05 UTC, Timo Hirvonen
Details | Diff
A very dangerous script ;) (localpurge,3.83 KB, text/plain)
2005-04-25 17:47 UTC, Alec Warner (RETIRED)
Details
allow the merge phase to overwrite untouched config files (untouched_config_files.patch,3.72 KB, patch)
2006-11-26 00:04 UTC, Zac Medico
Details | Diff
when necessary, bump the mtime to prevent uninstallation of config protected files (untouched_config_files.patch,2.68 KB, patch)
2006-11-26 05:00 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jozsa Kristof 2002-09-26 14:13:18 UTC
One minor thing: what about checking the rc-updates at package removal? It
really makes no sense eg. to leave the rc script for starting exim if I've
emerge -C -ed exim already :)
Comment 1 Daniel Robbins (RETIRED) gentoo-dev 2002-12-10 09:46:10 UTC
Not sure if we want to be that clean. We generally leave config files in place.
Comment 2 SpanKY gentoo-dev 2003-02-25 15:32:18 UTC
from bug 15421 ... add a '--nuke' or like '--veryclean' cmdline option that'll allow people 
to remove all files that were installed regardless of mtimes 
Comment 3 SpanKY gentoo-dev 2003-02-25 15:32:22 UTC
*** Bug 15421 has been marked as a duplicate of this bug. ***
Comment 4 SpanKY gentoo-dev 2003-07-14 20:00:30 UTC
*** Bug 24476 has been marked as a duplicate of this bug. ***
Comment 5 SpanKY gentoo-dev 2003-08-02 13:09:44 UTC
*** Bug 25759 has been marked as a duplicate of this bug. ***
Comment 6 Ian Leitch (RETIRED) gentoo-dev 2003-08-02 14:34:23 UTC
I'd realy like such a feature. /etc gets very crouded on Gentoo, mine is 20M, and thats after some light cleaning. 
Whats the point in leaving config files behind? They're not in use. If a --config-clean option was introduced, it could spit out a warning telling people to backup thier configs if needed. They would then have the 5 second count-down to decide. 
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2003-08-03 16:00:35 UTC
To delete initscripts/configfiles on unmerging you could simply add /etc/init.d or /etc to CONFIG_PROTECT_MASK (in make.conf or on the commandline) temporary. I don't like the idea of a new emerge switch if there is already a simple solution to do this.
Comment 8 Carsten Lohrke (RETIRED) gentoo-dev 2003-08-03 16:30:28 UTC
There is no flag needed. Just a hash for each config file which is created while merging, removing unchanged files on unmerging and printing/logging the ones which remain. The config file protection prevents deleting/overwriting existing config files and does _not_ help to delete useless files (e.g. if you accidentally emerged apache2 or switched from syslog to syslog-ng).
Comment 9 Carsten Lohrke (RETIRED) gentoo-dev 2003-08-03 16:32:04 UTC
^^ sysklogd to ...
Comment 10 David M. Andersen 2003-08-05 16:20:56 UTC
My suggestion would be to make a standalone tool along the lines of app-admin/localepurge.
Comment 11 SpanKY gentoo-dev 2003-10-04 09:39:38 UTC
*** Bug 30287 has been marked as a duplicate of this bug. ***
Comment 12 SpanKY gentoo-dev 2004-01-11 14:17:12 UTC
*** Bug 37905 has been marked as a duplicate of this bug. ***
Comment 13 SpanKY gentoo-dev 2004-02-27 11:22:06 UTC
*** Bug 43066 has been marked as a duplicate of this bug. ***
Comment 14 SpanKY gentoo-dev 2004-03-30 14:11:30 UTC
*** Bug 46162 has been marked as a duplicate of this bug. ***
Comment 15 James Blanding 2004-04-13 21:33:54 UTC
How about just adding some output to the end of an emerge that resulted in a removal being performed...just a simple list of config files that are no longer in use.  I got bit by the vcron->vixie-cron thing, bug 37905.  If at the end of the operation, emerge said "By the way, /etc/init.d/vcron is no longer used," I would have known to delete it.  Just a thought...
Comment 16 SpanKY gentoo-dev 2004-08-02 19:49:10 UTC
*** Bug 56291 has been marked as a duplicate of this bug. ***
Comment 17 SpanKY gentoo-dev 2004-10-07 16:08:00 UTC
*** Bug 66609 has been marked as a duplicate of this bug. ***
Comment 18 Hanno Zysik (geki) 2004-10-08 00:40:03 UTC
Well, just one more replying on this thread here. All people I know that use Gentoo say one thing about it. That it badly misses a purge function like it is on Debian for a long time.

Please add one function like that.


Cheers
Comment 19 Timo Hirvonen 2005-02-28 19:01:07 UTC
*** Bug 83538 has been marked as a duplicate of this bug. ***
Comment 20 Timo Hirvonen 2005-02-28 20:05:35 UTC
Created attachment 52335 [details, diff]
disable config protect when unmerging

This very simple patch disables config protect when unmerging package. Changed
(mtime) files are not removed.
Comment 21 Adam 2005-03-09 06:26:28 UTC
Would this patch exhibit the problem described in comment 6 of Bug 43066?
Comment 22 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-04-25 17:47:44 UTC
Created attachment 57230 [details]
A very dangerous script ;)

This script takes a finite number of directories as arguements as well as
options.  See localpurge --help for available options.

This script will get a file list of files in each dir specified on the command
line.  It will then fetch a list of currently installed packages, and their
CONTENTS ( meaning files they own ).  It then compares the files in the current
dir against the CONTENTS of every installed package.  If a file is not found in
any installed pkg's CONTENTS it is marked as orphaned.

The script supports recursion with the --recurse option.  It will print out
orphaned files by default.  To have it prompt you for files to delete, pass the
--remove option.  To have it auto-delete the files ( NOT RECOMMENDED ) add the
--force option.  To stop all the annoying .....'s try the --quiet option.

Note: Running this as "localpurge / --remove --recurse --force" has the
potential to completely destroy your system.  This script will remove any files
not owned by an installed package, which in some cases means IMPORTANT FILES. 
Always use --scan first, and carefully chose what you want gone.
Comment 23 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-04-25 17:49:34 UTC
Er. bugs with that go to me warnera6@egr.msu.edu, not here BTW :)
Comment 24 SpanKY gentoo-dev 2005-07-13 16:58:58 UTC
*** Bug 98913 has been marked as a duplicate of this bug. ***
Comment 25 Marius Mauch (RETIRED) gentoo-dev 2006-03-09 17:11:16 UTC
*** Bug 125655 has been marked as a duplicate of this bug. ***
Comment 26 Zac Medico gentoo-dev 2006-03-10 14:01:38 UTC
*** Bug 125722 has been marked as a duplicate of this bug. ***
Comment 27 Jan Marten Simons 2006-04-27 07:28:47 UTC
I vote for an --exterminate (-X) or --zap (-Z) option, which would remove all files which were merged, after displaying a warning about this (like suggested). That way you could keep /etc much cleaner.
Comment 28 Jakub Moc (RETIRED) gentoo-dev 2006-06-07 07:03:58 UTC
*** Bug 135918 has been marked as a duplicate of this bug. ***
Comment 29 flo 2006-06-10 05:15:20 UTC
just an idea for the discussion:

i generally have: /etc/make.conf: AUTOCLEAN="no" on all machines i manage.

what i do when upgrading something is:
# emerge something
# etc-update
# CONFIG_PROTECT="-*" emerge clean

and sometimes:
# emerge something
# CONFIG_PROTECT="-*" emerge clean
# etc-update
this cleans out old untouched config files before diffing

when unmerging:
# CONFIG_PROTECT="-*" emerge unmerge something
so untouched and unneeded config files are removed -> that avoids cruft

i think this config file handling should be default on portage so my split emerge and emerge clean then could be avoided.
Comment 30 Marius Mauch (RETIRED) gentoo-dev 2006-06-10 08:23:19 UTC
(In reply to comment #29)
> just an idea for the discussion:
> 
> i generally have: /etc/make.conf: AUTOCLEAN="no" on all machines i manage.
[...]
> i think this config file handling should be default on portage so my split
> emerge and emerge clean then could be avoided.

Definitely not. AUTOCLEAN=no is not supported at all and might be dropped in the future.
Comment 31 Jakub Moc (RETIRED) gentoo-dev 2006-06-11 12:26:37 UTC
*** Bug 136461 has been marked as a duplicate of this bug. ***
Comment 32 Simon Stelling (RETIRED) gentoo-dev 2006-09-16 02:08:26 UTC
Comment on attachment 52335 [details, diff]
disable config protect when unmerging

The patch breaks one (fairly common) case:

You merge version 1 of a package that installs a config file. The user doesn't touch the file. Then, you upgrade that package to version 2. Portage will now put a ._cfg0000_config file into the system and remove the original, leaving the new version as orphaned update there effectively.
Comment 33 Jason Stubbs (RETIRED) gentoo-dev 2006-09-16 03:04:33 UTC
(In reply to comment #32)
> (From update of attachment 52335 [details, diff] [edit])
> The patch breaks one (fairly common) case:
> 
> You merge version 1 of a package that installs a config file. The user doesn't
> touch the file. Then, you upgrade that package to version 2. Portage will now
> put a ._cfg0000_config file into the system and remove the original, leaving
> the new version as orphaned update there effectively.

I can't imagine it would be that common.. collision-protect will choke on the case where two packages share the same config files.
Comment 34 Jason Stubbs (RETIRED) gentoo-dev 2006-09-16 03:05:19 UTC
Or not... Ok, I'll shut up again.
Comment 35 Simon Stelling (RETIRED) gentoo-dev 2006-09-16 04:01:20 UTC
It doesn't have to be another package, another version is sufficient to break it. It's really a typical upgrade scenario :)
Comment 36 Zac Medico gentoo-dev 2006-11-25 20:31:55 UTC
(In reply to comment #32)
> (From update of attachment 52335 [details, diff] [edit])
> The patch breaks one (fairly common) case:
> 
> You merge version 1 of a package that installs a config file. The user doesn't
> touch the file. Then, you upgrade that package to version 2. Portage will now
> put a ._cfg0000_config file into the system and remove the original, leaving
> the new version as orphaned update there effectively.

I suppose the merge phase can be made a little smarter so that it detects such a situation in advance and automatically overwrites the untouched config file.  Before the merge phase merges a config protected file, it will have check the for a collision with the currently installed package in the same slot and then see if the colliding file is eligible to be unmerged.  If so, it can immediately overwrite the file.
Comment 37 Zac Medico gentoo-dev 2006-11-26 00:04:17 UTC
Created attachment 102733 [details, diff]
allow the merge phase to overwrite untouched config files

This patch should do the job.  Because of bug #16162, we'll also have to modify etc-update and dispatch-conf so that they don't touch the mtime when they merge a config file.
Comment 38 Zac Medico gentoo-dev 2006-11-26 00:14:02 UTC
(In reply to comment #37)
> Because of bug #16162, we'll also have to modify
> etc-update and dispatch-conf so that they don't touch the mtime when they merge
> a config file.

Well, we don't really have to modify etc-update and dispatch-conf.  As long as the user never modifies the config files of a package, config protection should never be triggered.  So, my patch alone should solve the problem.
Comment 39 Zac Medico gentoo-dev 2006-11-26 01:06:44 UTC
This is fixed in svn r5129.
Comment 40 Ciaran McCreesh 2006-11-26 03:01:48 UTC
(In reply to comment #37)
> Created an attachment (id=102733) [edit]
> allow the merge phase to overwrite untouched config files

That's not a very good idea if configuration file changes introduce behaviour changes.

Simple example:

Old version of foo defaults to looking in /var/foo for its data. The user is happy with this.

New version of foo comes along, and defaults to looking in /srv/foo for its data. The user does not want this.

The user upgrades. The user has their foo files in /var/foo. The user restarts foo. Suddenly their foo no longer has any data.
Comment 41 Zac Medico gentoo-dev 2006-11-26 03:26:18 UTC
(In reply to comment #40)
> New version of foo comes along, and defaults to looking in /srv/foo for its
> data. The user does not want this.

That seems like a reasonably likely scenario.  I'll fix it so that config protection is triggered in that case.
Comment 42 Zac Medico gentoo-dev 2006-11-26 05:00:05 UTC
Created attachment 102749 [details, diff]
when necessary,  bump the mtime to prevent uninstallation of config protected files

This updated version of the previous patch will never overwrite an untouched config file.  In cases where an installed package in the same slot owns a protected file that will be merged, the mtime is bumped on the installed file in order to ensure that it isn't unmerged.
Comment 43 Zac Medico gentoo-dev 2006-11-26 06:41:06 UTC
In svn r5134:5136 etc-update and dispatch-conf are fixed so that they don't unnecessarily modify mtime when the user replaces an old config file with an update that the user hasn't modified.
Comment 44 Charles C. Van Tilburg 2006-11-28 06:54:38 UTC
I'd just like to reference my attempted report of a package update bug (udev) 
that is being summarily dismissed by a hostile bug-wrangler, without even a 
single moment of thought:

http://bugs.gentoo.org/show_bug.cgi?id=156505

If a package update fails to remove former package files that are no longer
needed, I'd call that a bug.  

Further, if the package update results in an inability of the package
to run, requiring manual intervention, I'd also call that a bug in the 
update process.

And yes, I did run etc-update.

Peace.
Comment 45 Zac Medico gentoo-dev 2006-11-28 14:29:59 UTC
This has been released in 2.1.2_rc2-r3.
Comment 46 Jakub Moc (RETIRED) gentoo-dev 2006-12-23 10:59:51 UTC
*** Bug 158934 has been marked as a duplicate of this bug. ***
Comment 47 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 12:06:52 UTC
*** Bug 20223 has been marked as a duplicate of this bug. ***
Comment 48 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 13:00:01 UTC
*** Bug 42027 has been marked as a duplicate of this bug. ***
Comment 49 Jakub Moc (RETIRED) gentoo-dev 2007-02-01 06:35:46 UTC
*** Bug 164765 has been marked as a duplicate of this bug. ***
Comment 50 Jakub Moc (RETIRED) gentoo-dev 2007-02-04 12:23:50 UTC
*** Bug 165258 has been marked as a duplicate of this bug. ***
Comment 51 SpanKY gentoo-dev 2007-02-09 22:08:13 UTC
*** Bug 166083 has been marked as a duplicate of this bug. ***
Comment 52 Eugene Shatsky 2012-01-23 23:24:38 UTC
Why is this "FIXED" since 2006 when the problem persists in the current stable portage?
As I understand, it has been fixed only a month ago with FEATURES=config-protect-if-modified commit (http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=770bb7ae), portage 2.1.10.44 has it (~amd64 yet)
Comment 53 Zac Medico gentoo-dev 2012-01-23 23:45:23 UTC
(In reply to comment #52)
> Why is this "FIXED" since 2006 when the problem persists in the current stable
> portage?
> As I understand, it has been fixed only a month ago with
> FEATURES=config-protect-if-modified commit
> (http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=770bb7ae),
> portage 2.1.10.44 has it (~amd64 yet)

As I understand it, this bug report was about a different but somewhat related issue. See these commits:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1e97aecdc2b27ff3a78ee4061eaa712b6d667980
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bb5bb2180186cd5cf138f4d17bb315e228d0a563