Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 503068

Summary: app-shells/bash - sane bash defaults
Product: Gentoo Linux Reporter: three sixes <666threesixes666>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: VERIFIED INVALID    
Severity: normal CC: 666threesixes666
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=504932
https://bugs.gentoo.org/show_bug.cgi?id=518342
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: bashrc.patch
bash_logout.patch

Description three sixes 2014-02-28 17:30:12 UTC
app-shells/bash-4.2_p45 is shipping with bad default configs.

Reproducible: Always
Comment 1 three sixes 2014-02-28 17:31:50 UTC
Created attachment 371442 [details, diff]
bashrc.patch

patch for /etc/bash/bashrc
Comment 2 three sixes 2014-02-28 17:34:41 UTC
Created attachment 371444 [details, diff]
bash_logout.patch

patch for sane /etc/bash/bash_logout
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-28 18:16:59 UTC
Comment on attachment 371442 [details, diff]
bashrc.patch

>--- bashrc	2014-02-28 07:18:38.079771357 -0500
>+++ bashrc.sane	2014-02-28 07:23:27.579565292 -0500
>@@ -60,11 +60,17 @@
> 	fi
> 
> 	if [[ ${EUID} == 0 ]] ; then
>-		PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
>+		PS1='\[\e[01;31m\]\u@\h\[\e[01;31m\] [ \[\e[0m\]\w\[\e[1;31m\] ] \$\[\033[0m\] '
> 	else
>-		PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
>+		PS1='\[\e[01;32m\]\u@\h\[\e[01;32m\] [ \[\e[0m\]\w\[\e[1;32m\] ] \$\[\033[0m\] '

How is that more sane, other than that PS1 now looks like it does on random other distros?

> 	fi
> 
>+	alias sudo='sudo '

Oh, sudo is installed? And this saves you from typing an extra space when you were already going to type a tab? Or how would that work?

>+	alias rm='rm -i'
>+	alias cp='cp -i'
>+	alias mv='mv -i'

Wrong distro again?

>+	alias ping='ping -c 5'

And what if you then want to run ping without that limitation?

>+	alias emerge='emerge --ask-enter-invalid -av'

emerge is installed? And we all want this as default?

>@@ -72,9 +78,9 @@
> else
> 	if [[ ${EUID} == 0 ]] ; then
> 		# show root@ when we don't have colors
>-		PS1='\u@\h \W \$ '
>+		PS1='\u@\h [ \w ] \$ '
> 	else
>-		PS1='\u@\h \w \$ '
>+		PS1='\u@\h [ \w ] \$ '

The other distro again?

Really, none of these changes make bashrc more sane - most of them might be convenient for you, in which case you can change it locally just fine.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-28 18:17:35 UTC
Comment on attachment 371444 [details, diff]
bash_logout.patch

>--- bash_logout	2014-02-28 07:18:37.916750638 -0500
>+++ bash_logout.sane	2014-02-28 07:13:01.419983629 -0500
>@@ -3,7 +3,7 @@
> # This file is sourced when a login shell terminates.
> 
> # You may wish to clear everyone's screen when they logout.
>-#clear
>+clear

The distro default isn't satisfactory?
Comment 5 three sixes 2014-03-01 01:32:56 UTC
to ping with out limitation

$unalias ping
$ping whoever.com

sudo is for sudo tab completion, sudo will become more important in a bit in gentoo.

-i ask before doing potentially damaging file operations.

yes you want emerge to ask by default, and do nothing unless explicitly told y Y yes or YES....

clear?  mysql is known to leave plaintext passwords in consoles.  im sure there are others.

the ps1 W to w is not a mistake and is a legitimate bug in the current bashrc resulting in incomplete path output.

>-		PS1='\[\033[01;31m\]\h\
>+		PS1='\[\e[01;31m\]\u@\h\

results in "localhost" instead of "root@localhost"

they may be convenient to production server admins, vps defaults, new users etc....  ps1 mirrors LFS but thats just personal preference, the others should be addressed.

just because you don't notice that its broken does not mean its not.
Comment 6 SpanKY gentoo-dev 2014-03-09 07:21:17 UTC
i might add the \u option to the default PS1, but Jeroen is 100% right about the rest -- they have no business being anywhere near distro-wide defaults.
Comment 7 three sixes 2014-03-11 01:18:55 UTC
(In reply to SpanKY from comment #6)
> i might add the \u option to the default PS1, but Jeroen is 100% right about
> the rest -- they have no business being anywhere near distro-wide defaults.

W to w....  see funtoo duplicate bug.
http://bugs.funtoo.org/browse/FL-1120

this is 100% my PRIMARY problem with the distro wide bashrc.......
Comment 8 SpanKY gentoo-dev 2014-03-11 06:21:37 UTC
(In reply to three sixes from comment #7)

no idea what you're talking about.  your response (and that linked bug) contain no real details beyond what you've already provided here.

simply because your personal choice of default settings doesn't line up with everyone else in the world doesn't mean everyone else in the world is doing it wrong.