Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What are the dangers of aliasing emerge to doas emerge?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 49
Location: Everywhere

PostPosted: Fri Oct 30, 2020 3:30 pm    Post subject: What are the dangers of aliasing emerge to doas emerge? Reply with quote

So recently I've felt I've been using emerge way more often, and with more arguments, etc. That's most probably because I'm both starting to contribute to Gentoo and experimenting with different combos of editors, WMs, etc. Hence, I've felt the sudden urge to simple alias emerge='doas emerge'. I'm aware that in general that's sort of a bad habit - I mean, what if a program doesn't need it and then fails? Understandable. But I can't really run emerge without root access anyways - so what are the dangers of having it aliased to root access?
Back to top
View user's profile Send private message
figueroa
l33t
l33t


Joined: 14 Aug 2005
Posts: 887
Location: Lower right-hand corner USA

PostPosted: Sat Oct 31, 2020 2:53 am    Post subject: Reply with quote

It's lazy and will lead to bad habits. How much energy is it to type doas and a space? Are you a hunt-and-peck keyboarder? Consider that doas is masked so may have built-in vulnerabilities.

I put myself in the portage group so I can run non-installing emerge commands for information without being root.
_________________
Andy Figueroa
andy@andyfigueroa.net Working with Unix since 1983.
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1955

PostPosted: Sat Oct 31, 2020 3:00 am    Post subject: Reply with quote

figueroa wrote:
I put myself in the portage group so I can run non-installing emerge commands for information without being root.
That"s the way I like it
Aliasing a string that already exist as a command sounds weird.
Moreover here's a couple of aliases used by root when emerge command line completion isn't required (figueroa might call it lazyness :cry:):
Code:
alias mrg="emerge -1"
alias mrgc="emerge -c"
alias mrgC="emerge -C"
alias mrgcp="emerge -cp"
alias mrgn="emerge --noreplace"
alias mrge="emerge"
alias mrgk="FEATURES=\"$FEATURES keepwork\" emerge"
alias mrgkr="FEATURES=\"$FEATURES keepwork\" emerge --resume"
alias mrgp="emerge -p"
alias mrgpr="emerge -p --resume"
alias mrgprd="emerge -p --resume>~/portage-tree-dump"
alias mrgprx="emerge -p --resume --exclude"
alias mrgpUw="emerge -p -uDNUv world"
alias mrgpw="emerge -p -uDNv world"
alias mrgr="emerge --resume"
alias mrgrx="emerge --resume --exclude"
alias mrgUw="emerge -uDNUv world"
alias mrgw="emerge -uDNv world"
alias mrgUwx="emerge -uDNUv world --exclude"
alias mrgwx="emerge -uDNv world --exclude"
The 'pretend' ones can usefully be defined for any non-root user belonging to portage group.
Thks 4 ur attention, interest & support.
_________________
Poor testing hurts everyone... climate included :)
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6783

PostPosted: Sat Oct 31, 2020 4:41 am    Post subject: Reply with quote

figueroa wrote:
Consider that doas is masked so may have built-in vulnerabilities.

But it's not masked, it's not even unstable?
Code:
 ~ $ ACCEPT_KEYWORDS="-* amd64" emerge -p doas

These are the packages that would be merged, in order:

Calculating dependencies  .... done!
[ebuild  N     ] app-admin/doas-6.0  USE="-pam"
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1955

PostPosted: Sat Oct 31, 2020 5:20 am    Post subject: Reply with quote

Gentoo Wiki
Thks 4 ur attention, interest & support.
_________________
Poor testing hurts everyone... climate included :)
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5013
Location: Dallas area

PostPosted: Sat Oct 31, 2020 10:56 am    Post subject: Reply with quote

I don't usually like to redefine commands, but bash already does some of that, which sets a bad example.

I do have these set up, but they use a different name (convenience/laziness :) )
Code:
alias aworld='sudo emerge -avuD @world'
alias eworld='sudo emerge -vuD @world'
alias pworld='emerge -pvuD @world'


If I'm just emerging a single package, I don't find it unwieldy to type sudo in front *shrugs*

