Discussion:
[ast-developers] Copying or moving .sh.match via typeset -m or typeset -c doesn't work
Irek Szczesniak
2013-05-28 15:10:03 UTC
Permalink
ast-ksh 20130524 prints nothing if we attempt to either move or copy
the contents of .sh.match.

Examples:
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -m
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
print -v matchxar ; } ; f1; :

ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -c
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
print -v matchxar ; } ; f1; :

Irek
David Korn
2013-05-28 17:24:20 UTC
Permalink
Subject: Re: [ast-developers] Copying or moving .sh.match via typeset -m or typeset -c doesn't work
--------
Post by Irek Szczesniak
ast-ksh 20130524 prints nothing if we attempt to either move or copy
the contents of .sh.match.
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -m
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -c
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
Irek
This is a bug and not an easy one since .sh.match is treated specially
for performance reasons.

David Korn
dgk at research.att.com
Irek Szczesniak
2013-05-28 17:25:48 UTC
Permalink
Post by David Korn
Subject: Re: [ast-developers] Copying or moving .sh.match via typeset -m or typeset -c doesn't work
--------
Post by Irek Szczesniak
ast-ksh 20130524 prints nothing if we attempt to either move or copy
the contents of .sh.match.
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -m
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -c
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
Irek
This is a bug and not an easy one since .sh.match is treated specially
for performance reasons.
Can you reuse the code used by read -C to print the array as text and
read it back in as array?

Irek
David Korn
2013-05-28 18:17:42 UTC
Permalink
cc: ast-developers at lists.research.att.com
Subject: Re: Re: [ast-developers] Copying or moving .sh.match via typeset -m or typeset -c doesn't work
--------
Post by Irek Szczesniak
ast-ksh 20130524 prints nothing if we attempt to either move or copy
the contents of .sh.match.
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -m
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
ksh -c 'function f2 { nameref mar=$1 ; typeset dummy x="-1a2b3c4d9u" ;
dummy="${x//~(E)([[:digit:]])|([[:alpha:]])/D}" ; typeset -c
"mar=.sh.match" ; } ; function f1 { typeset -a matchar ; f2 matchar ;
Irek
Actually, I found the bug and combined with fixing the typo in
you example, it fixed both of these.

David Korn
dgk at research.att.com

Loading...