Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Dec 2002 13:33:01 +0100 (CET)
From:      Jens Schweikhardt <schweikh@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/46441: /bin/sh does not do parameter expansion in PS1, PS2, PS4
Message-ID:  <200212211233.gBLCX1eX045120@hal9000.schweikhardt.net>

next in thread | raw e-mail | index | archive | help

>Number:         46441
>Category:       standards
>Synopsis:       /bin/sh does not do parameter expansion in PS1, PS2, PS4
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 21 04:40:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jens Schweikhardt
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Digital Details
>Environment:
System: FreeBSD hal9000.schweikhardt.net 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Fri Nov 29 11:10:37 CET 2002 toor@hal9000.schweikhardt.net:/usr/obj/src/current/sys/HAL9000 i386


>Description:

	If our /bin/sh is intended to support the SUSv3 User Portability
	(UP) option, it must do parameter expansion in PS[124]. If not,
    consider this PR null and void, even where prohibited. Quoting
	IEEE Std 1003.1-2001:

PS1

 Each time an interactive shell is ready to read a command, the value of
 this variable shall be subjected to parameter expansion and written to
 standard error. The default value shall be "$ " . For users who have
 specific additional implementation-defined privileges, the default may
 be another, implementation-defined value. The shell shall replace each
 instance of the character '!' in PS1 with the history file number of
 the next command to be typed. Escaping the '!' with another '!' (that
 is, "!!" ) shall place the literal character '!' in the prompt. This
 volume of IEEE Std 1003.1-2001 specifies the effects of the variable
 only for systems supporting the User Portability Utilities option.

PS2

 Each time the user enters a <newline> prior to completing a command
 line in an interactive shell, the value of this variable shall be
 subjected to parameter expansion and written to standard error. The
 default value is "> " . This volume of IEEE Std 1003.1-2001 specifies
 the effects of the variable only for systems supporting the User
 Portability Utilities option.

PS4

 When an execution trace ( set -x) is being performed in an interactive
 shell, before each line in the execution trace, the value of this
 variable shall be subjected to parameter expansion and written to
 standard error. The default value is "+ " . This volume of IEEE Std
 1003.1-2001 specifies the effects of the variable only for systems
 supporting the User Portability Utilities option.

PWD

 Set by the shell to be an absolute pathname of the current working
 directory, containing no components of type symbolic link, no
 components that are dot, and no components that are dot-dot when the
 shell is initialized. If an application sets or unsets the value of
 PWD, the behaviors of the cd and pwd utilities are unspecified.

>How-To-Repeat:
$ /bin/sh
$ PS1='$PWD >'
$PWD >cd /tmp                  <- should expand $PWD
$PWD >PS2='$PWD more:'
$PWD >foo ()
$PWD more:{
$PWD more:}
$PWD >PS4='$PWD -x : '
$PWD >set -x
$PWD >foo
+ foo                          <- PS4 seems hard coded to "+ "

>Fix:



>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212211233.gBLCX1eX045120>