mksh R50d: parser fixes break common “set -u” workaround, take two

Bug #1381965 reported by Thorsten Glaser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mksh
Fix Released
High
Thorsten Glaser

Bug Description

tglase@tglase:~ $ cat x
list_parts() {
        local regex=${2:-}
        local args=x
        if [ -n "$regex" ]; then
            args="${args} -regex '$regex'"
        fi
        printf '<%s>\n' $args
}
list_parts foo
tglase@tglase:~ $ bash x
<x>
tglase@tglase:~ $ env -i PATH=$PATH mksh x
typeset -i -U BASHPID
typeset -i COLUMNS
typeset EPOCHREALTIME
typeset -x HOME
typeset IFS
typeset -i -U KSHEGID
typeset -i -U KSHGID
typeset -i -U KSHUID
typeset -r KSH_VERSION
typeset -i LINES
typeset -i OPTIND
typeset -x PATH
typeset -i -U PGRP
set -A PIPESTATUS
typeset -i -r -U PIPESTATUS[0]
typeset -i -U PPID
typeset PS1
typeset PS2
typeset PS3
typeset PS4
typeset PWD
typeset -i -U RANDOM
typeset -i SECONDS
typeset -x SHELL
typeset -i TMOUT
typeset -i -U USER_ID
<x>

Breaks: php5 maintainer scripts

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Bad commit is:

commit 0cf0658a0d250604f896b98509718863a536f6d1
Author: tg <email address hidden>
Date: Tue Oct 7 15:22:17 2014 +0000

    fix severe regression in field splitting (LP#1378208)

*sigh*

Revision history for this message
Thorsten Glaser (mirabilos) wrote :
  • x Edit (541 bytes, text/plain)

appears to be fixed by this patch. Everyone, *please test*!

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Testcase for this patch is in the description of this bug (some people on IRC wondered.)

I’ve not yet committed it. I’ll need to work on this more. But slowly, the “mystery” unravels.

----

Two more things to consider:

• We have several “word = quote || (!*x.str && (f & DOASNFIELD)) ? IFS_WORD : IFS_WS;” in the tree.
  Maybe changing them all to “[…] : IFS_IWS;” as this patch does is sensible?

• Maybe (cf. LP#1381993) DOASNFIELD should be “non-list context” instead?

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Preliminary fix (as posted) committed and uploaded to Debian.
Better fix committed, needs more testing.

Changed in mksh:
assignee: nobody → Thorsten Glaser (mirabilos)
status: Confirmed → In Progress
Changed in mksh:
status: In Progress → Fix Committed
Revision history for this message
Thorsten Glaser (mirabilos) wrote :

mksh R50e is out

Changed in mksh:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

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