Inbuilt KORN Arithmetic & Test functions broken under Windows Subsystem for Linux

Bug #1818596 reported by Mark A. Lane
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ksh (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

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

Mark A. Lane (foocrypt)
information type: Private Security → Public Security
Revision history for this message
Balint Reczey (rbalint) wrote :

How do you run the script?

# cat test.ksh
#!/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
root@wsl-ksh-test:~# ./test.ksh
./test.ksh: line 10: syntax error at line 10: `(' unexpected

Changed in ksh (Ubuntu):
status: New → Incomplete
Revision history for this message
Mark A. Lane (foocrypt) wrote :
Download full text (3.5 KiB)

-> sdiff a b
#!/bin/ksh #!/bin/ksh

Y=1 Y=1
Z=1 Z=1
X=7680072911 X=7680072911
C=1 C=1
until [ ${C} -eq 50 ] until [ ${C} -eq 50 ]
do do
typeset -i -l Y=$(( ${Y} + ${Y} + ${X} )) typeset -i -l Y=$(( ${Y} + ${Y} + ${X} ))
typeset -i -l Z=$( echo "(${Z} + ${Z} + ${X})" | bc ) | typeset -i -l Z=$( echo “(${Z} + ${Z} + ${X})” | bc )
print "C=${C},Y=${Y},Z=${Z}, $( [ ${Y} -ne ${Z} ] && print Er print "C=${C},Y=${Y},Z=${Z}, $( [ ${Y} -ne ${Z} ] && print Er
C=$(( ${C} + 1 )) C=$(( ${C} + 1 ))
done done
-> ./a
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
-> ./b
./b: line 10: syntax error at line 10: `(' unexpected

This character you have on line 10 ' ” ' is not ASCII character 34 : ' " '

Those characters seem to have been modified by you're website.

What locale are you using that transla...

Read more...

Revision history for this message
Mark A. Lane (foocrypt) wrote :

#!/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

Revision history for this message
Mark A. Lane (foocrypt) wrote :

Test script.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for ksh (Ubuntu) because there has been no activity for 60 days.]

Changed in ksh (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Mark A. Lane (foocrypt) wrote :

Read above.

Is this being looked at ?

Changed in ksh (Ubuntu):
status: Expired → New
information type: Public Security → Public
Revision history for this message
Balint Reczey (rbalint) wrote :

I can reproduce the problem in WSL on Insider build 18917 but not in WSL2. This looks like specific to the WSL implementation, please file an issue at:
https://github.com/Microsoft/WSL/issues/

WSL2: https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-in-windows-insiders/

Revision history for this message
Balint Reczey (rbalint) wrote :

But thank you for filing the bug here, too!

Changed in ksh (Ubuntu):
status: New → Incomplete
status: Incomplete → Invalid
Revision history for this message
Mark A. Lane (foocrypt) wrote : Re: [Bug 1818596] Re: Inbuilt KORN Arithmetic & Test functions broken under Windows Subsystem for Linux
Download full text (7.0 KiB)

Thanks Balint

I’ll file one @ Microsoft.

Regards,

Mark A. Lane

> On 29 Jun 2019, at 03:47, Balint Reczey <email address hidden> wrote:
>
> I can reproduce the problem in WSL on Insider build 18917 but not in WSL2. This looks like specific to the WSL implementation, please file an issue at:
> https://github.com/Microsoft/WSL/issues/
>
> WSL2: https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-
> in-windows-insiders/
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1818596
>
> Title:
> Inbuilt KORN Arithmetic & Test functions broken under Windows
> Subsystem for Linux
>
> Status in ksh package in Ubuntu:
> Invalid
>
> Bug description:
> 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=-...

Read more...

Revision history for this message
Mark A. Lane (foocrypt) wrote :

Logged issue VIA https://github.com/Microsoft/WSL/issues/ as :

Inbuilt KORN Arithmetic & Test functions broken under Windows Subsystem for Linux #4244

Referencing : https://bugs.launchpad.net/ubuntu/+source/ksh/+bug/1818596

The bigger issue here is the power that M$ is waiving with the WSL ports of Linux. They are modifying the runtime results of critical components of Linux, which either by unintelligent design or mistake, leads to serious unexpected results, confusing the end users and pissing off the developers and wasting their time !

It would make for an interesting legal case against M$ by all the Linux Developers for breaching the copyrights of their code and hacking their code by modifying the runtime environments to produce irregular results.

tags: added: id-5d78a94dd35f904bcbcc8c0d
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.