Bug 325860

Summary: Crash when adding "forward" command before function call
Product: [Applications] kturtle Reporter: dm
Component: generalAssignee: Cies Breijs <cies>
Status: RESOLVED WORKSFORME    
Severity: crash    
Priority: NOR    
Version First Reported In: 0.8.1 beta   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description dm 2013-10-10 20:15:15 UTC
In attempting to create a short program to approximate a fibonacci spiral, I created the following function to draw a 90-degree arc with a given radius, and called it within a while loop. The following full program works fine:

$max = 300
$a = 0
$b = 1
$t = 0

learn arc $rad {
  $d = round((pi * $rad) / 2)
  for $i = 1 to $d {
    forward 1
    turnleft 90 / $rad
  }
}

reset
while $b < $max {
  arc $b

  $t = $b
  $b = $a + $b
  $a = $t
}

However, in order to verify the spiral, I wanted to add the boxes you often see around them, by adding four "forward" commands:

$max = 300
$a = 0
$b = 1
$t = 0

learn arc $rad {
  $d = round((pi * $rad) / 2)
  for $i = 1 to $d {
    forward 1
    turnleft 90 / $rad
  }
}

reset
while $b < $max {
  forward $b
  turnleft 90
  forward $b
  turnleft 90
  forward $b
  turnleft 90
  forward $b
  turnleft 90

  arc $b

  $t = $b
  $b = $a + $b
  $a = $t
}

This crashes the program. Oddly enough, it even crashes when I then comment out the "arc" call. However, moving the contents of the function in-line works fine:

$max = 300
$a = 0
$b = 1
$t = 0

reset
while $b < $max {
  forward $b
  turnleft 90
  forward $b
  turnleft 90
  forward $b
  turnleft 90
  forward $b
  turnleft 90

  $d = round((pi * $b) / 2)
  for $i = 1 to $d {
    forward 1
    turnleft 90 / $b
  }

  $t = $b
  $b = $a + $b
  $a = $t
}

Reproducible: Always

Steps to Reproduce:
1.  Input the above code into the editor
2.  Hit "run"
3.  Observe as the program crashes
Actual Results:  
The program just dies, running it from a tty simply gives me:
ยป kturtle
kturtle(1332)/kdeui (kdelibs): Attempt to use QAction "" with KXMLGUIFactory! 
"/org/freedesktop/UDisks2/drives/WDC_WD7501AALS_00E3A0_WD_WCATR1687391" : property "Drive" does not exist 
"/org/freedesktop/UDisks2/drives/Optiarc_DVD_RW_AD_7260S_Optiarc_DVD_RW_AD_7260S" : property "Drive" does not exist 
"/org/freedesktop/UDisks2/drives/Floppy_Drive" : property "Drive" does not exist 
"/org/freedesktop/UDisks2/drives/USB_2_2e0_USB_Flash_Drive_AA00000000000108" : property "Drive" does not exist 
"/org/freedesktop/UDisks2/block_devices/fd0" : property "Name" does not exist 
"/org/freedesktop/UDisks2/drives/Floppy_Drive" : property "DeviceNumber" does not exist 
"/org/freedesktop/UDisks2/drives/Floppy_Drive" : property "Device" does not exist 
"/org/freedesktop/UDisks2/drives/USB_2_2e0_USB_Flash_Drive_AA00000000000108" : property "DeviceNumber" does not exist 
"/org/freedesktop/UDisks2/drives/USB_2_2e0_USB_Flash_Drive_AA00000000000108" : property "Device" does not exist 
"/org/freedesktop/UDisks2/drives/WDC_WD7501AALS_00E3A0_WD_WCATR1687391" : property "DeviceNumber" does not exist 
"/org/freedesktop/UDisks2/drives/WDC_WD7501AALS_00E3A0_WD_WCATR1687391" : property "Device" does not exist 
KCrash: Application 'kturtle' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/dj/.kde4/socket-medinvdj/kdeinit4__0


Expected Results:  
The program should have drawn the exact same thing as the final example above.

I'm going to play around with it and see if I can whittle stuff away to get to the bare minimum needed to reproduce. I haven't used this bug tracker before, hopefully I'll be able to comment with updates.

Thanks for your time
Comment 1 dm 2013-10-10 20:21:14 UTC
Ah whoops, typos in the code above. In the functions, "turnleft 90 / $rad" should be "90 / $d", and same for "turnleft 90 / $b" in the in-line version.
Comment 2 Andrew Crouthamel 2018-10-30 00:02:35 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2018-11-14 11:32:51 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2018-11-29 09:47:10 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!