I was playing around with types and I think I may have found a bug. I'm not
sure if it's been fixed, perhaps in 93v. I searched the users & developers list
and I didn't see anything quite like it. It could be that I'm screwing
something up, but the output suggests that some variables are being over
written / confused / something. Also, my apologies for not making the code more
test-case friendly.
When running the following:
$ cat tt
#!/bin/ksh
typeset -T Apar_t=(
typeset -h "Name of the APAR." name
typeset -h "Description of the APAR." desc
typeset -h "The AIX Version To which this APAR applies." applies_to
typeset -h "Fileset in which this APAR is implemented." fileset
integer -h "Type of APAR: 0=parent 1=child" -i type=1
)
typeset -T Child_t=(
Apar_t apar
)
Child_t A=( apar=(
name="IV01111"
desc="CPU HOGS goes NUTS"
applies_to="7100-05"
fileset="bos.mp.7.1.2.27"
)
)
sleep 0.1
Child_t C=( apar=(
name="IV09557"
desc="strings are like poetry."
applies_to="7100-02"
type=0
)
)
print $A
print $C
if [[ ${C.apar.type} != ${A.apar.type} ]]
then
p="Parent is:"
c="\n\tChild is:"
[[ ${C.apar.type} == 0 ]] && print "${p} ${C.apar.name}${c}
${A.apar.name}" \
|| print "${p} ${A.apar.name}${c} ${C.apar.name}"
fi
I get the following output from the two versions I've got (93u & 93u+):
( Apar_t apar=( name=IV01111 desc='CPU HOGS goes NUTS' applies_to=7100-05
fileset=bos.mp.7.1.2.27 typeset -l -i type=1 ) )
( apar=( name=7100-02 desc='strings are like poetry.' applies_to=7100-02
fileset='' typeset -l -i type=0 ) )
Parent is: 7100-02
Child is: IV01111
Version JM 93u 2011-02-08
/Users/sonicbphuct/src/apar-list $ ./tt.new
( Apar_t apar=( name=IV09557 desc='strings are like poetry.' applies_to=7100-02
fileset=bos.mp.7.1.2.27 typeset -l -i type=1 ) )
( Apar_t apar=( name=IV09557 desc='strings are like poetry.' applies_to=7100-02
fileset=bos.mp.7.1.2.27 typeset -l -i type=0 ) )
Parent is: IV09557
Child is: IV09557
Version AJM 93u+ 2012-08-01
In 93u, one variable gets overwritten by another ($name <-$ applies_to)
in 93u, without the "sleep 0.1", $name is null. I'm not sure why putting a
command between the declarations causes it to change, but …
in 93u+, all the fields that are the 2nd time overwrite the fields from the
first time, except the one field with a default value.
I thought I might be accessing the types awkwardly (perhaps I am), but it seems
legal, in so far as I don't get anything on stderr.
on a side note, in 93u, i get a memory fault if I put the "print ${KSH_VERSION}
at the top, before my typeset -T declarations. But it seems fixed in 93u+.
-josh
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users