Hello
I seem to have come across an abnormality, with the Ubuntu ( DEBIAN ) KORN Shell package [
Version AJM 93u+ 2012-08-01 ] when it is running under the Windows Subsystem for Linux.
Basic inbuilt arithmetic and test functions appear to be broken for long lengths under WSL
<-- Beging Test Script -->
#!/bin/ksh
Y=1
Z=1
X=7680072911
C=1
until [ ${C} -eq 50 ]
do
typeset -i -l Y=$(( ${Y} + ${Y} + ${X} ))
typeset -i -l Z=$( echo “(${Z} + ${Z} + ${X})” | bc )
print “C=${C},Y=${Y},Z=${Z}, $( [ ${Y} -ne ${Z} ] && print Error || print Ok )”
C=$(( ${C} + 1 ))
done
<-- End Test Script -->
The test script returns significantly different results on standard KORN Version AJM 93u+ 2012-08-01 running under Ubuntu, Darwin, etc as opposed to running under the WSL.
<-- Ubuntu, Darwin, -->
C=1,Y=7680072913,Z=7680072913, Ok
C=2,Y=23040218737,Z=23040218737, Ok
C=3,Y=53760510385,Z=53760510385, Ok
C=4,Y=115201093681,Z=115201093681, Ok
C=5,Y=238082260273,Z=238082260273, Ok
C=6,Y=483844593457,Z=483844593457, Ok
C=7,Y=975369259825,Z=975369259825, Ok
C=8,Y=1958418592561,Z=1958418592561, Ok
C=9,Y=3924517258033,Z=3924517258033, Ok
C=10,Y=7856714588977,Z=7856714588977, Ok
C=11,Y=15721109250865,Z=15721109250865, Ok
C=12,Y=31449898574641,Z=31449898574641, Ok
C=13,Y=62907477222193,Z=62907477222193, Ok
C=14,Y=125822634517297,Z=125822634517297, Ok
C=15,Y=251652949107505,Z=251652949107505, Ok
C=16,Y=503313578287921,Z=503313578287921, Ok
C=17,Y=1006634836648753,Z=1006634836648753, Ok
C=18,Y=2013277353370417,Z=2013277353370417, Ok
C=19,Y=4026562386813745,Z=4026562386813745, Ok
C=20,Y=8053132453700401,Z=8053132453700401, Ok
C=21,Y=16106272587473713,Z=16106272587473713, Ok
C=22,Y=32212552855020337,Z=32212552855020337, Ok
C=23,Y=64425113390113585,Z=64425113390113585, Ok
C=24,Y=128850234460300081,Z=128850234460300081, Ok
C=25,Y=257700476600673073,Z=257700476600673073, Ok
C=26,Y=515400960881419057,Z=515400960881419057, Ok
C=27,Y=1030801929442911025,Z=1030801929442911025, Ok
C=28,Y=2061603866565894961,Z=2061603866565894961, Ok
C=29,Y=4123207740811862833,Z=4123207740811862833, Ok
C=30,Y=8246415489303798577,Z=8246415489303798577, Ok
C=31,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=32,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=33,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=34,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=35,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=36,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=37,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=38,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=39,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=40,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=41,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=42,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=43,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=44,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=45,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=46,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=47,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=48,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=49,Y=-9223372036854775808,Z=-9223372036854775808, Ok
<<-- WSL with the Ubuntu 16.04 & 18.04 LTS & Debian GNU/Linux Packages -->
C=1,Y=7680072913,Z=7680072913, Ok
C=2,Y=23040218737,Z=23040218737, Ok
C=3,Y=53760510385,Z=53760510385, Ok
C=4,Y=115201093681,Z=115201093681, Ok
C=5,Y=238082260273,Z=238082260273, Ok
C=6,Y=483844593457,Z=483844593457, Ok
C=7,Y=975369259825,Z=975369259825, Ok
C=8,Y=1958418592561,Z=1958418592561, Ok
C=9,Y=3924517258033,Z=3924517258033, Ok
C=10,Y=7856714588977,Z=7856714588977, Ok
C=11,Y=15721109250865,Z=15721109250865, Ok
C=12,Y=31449898574641,Z=31449898574641, Ok
C=13,Y=62907477222193,Z=62907477222193, Ok
C=14,Y=125822634517297,Z=125822634517297, Ok
C=15,Y=251652949107505,Z=251652949107505, Ok
C=16,Y=503313578287921,Z=503313578287921, Ok
C=17,Y=1006634836648753,Z=1006634836648753, Ok
C=18,Y=2013277353370417,Z=2013277353370417, Ok
C=19,Y=4026562386813745,Z=4026562386813745, Ok
C=20,Y=8053132453700401,Z=8053132453700401, Ok
C=21,Y=16106272587473712,Z=16106272587473713, Ok
C=22,Y=32212552855020336,Z=32212552855020337, Ok
C=23,Y=64425113390113584,Z=64425113390113585, Ok
C=24,Y=128850234460300080,Z=128850234460300081, Ok
C=25,Y=257700476600673056,Z=257700476600673073, Error
C=26,Y=515400960881419008,Z=515400960881419057, Error
C=27,Y=1030801929442910976,Z=1030801929442911025, Ok
C=28,Y=2061603866565894912,Z=2061603866565894961, Ok
C=29,Y=4123207740811862528,Z=4123207740811862833, Error
C=30,Y=8246415489303797760,Z=8246415489303798577, Error
C=31,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=32,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=33,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=34,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=35,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=36,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=37,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=38,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=39,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=40,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=41,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=42,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=43,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=44,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=45,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=46,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=47,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=48,Y=-9223372036854775808,Z=-9223372036854775808, Ok
C=49,Y=-9223372036854775808,Z=-9223372036854775808, Ok
Has anyone else come across abnormalities effecting the standard functionality of the KORN shell running under WSL ???
Is this a DEBIAN / Ubuntu bug or a windows WSL bug ?
–
Mark