If I'm just seeing what a command does, I don't have a problem using ebuild as my user (until install/postinst/qmerge at least)
_________________
PRIME x570-pro, 3700x, RX 550 - 5.8 zen kernel
Acer E5-575 (laptop), i3-7100u - i965 - 5.5 zen kernel
---both---
gcc 9.3.0, profile 17.1 (no-pie & modified) amd64-no-multilib, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
figueroa
l33t
l33t


Joined: 14 Aug 2005
Posts: 887
Location: Lower right-hand corner USA

PostPosted: Sat Oct 31, 2020 3:39 pm    Post subject: Reply with quote

CaptainBlood wrote:

Moreover here's a couple of aliases used by root when emerge command line completion isn't required (figueroa might call it lazyness)
Code:

alias mrg="emerge -1"
alias mrgc="emerge -c"
alias mrgC="emerge -C"
alias mrgcp="emerge -cp"
alias mrgn="emerge --noreplace"
alias mrge="emerge"
alias mrgk="FEATURES=\"$FEATURES keepwork\" emerge"
alias mrgkr="FEATURES=\"$FEATURES keepwork\" emerge --resume"
alias mrgp="emerge -p"
alias mrgpr="emerge -p --resume"
alias mrgprd="emerge -p --resume>~/portage-tree-dump"
alias mrgprx="emerge -p --resume --exclude"
alias mrgpUw="emerge -p -uDNUv world"
alias mrgpw="emerge -p -uDNv world"
alias mrgr="emerge --resume"
alias mrgrx="emerge --resume --exclude"
alias mrgUw="emerge -uDNUv world"
alias mrgw="emerge -uDNv world"
alias mrgUwx="emerge -uDNUv world --exclude"
alias mrgwx="emerge -uDNv world --exclude"
The 'pretend' ones can usefully be defined for any non-root user belonging to portage group.

So many almost identical important command aliases -- I just call dysfunctional. But, you pay your money and you take your chances.
_________________
Andy Figueroa
andy@andyfigueroa.net Working with Unix since 1983.
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1955

PostPosted: Sat Oct 31, 2020 4:54 pm    Post subject: Reply with quote

Minimal keystrokes, while remaining mnemonic:
One alias + one package name, I don't see what dysfonctionnal about it...
Code:
emerge -1p=9 chars.
mrgp=4 chars.
Typing is bad.
Typing less is better... Imho.

Thks 4 ur attention, interest & support.
_________________
Poor testing hurts everyone... climate included :)
Back to top
View user's profile Send private message
figueroa
l33t
l33t


Joined: 14 Aug 2005
Posts: 887
Location: Lower right-hand corner USA

PostPosted: Sat Oct 31, 2020 6:20 pm    Post subject: Reply with quote

CaptainBlood wrote:
Minimal keystrokes, while remaining mnemonic:
One alias + one package name, I don't see what dysfonctionnal about it...
Code:
emerge -1p=9 chars.
mrgp=4 chars.
Typing is bad.
Typing less is better... Imho.

Bad example. Your mrgp = emerge -p so 8 characters total, including 1 space bar stroke. I can only imagine the calories you safe.

I would suggest one alias m = emerge, save 5 characters each time while creating less of a learning/memory disability. On the other hand, aliases are very personal, a way to tailor the interface to how you want to work.
_________________
Andy Figueroa
andy@andyfigueroa.net Working with Unix since 1983.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 4297
Location: Illinois, USA

PostPosted: Sat Oct 31, 2020 7:35 pm    Post subject: Reply with quote

Code:
~ $ cat /usr/local/bin/emerge
#! /bin/bash
if [ "${USER}" = "tony" ]
 then sudo /usr/bin/emerge  $@
 else /usr/bin/emerge $@
fi
I've always run emerge as root. How else? As portage? What is portage's password?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 16228

PostPosted: Sat Oct 31, 2020 7:47 pm    Post subject: Reply with quote

Running emerge as a user other than root will not be able to update packages, as most packages have at least some files owned by root. To me, the danger is not in the alias, but in having your daily user able to elevate without a password to root for this purpose.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum