Opened 10 years ago

Closed 10 years ago

#4788 closed defect (fixed)

IOError when running TurtleBlocks on multi-user non Sugar system

Reported by: Thomee Owned by: walter
Priority: High Milestone: Unspecified
Component: Turtleart Version: Unspecified
Severity: Major Keywords:
Cc: Distribution/OS: Ubuntu
Bug Status: Unconfirmed

Description

Using TurtleBlocks 207 on Ubuntu 14.04, installed from ppa:alanjas/turtleblocks

The first user to run TurtleBlocks has no problems. The second user to attempt to run TurtleBlocks cannot run their program. If started from the console, the final error is "IOError: error while writing to output stream". This is caused by the creation of a temporary SVG file at /tmp/turtle_output.svg, which is never cleaned up. The first user is able to create the file successfully, and any time they user TurtleBlocks it is overwritten just fine. But a second user trying to run a TurtleBlocks program is unable to overwrite the temporary file which is owned by the first user, and the program fails.

A somewhat ugly hack, which is included as a patch as proof of concept, is to use the current user's username as part of the temporary file name. This still leaves spare temporary files laying around, but at least each user has a unique temporary file, and so don't run into permissions issues. The method used in the patch is not the most robust, and I have no idea how it would behave on a non unix system. But all of the SVG export functionality seems to be very unix specific, so I'm not sure this is much of a loss. A better solution would probably be to generate a unique temporary file name, then make sure it is cleaned up when the program exits.

Attachments (2)

error.txt (367 bytes) - added by Thomee 10 years ago.
Full text of error
turtleart.patch (690 bytes) - added by Thomee 10 years ago.
Proof of concept fix

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by Thomee

Full text of error

Changed 10 years ago by Thomee

Proof of concept fix

comment:1 Changed 10 years ago by walter

  • Owner set to walter
  • Status changed from new to accepted

Oops. Thanks for pointing this out. I'll work on it for v209 coming soon.

comment:2 Changed 10 years ago by walter

  • Resolution set to fixed
  • Status changed from accepted to closed

Pushed https://github.com/walterbender/turtleart/commit/87c0e2a7ba0b93299008282ec11c55d34300959c

This makes a unique name in /tmp for each instance of Turtle Art (in case the same user runs multiple instances at once) and removes the temporary files on exit). Will be incorporated in v209. Please reopen if the problem persists.

Note: See TracTickets for help on using tickets.