2427 posts
Location
UK
Posted 05 March 2018 - 11:17 PM
Any ideas as to the cause of this? It's a bit anoying having to delete things via Windows Explorer.
Editing and making files is fine but deleting gets line 12 (
fs.delete(sFile)) of the delete command blamed for not yielding.
Edit: just tried
fs.delete via the Lua shell and it worked, delete/rm command still broken.
I checked if one of my resource packs was overwriting delete but none are.
Solved:Issue is
fs.find taking too long when there is a lot of files but no wildcard.
Here's the patch i've made, just run the file on boot (you may want to stick it in a resource pack's rom/autorun folder)
local old_FS_Find = fs.find
function fs.find(wildcard)
if string.find(wildcard, "*") then
return old_FS_Find(wildcard)
else
if fs.exists(shell.resolve(wildcard)) then
return {shell.resolve(wildcard)}
else
return {}
end
end
end
Edited on 06 March 2018 - 11:05 AM
1220 posts
Location
Earth orbit
Posted 05 March 2018 - 11:32 PM
I just tested in a lightly modified CC 1.79/MC 1.8.9 environment on an advanced wireless portable via script, lua prompt, and rm/delete from the command line without issue. Not sure if/how that helps, but there you have it. Good luck, I hope you're able to track down the culprit quickly.
Edited on 05 March 2018 - 10:32 PM
7083 posts
Location
Tasmania (AU)
Posted 06 March 2018 - 03:10 AM
Is this 100% reproducible on that specific line, regardless of the file you try to remove? Presumably you've tried rebooting the system running the MC install?
I'd be inclined to copy the
delete script to the root of your system's drive and edit it to print additional info (eg the name of the file it thinks it's deleting).
355 posts
Location
Germany
Posted 06 March 2018 - 09:56 AM
If you are using the "delete" program, it's not yielding for deleting recursively. If you delete a folder with many files, it loops and loops and loops deleting all files and then runs into "Too long without yielding".
1426 posts
Location
Does anyone put something serious here?
Posted 06 March 2018 - 10:35 AM
If you are using the "delete" program, it's not yielding for deleting recursively. If you delete a folder with many files, it loops and loops and loops deleting all files and then runs into "Too long without yielding".
delete doesn't handle deleting child directories: that's handled by
fs.delete. I suspect the issue is in the call to
fs.find, which
until 1.80pr1 had some serious performance issues. It might be worth running
fs.find("test") in the Lua REPL, and seeing if it errors. If so, there's a couple of options:
- Update to a newer version of ComputerCraft.
- Install CCTweaks, as this fixes the performance issue.
- Overwrite delete in a resource pack to remove the call to fs.find.
- Overwrite fs.find in a resource pack/startup script to handle the case where the path doesn't include "*".
Edited on 06 March 2018 - 09:36 AM
2427 posts
Location
UK
Posted 06 March 2018 - 11:33 AM
I have
CCTweaks installed, although I've just realised it's not the latest that I
could be using. Mentioning performance, I have screen tearing on MC despite setting vsync on and capping framerates - this is not too bad of an issue as I just use this instance for CC Lua dev (thus such an old version of CC). Maybe I should update… (Any ideas how the userbase is split across CC versions?)
Back on topic:
All of my instances have been trying to delete a single file with the delete program being given the full file name in the current directory (file is in root)
I just tried copying delete out of rom,
copy:13: Too long without yielding <_</>
I'll have at with patching
fs.find via a resource pack.
Edit: here's the patch i've made, just run the file on boot (you may want to stick it in a resource pack's rom/autorun folder)
local old_FS_Find = fs.find
function fs.find(wildcard)
if string.find(wildcard, "*") then
return old_FS_Find(wildcard)
else
if fs.exists(shell.resolve(wildcard)) then
return {shell.resolve(wildcard)}
else
return {}
end
end
end
Edit 2: Just tried with the patch disabled and CCTweaks updated, it works.
Edited on 06 March 2018 - 11:54 AM
1426 posts
Location
Does anyone put something serious here?
Posted 06 March 2018 - 12:55 PM
I have
CCTweaks installed, although I've just realised it's not the latest that I
could be using.
Yeah, I don't think that change was added until 1.3.0, so you're one version too old :)/>.
(Any ideas how the userbase is split across CC versions?)
Most of the servers seem to be on 1.10+, which means they'll be running latest. I know my current stance is to test against CC:Tweaked, and if it runs against anything else that's a happy coincidence. Though that's probably not the best solution if you care about having lots of users :)/>.