delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/25/11:37:37

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: ericblake AT comcast DOT net (Eric Blake)
To: cygwin AT cygwin DOT com
Subject: base-files patch
Date: Fri, 25 Mar 2005 16:37:26 +0000
Message-Id: <032520051637.20006.42443E460000F49E00004E2622058864420A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0
MIME-Version: 1.0
Note-from-DJ: This may be spam

--NextPart_Webmail_9m3u9jl4l_20006_1111768646_0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Considering the recent thread on rxvt and PS1, I propose the following patches to /etc/default/etc/profile.  In addition to fixing the default PS1 for bash to correctly delineate non-printing characters, it fixes the following additional bugs:  When using case, you do not need to quote a command substitution; this is particularly important since "`""`" is non-portable, just use case `""` instead.  Sorting is not necessarily strictly alphanumeric in other locales (not that cygwin has good locale support, but still...).  Also, `info coreutils dircolors' recently changed to recommend eval "`dircolors ...`", due to the security hole mentioned in http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00058.html.

--
Eric Blake

--NextPart_Webmail_9m3u9jl4l_20006_1111768646_0
Content-Type: application/octet-stream; name="base-files.diff"
Content-Transfer-Encoding: 7bit

--- profile.orig	2005-03-25 08:50:00.003125000 -0700
+++ profile	2005-03-25 09:14:23.268750000 -0700
@@ -71,7 +71,7 @@
 			. "${f}"
 		fi
 	done <<- EOF
-	`/bin/find /etc/profile.d -iname '*.sh' -type f | sort`
+	`/bin/find /etc/profile.d -iname '*.sh' -type f | LC_ALL=C sort`
 	EOF
 fi
 
@@ -88,17 +88,16 @@
 # export CVSROOT
 
 # Shell dependent settings
-case "`echo "$0" | /usr/bin/tr [:upper:] [:lower:]`" in
+case `echo "$0" | /usr/bin/tr [:upper:] [:lower:]` in
 bash     | -bash     | */bash | \
 bash.exe | -bash.exe | */bash.exe )
 	# Set a HOSTNAME variable
-	HOSTNAME=`hostname`
-	export HOSTNAME
+	export HOSTNAME=`hostname`
 
 	# Set a default prompt of: user AT host and current_directory
-	PS1='\[\033]0;\w\007
-\033[32m\]\u@\h \[\033[33m\w\033[0m\]
-$ '
+	PS1='\[\e]0;\w\a\]\n\
+\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\
+\$ '
 
 	if tty --quiet ; then
 		stty erase '^?'
@@ -119,7 +118,7 @@
 sh     | -sh     | */sh | \
 sh.exe | -sh.exe | */sh.exe )
 	# Set a simple prompt
-	PS1='$ '	
+	PS1='$ '
 	;;
 * )
 	# Sorry, this shell has no defaults in /etc/profile,
@@ -130,7 +129,7 @@
 	#  shell details and what you would like added.
 
 	# Thanks
-	
+
 	PS1='$ '
 	;;
 esac
@@ -138,7 +137,7 @@
 export PS1
 
 # Uncomment to use the terminal colours set in DIR_COLOR
-# eval `dircolors -b /etc/DIR_COLORS`
+# eval "`dircolors -b /etc/DIR_COLORS`"
 
 # Default to removing the write permission for group and other
 #  (files normally created with mode 777 become 755; files created with
@@ -147,7 +146,7 @@
 
 # Define default printer
 PRINTER=""
-case "`uname -s`" in
+case `uname -s` in
 CYGWIN_NT-*)
 	PRINTER="`regtool -q get '\user\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device' | sed 's/,.*$//'`"
 	;;
@@ -168,23 +167,23 @@
 #   about this on the lists!
 # If this message keeps appearing and you are sure it's a mistake (ie, don't
 #   email about it!), comment out the test below.
-case "`id -ng`" in
+case `id -ng` in
 mkpasswd )
   echo "Your group is currently \"mkpasswd\".  This indicates that"
   echo "the /etc/passwd (and possibly /etc/group) files should be rebuilt."
   echo "See the man pages for mkpasswd and mkgroup then, for example, run"
   echo "mkpasswd -l [-d] > /etc/passwd"
   echo "mkgroup  -l [-d] > /etc/group"
-  echo "Note that the -d switch is necessary for domain users."  
+  echo "Note that the -d switch is necessary for domain users."
   ;;
 
 mkgroup )
-  echo "Your group is currently \"mkgroup\".  This indicates that"  
+  echo "Your group is currently \"mkgroup\".  This indicates that"
   echo "the /etc/group (and possibly /etc/passwd) files should be rebuilt."
   echo "See the man pages for mkpasswd and mkgroup then, for example, run"
   echo "mkpasswd -l [-d] > /etc/passwd"
   echo "mkgroup  -l [-d] > /etc/group"
-  echo "Note that the -d switch is necessary for domain users."  
+  echo "Note that the -d switch is necessary for domain users."
   ;;
 
 mkgroup_l_d )


--NextPart_Webmail_9m3u9jl4l_20006_1111768646_0
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--NextPart_Webmail_9m3u9jl4l_20006_1111768646_0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019