Project

General

Profile

Actions

Bug #880

closed

ksh93 coredumps on 'unset'

Added by Yuri Pankov about 12 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2011-04-04
Due date:
% Done:

100%

Estimated time:
Difficulty:
Tags:
Gerrit CR:
External Bug:

Description

The simple test case is:

#!/bin/sh

function do_bar {
        typeset IFS

        while getopts 'foo:bar' cmd_arg; do
                ;
        done >&2

        unset IFS
}

case "$0" in
*)      do_bar "$@" ;;
esac

Works (I mean "breaks") only with /usr/bin/i86/ksh.

Originally got it trying to run 'man' shell script from FreeBSD (changing func() -> function func and local -> typeset), running it using /usr/bin/ksh or /usr/bin/amd64/ksh93 makes ksh coredump somewhere else. Even if I'm using it incorrectly, still it shouldn't make the shell dump the core. http://svn.freebsd.org/viewvc/base/head/usr.bin/man/man.sh?revision=220261&view=markup is the script in question.


Related issues

Related to illumos gate - Feature #13405: ksh93 update to 2012-08-01ClosedAndy Fiddaman

Actions
Actions #1

Updated by Roland Mainz about 12 years ago

The problem here is that IFS is a function-local variable. Some older ksh93 versions choke on this (and local typeset -L/-U (uppercase/lowercase variables)) depending on how the heap is laid-out. The upcoming ksh93-integration update all fixes this.

Actions #2

Updated by Andy Fiddaman over 2 years ago

Actions #3

Updated by Electric Monk over 2 years ago

  • Gerrit CR set to 1175
Actions #4

Updated by Electric Monk over 2 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f

commit  b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2021-01-30T17:13:33.000Z

    13405 ksh93 update to 2012-08-01
    13434 sh: mishandles backslash as last character of a block of input
    11750 ksh mkdir builtin doesn't honor special file permissions
    9199 ksh93 builtin *grep -v mishandles blank lines, blows up libgcrypt-config
    6756 sh (and ksh) have issues with ${1+"$@"}
    6520 ksh: sleep could wait forever
    4860 ksh93: core in printf
    3791 /bin/sh's builtin 'rm' busted: 'rm -f' without arguments returns error
    1047 ksh overwrites child core files
    880 ksh93 coredumps on 'unset'
    499 "interrupted system call" when using "tee" builtin in ksh
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Reviewed by: Dominik Hassler <hadfl@omnios.org>
    Approved by: Rich Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF