6723 etc/skel needs cleanup

Review Request #170 — Created March 4, 2016 and submitted

tsoome
illumos-gate
2931, 6723
general
etc/skel cleanup

tsoome@test:~$ more .bashrc

Define default prompt to <username>@<hostname>:<path><"($|#) ">

and print '#' for user "root" and '$' for normal users.

typeset +x PS1="\u@\h:\w\$ "
tsoome@test:~$
tsoome@test:~$ sudo -s
root@test:/home/tsoome# cd
root@test:~# pwd
/root
root@test:~# bash --version
GNU bash, version 4.3.42(1)-release (i386-pc-solaris2.11)

  • 0
  • 0
  • 3
  • 0
  • 3
Description From Last Updated
andy_js
  1. Ship It!
  2. 
      
tsoome
tsoome
tsoome
jimklimov
  1. 
      
  2. usr/src/cmd/login/login.dfl (Diff revision 3)
     
     

    is it intentional that order of /sbin and /usr/sbin is inverted vs. PATH above?

    1. yes, because the /sbin commands are symlinked from /usr/sbin; other than that, there should not be difference - in past the /sbin had static binaries.. I actually dont have any strong opinions about this order, dont mind either way.

    2. IMHO symlinking of parts of (/usr)/sbin is bad there as it 'goes against tradition', and on a more practical side - despite unification of / and /usr in the past years, it is not hard to untie them so I can have my split-root setups with all of /usr on a separate dataset that's mounted later in boot - and content of /sbin alone facilitates that. I too do not have an opinion which should be first in PATH, just that it should be same to avoid surprises in case of conflicts. Likely /usr/sbin might provide better-tuned builds and /sbin might be more generic (so later in path).

  3. usr/src/cmd/nsadmin/etc-profile.sh (Diff revision 3)
     
     

    Do I miss something, or are double-semicolons ';;' no longer required in the end of case-clauses?

    1. sh/ksh case can end with ;; to end clause and ;& is marking the end of the clause but the execution will continue with next list. Same as break and missing break in C switch statement.

    2. Every day there's something new ;) to learn.
      Well, if all those other shells do not barf on this - LGTM ;)

    3. yep, bash/ksh/zsh (and as our sh/jsh are actually ksh) all implement this and testing did confirm it does work as described in manual.

  4. 
      
jimklimov
  1. see also https://www.illumos.org/issues/2931
    1. yes, I did already.. the currently /etc/ksh.kshrc deals does implement the path shortening for sh/ksh based shells; for bash there is another option, instead of \w we can use \W:
      tsoome@beastie:common$ typeset +x PS1="\u@\h:\w\$ "
      tsoome@beastie:/code/illumos-gate/usr/src/lib/libzfs/common$ typeset +x PS1="\u@\h:\W\$ "
      tsoome@beastie:common$

      now the \W will just leave the last component of the path and therefore will keep the prompt short. note both ksh/bash support ${PWD##*/} which will give same result as bash \W - but for bash I would rather use \W instead. So, do you think we should use \W to manage the lenght of the prompt for bash?

      about issues - should 6723 just be marked as duplicate of 2931? or link them as related and have this update marked to solve both?

  2. 
      
tsoome
tsoome
tsoome
lotheac
  1. 
      
  2. usr/src/cmd/nsadmin/dot-kshrc.sh (Diff revision 5)
     
     

    I don't think this file should be shipped at all if all it contains is aliases some people will like and others won't.

    1. I still think the sample file would be nice, but made sure the samples are commented out.

  3. usr/src/cmd/nsadmin/etc-profile.sh (Diff revision 5)
     
     

    While case statement fall-through works for bash and ksh93, it is not specified by POSIX and this is invalid syntax in eg. dash.

  4. 
      
tsoome
gwr
  1. The PS1 simplificaitons are nice, but Why are you introducing "typeset ..." into the variable assignments?

    1. well, the typeset -x is export so in that sense the result would be the same, in that sense there is no real reason, I just did like this form:)

    2. OK, but last I looked, the "typeset" command is not POSIX shell language (it's specific to ksh)
      while "export VAR=value" is standard. Those of us who might like ksh to be optional someday
      might appreciate trying to stick to POSIX shell language. Yes, I know, there's a lot of
      ksh-specific stuff around, so this may be a battle that's already lost ;)

  2. 
      
tsoome
gwr
  1. Ship It!
  2. 
      
jeffpc
  1. My only comment is: this change turns what used to be gnu-first $PATH to a gnu-last $PATH. Personally, this doesn't affect me given my local user env forces what I like anyway but it is a change in behavior. (IOW, this isn't just a cleanup change.)

  2. 
      
gwr
  1. 
      
  2. usr/src/cmd/nsadmin/dot-profile.sh (Diff revision 7)
     
     

    Is this comment still current?

    1. Yea, missed that one - as this .profile will not set anything, we have no knowledge what the values will be. So I did change the comment, does it look better this way?

    2. I guess so.

    3. Though I thought we were trying to get rid of the suggestions to put /usr/gnu/bin at the front...

    4. :D well, if the user is already on editing .profile, the decision is probably done anyhow;) so removing the sample wont really change it. And at the end of the day, removing examples is no replacement for improving the tools;)

  3. 
      
tsoome
tsoome
xenol
  1. Ship It!
  2. 
      
alp
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...