Package: base-files
Version: 3.1.12
Severity: normal
Tags: patch

When a ksh shell is invoked, it reads /etc/profile. However there is no
setting of PS1 for ksh shells, only for bash:

    if [ "$PS1" ]; then
      if [ "$BASH" ]; then
        PS1='[EMAIL PROTECTED]:\w\$ '
      else
        if [ "`id -u`" -eq 0 ]; then
          PS1='# '
        else
          PS1='$ '
        fi
      fi
    fi

A better /etc/profile for Debian's ksh, pdksh and mksh compatible
setting is presented below.

The patch is against base-files 3.1.12 source (file: share/profile)

--- profile     2006-04-22 20:55:03+03  1.1
+++ profile     2006-04-22 21:01:15+03  1.2
@@ -1,7 +1,10 @@
 # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
 # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
 
-if [ "`id -u`" -eq 0 ]; then
+root=
+[ "`id -u`" -eq 0 ]  && root="root"
+
+if [ "$root" ]; then
   
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
 else
   PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
@@ -16,9 +19,20 @@
     else
       PS1='$ '
     fi
+
+    case "$0" in
+       *ksh)   # Set a HOST variable
+               typeset -l HOST
+
+               PS1='[EMAIL PROTECTED]:$PWD\$ '
+               [ "$root" ] && PS1='[EMAIL PROTECTED]:$PWD\# '
+              ;;
+    esac
+
   fi
 fi
 
+unset root
 export PATH
 
 umask 022


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.16-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US)

Versions of packages base-files depends on:
ii  base-passwd               3.5.11         Debian base system master password
ii  gawk [awk]                1:3.1.5.dfsg-4 GNU awk, a pattern scanning and pr
ii  mawk [awk]                1.3.3-11       a pattern scanning and text proces

base-files recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to