[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

8864.0. "BIN_SH breaks setld and ??" by GIDDAY::SCHWARZ () Tue Feb 18 1997 00:33

    G'day all,
    
    This one has been flagged before but there was no resolution.
    
    If you set BIN_SH=xpg4 setld does not work. The only workaround is to
    unset BIN_SH.  This is a concern as my customer wants to use BIN_SH on
    an ASE system. I am concerned that this environment variable may break
    some of the ASE scripts ( maybe the application start and stop scripts
    )
    
    How is the best way to implement BIN_SH=xpg4 ?
    Should it be behaving in this way?
    Is ASE likely to be compromised ? ( root has it set in .profile  as
    does /etc/profile )
    
    Any suggestions would be appreciated
    
    regards
    
    Kym Schwarz
    Unix Support
    CSC Sydney
    
    
    *********************  Example ******************************
    # set
    DIA_LIBRARY=/var/DIA
    ERRNO=10
    FCEDIT=/usr/bin/ed
    HOME=/
    IFS=' 
    '
    LINENO=1
    LOGNAME=root
    MAILCHECK=600
    OPTARG
    OPTIND=0
    PATH=/sbin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/bin/X11:/usr/local
    PPID=15545
    PS1='# '
    PS2='> '
    PS3='#? '
    PS4='+ '
    PWD=/
    RANDOM=12170
    SECONDS=3
    SHELL=/bin/ksh
    TERM=xterm
    TMOUT=0
    USER=root
    _=id
    
    
    # setld -i 
    
    Subset          Status          Description
    ....
    ...
    ..
    .   
    SNIP.
    
    
    # export BIN_SH=xpg4
    # setld -i 
    # 
    # ksh -x setld -i 
    + setld -i
    # 
    
    # unset BIN_SH
    # setld -i
    
    Subset          Status          Description
    ------          ------          -----------
    SNIP
    
    
    ********************* End ***********************
    
T.RTitleUserPersonal
Name
DateLines
8864.1re setld & BIN_SHNETRIX::"[email protected]"markTue Feb 18 1997 06:0733
This is a cut down of the script to show what breaks. It all happens in
/usr/share/lib/shell/Strings:Parse() which creates a subshell setting IFS to
$1
and then echoing the result. I'd have done this with sed. However it breaks
in the ksh on 3.2 and works in 4.0B. What happens with the the parameter 1
ie setld -i  $1=-i  becomes " i" instead of the correct "i" so it works like
setld was not gived any parameters.
	More to follow. Investigation continues.

----------------------------------------------------------------------
#!/sbin/sh
#

Parse()
{ (
        IFS=$1
        shift
        echo $*
) }

Main()
{

echo "1=$1 2=$2 3=$3 "
CMDSW="$1"
CMDSW=`Parse - $CMDSW`

echo "CMDSW=$CMDSW"
}

Main "$@"

[Posted by WWW Notes gateway]
8864.2Re BIN_SHNETRIX::"[email protected]"markTue Feb 18 1997 06:2935
Well I probably would not have used sed maybe getopt would have been cleaner.
In
any case who fixed what in ksh between 3.2 and 4.0B ? The shell has a bug.

Re them using BIN_SH - From what I can gather setting BIN_SH to xpg4 
just forces ksh to be run instead of the Bourne shell.

	
The reasoning that this customer is using BIN_SH I think is also broken.

They seem to have claimed all sorts of things one of which was
that Digital UNIX has a kernel bug because it wont use the #! magic to 
run the requested interpreter. This is wrong! the exec routines in
Digital UNIX runs #! shells, any amount of testing will show this.
They based this rather incorrect statement on the result of shell space
script^M
eg. /sbin/sh tst.ksh  which does not involve an exec of the script tst.ksh
but rather sh is execed and parsed tst.ksh as an input. If this works on AIX
then it is because the AIX sh checks for magic and changes the shell or else
it does the same thing and they have an xpg4 (probably ksh) shell. I think the
latter is true.
	If they want to run kornshell scripts this way then they should
type ksh tst.sh which will work or else just set execute permissions on the
script and type the name eg. ./tst.ksh which will result in the exec
of tst.ksh which will run the #!/bin/ksh at the top.�Set the root shell
to /bin/ksh and let scripts run the shell they have requested using  #! magic.
	BIN_SH=xpg4   look like alias sh=ksh which means there
is nolonger a runnable bourne shell and any script that requests  sh will get
ksh.
	Death to BIN_SH !!! Get rid of it! 


	Mark :)

[Posted by WWW Notes gateway]