Project

General

Profile

Bug #880

ksh93 coredumps on 'unset'

Added by Yuri Pankov over 9 years ago. Updated over 9 years ago.

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

0%

Estimated time:
Difficulty:
Tags:
Gerrit CR:

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.

History

#1

Updated by Roland Mainz over 9 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.

Also available in: Atom PDF