ksh93 off by one

Bug #1392978 reported by Jens Elkner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ksh (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

If one defines a type with variables incl. help message, the corresponding man page for this type displays in DETAILS section displays wrong help messages for variables.

Example:

#!/bin/ksh93
typeset -T Log_t=(
    typeset -Sh 'Color for info messages' GREEN='38;5;232;48;5;118'
    typeset -Sh 'Color for warning messages' BLUE='38;5;21;48;5;118'
    typeset -Sh 'Color for fatal messages' RED='38;5;9;48;5;118'

    function log {
        print -u2 "\E[1;$2m${ date +%T; } $1:\E[0m $3"
    }
    function info {
        _.log "INFO" ${_.GREEN} "$*"
    }
    function warn {
        _.log "WARN" ${_.BLUE} "$*"
    }
    function fatal {
        _.log "FATAL" ${_.RED} "$*"
    }
)
Log_t -r log
log.info log test
Log_t --man
log.fatal DETAILS are wrong.
log.warn Look at GREEN

Jens Elkner (jelmd)
affects: ubuntu → ksh (Ubuntu)
Revision history for this message
Anuradha Weeraman (aweeraman) wrote :

Just tested on the latest ksh93u+m and the issue appears to be fixed:

    GREEN shared. Color for info messages.
    BLUE shared. Color for warning messages.
    RED shared. Color for fatal messages.

Can you please try with the latest (https://launchpad.net/ubuntu/+source/ksh93u+m) and report if you have any issues?

thanks.

Changed in ksh (Ubuntu):
status: New → Fix Released
Revision history for this message
Jens Elkner (jelmd) wrote :

Thanx Anuradha! Currently I'm still on vacation for the next 4 weeks, and have no jammy images to use yet. So I guess (if the weather stays as good as right now) I can try it in ~ 5 weeks. However, the output you've show above looks correct, so I guess, the problem is fixed, yepp.

Revision history for this message
Jens Elkner (jelmd) wrote :

Took, a while but now migration our first servers/ws to jammy. The issue above is fixed, but shipped ksh is severely broken, because it doesn't handle local variables properly. E.g.:

---schnipp---
#!/bin/ksh93

typeset -r SCRIPT=/tmp/bla

function doMain {
 typeset SCRIPT=/tmp/foo
 print "SCRIPT=${SCRIPT}"
}

doMain
print "WTF $?"
---schnapp---

SCRIPT is within doMain() a local scope var. Since this is obviously wrong and ksh stops processing at this point, it is a severe issue, breaks a lot of scripts (at least in my case).

Revision history for this message
Anuradha Weeraman (aweeraman) wrote : Re: [Bug 1392978] Re: ksh93 off by one

On Fri, Feb 16, 2024 at 06:57:09PM -0000, Jens Elkner wrote:
> ---schnipp---
> #!/bin/ksh93
>
> typeset -r SCRIPT=/tmp/bla
>
> function doMain {
> typeset SCRIPT=/tmp/foo
> print "SCRIPT=${SCRIPT}"
> }
>
> doMain
> print "WTF $?"
> ---schnapp---
>
> SCRIPT is within doMain() a local scope var. Since this is obviously
> wrong and ksh stops processing at this point, it is a severe issue,
> breaks a lot of scripts (at least in my case).

Could you try this with 1.0.1 or later, preferably 1.0.8. Hopefully it
should resolve your issues.

Anuradha

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.