CC: Tweaked

CC: Tweaked

42M Downloads

Turtle code deleted after line 255

ejm554 opened this issue ยท 4 comments

commented

Minecraft Version

1.18.x

Version

1.100.10

Details

Overview

I have a non-Advanced turtle with a program containing 450+ lines of code. Today, I received the following error message:

image

When I scrolled down to that line, everything below it was gone. Basically, the text had been truncated, right in the middle of a function definition.

Just prior to this error, I had added a half dozen lines of comments at the top of the code, starting at around line 6.

Is this normal behavior? Do turtles have a line limit? Are regular turtles different in this regard compared to Advanced Turtles?

Log

A log can be viewed here: https://gist.github.com/ejm554/838bd51b71e0544ce97539cdc82567c5

Sample program

A copy of the program that I used (prior to adding the pre-error comments) can be found here: https://github.com/ejm554/computercraft-library/blob/a337a35d2b1feeedca358b1021bb6ae34c4ce81d/mines/mineZone.lua

Sample comments

These comments were added just prior to the error.
image

To Reproduce

I'm not positive that the following steps will result in the same error.

  1. Create a non-advanced turtle.
  2. Load the sample program linked above. (Alternatively, add a program with code in excess of 450 lines that would break if all lines after line 255 were deleted.)
  3. Run the program and confirm there are no errors.
  4. Edit the program, insert comments in lines 6-12.
  5. Run the program again.
commented

I've some code which rotates the logs every 64KiB](https://github.com/SquidDev-CC/artist/blob/vnext/src/artist/lib/log.lua), which may be useful.

Cool, thanks!

commented

I'm afraid I'm not able to reproduce this: I've downloaded the file you've linked, and every edit I make behaves as expected.

I'm really not sure why this has happened in your case. I think my best guess would be that your computer ran out of space (maybe due to logFile being very large), but that feels unlikely. Would you be able to run fs.getFreeSpace("/") and tell me the result?

commented

Ope! That's probably the cause! I happened to be dealing with an excessively large logFile and no free space at around the same time as this reported issue. I'll close this issue, and re-open it if I discover that the problem is a result of something else.

Do you happen to know of any documentation/forum posts that that talk about how to deal with large logs? I was thinking about writing some code that would delete old log data when there's no enough room to write new log data. But maybe there are other approaches that I could use.

Thanks again! <3

commented

Ahhh, lovely :). I've opened a bug for edit truncating files when running out of space. I've also been bitten by it a few times, so would be good to have some sort of solution for it.

As far as large logs go, I don't think there's any documented "best practice". I've some code which rotates the logs every 64KiB, which may be useful.