Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 68612 - etc-update: force root priviledges
Summary: etc-update: force root priviledges
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 131754 (view as bug list)
Depends on: 93874
Blocks: 136244
  Show dependency tree
 
Reported: 2004-10-22 22:19 UTC by Scott 'me22' McMurray
Modified: 2006-07-20 14:03 UTC (History)
1 user (show)

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


Attachments
Adds a check for UID 0 (etc-update-UID-check.patch,357 bytes, patch)
2006-01-08 21:47 UTC, Alec Warner (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Scott 'me22' McMurray 2004-10-22 22:19:33 UTC
When I accidently ran etc-update as a non-root user, it told me that there was a new fstab version available.  I told it to delete the update, however it obviously did not have the nessesary permissions, so the delete failed, returning me to differences.  These differences cover the error message, since they are now paged by default.

It would be nice if etc-update as non-root was noticibly different from the root or at least a failure generated some kind of obvious visual alert/explanation.

Reproducible: Always
Steps to Reproduce:
1. Install new package with files in CONFIG_PROTECT
2. Run `etc-update` as an unprivileged user
3. Select update number
4. Push 'q' to exit pager showing differences
5. Choose 2 ( Delete update, keeping original as is )
6. Say 'y' to "remove write-protected regular file" prompt
Actual Results:  
I am again shown the differences between the files in the pager ( as though I
had just completed step (2) above or had selected '4' ( Show differences again )
at step (5) above.

It does show "rm: cannot remove `/etc/._cfg0000_fstab': Permission denied" (
output from the `rm -i` command, but I personally didn't notice it until I
started looking rather closely and it is frequently pushed offscreen by the
differences.

Expected Results:  
Refused to let my run etc-update initially, showing a message such as the
"emerge: root access required." that emerge shows when it's not at the correct
permission level for installing.

This happens with "1) Replace original with update" as well, as would be expected.

If you do not wish to prevent non-root users from running it, ( perhaps so that
as non-privileged it works as a --pretend, ) it would be nice to only show the
differences.  ( In other words not show the keep original, overwrite with new
copy, interactive merge menu at all ).  Another option would be to handle the
error more overtly, perhaps with a failure menu ( an option in this menu to
automatically run `sudo etc-update` if the sudo executable is available would be
nice for failures caused by too-low permissions ).

Portage 2.0.51-r2 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.4.20040808-r1,
2.6.8-gentoo-r10 i686)
=================================================================
System uname: 2.6.8-gentoo-r10 i686 AMD Athlon(tm) XP 2400+
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r5
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
Comment 1 SpanKY gentoo-dev 2004-10-25 16:03:46 UTC
or maybe have etc-update refuse to run if user isnt root ? ;)
Comment 2 Scott 'me22' McMurray 2004-10-25 19:50:00 UTC
SpanKY: That's what I posted under "Expected Results".  I then thought some more, and figured out what I'd like if people decided they didn't like it just failing, for some reason.

Just failing on insufficient permissions seems like a logical, good, and easy solution to me!
Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2005-07-28 07:25:35 UTC
Putting a hold on feature requests for portage as they are drowning out the 
bugs. Most of these features should be available in the next major version of 
portage. But for the time being, they are just drowning out the major bugs and 
delaying the next version's progress. 
 
Any bugs that contain patches and any bugs for etc-update or dispatch-conf can 
be reopened. Sorry, I'm just not good enough with bugzilla. ;) 
Comment 4 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-01-08 21:46:43 UTC
Adding a patch.
Comment 5 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-01-08 21:47:22 UTC
Created attachment 76588 [details, diff]
Adds a check for UID 0

This needs to be tested wrt sudo and etc-update.
Comment 6 Simon Stelling (RETIRED) gentoo-dev 2006-05-01 01:55:18 UTC
*** Bug 131754 has been marked as a duplicate of this bug. ***
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2006-07-19 02:56:38 UTC
In r3928
Comment 8 Zac Medico gentoo-dev 2006-07-20 14:03:52 UTC
This has been released in 2.1.1_pre3-r2.