ID:2396527
 
Resolved
Because reading the value of world.log returns file("") instead of a real filename, fdel(world.log) tried to delete the entire contents of the world's directory. I can see no legitimate reason to do this, and therefore fdel("") is ignored now.
BYOND Version:512.1447
Operating System:Linux
Web Browser:Chrome 65.0.3325.183
Applies to:Dream Daemon
Status: Resolved (512.1449)

This issue has been resolved.
Descriptive Problem Summary:
Using fdel() with "world.log" or "[world.log]" as an argument can obliterate an entire project. What's deleted seems to be fairly random, but it always deletes at least one folder in the same directory as world.log (eg. code, icons, skins, maps in my project), and usually the binaries in the same directory (and even python & bash files). On 512.1440 on Windows, it deletes the contents of every single code file without actually deleting the files, and the .dme is also unable to open affected files in this case. In 6 tests, my code folder was completely deleted 5/6 times, which is more often than any other folder was. That's probably because it's the first folder in the directory (see https://gyazo.com/c995dd86a9d97f05e97ba2528c0f05da)

Numbered Steps to Reproduce Problem:
Use fdel(world.log). Difficult to reproduce on other projects; but if it happens once, it will happen 100% of the time.

Expected Results:
fdel(world.log) deletes the file world.log points to.


Actual Results:
fdel(world.log) deletes the file world.log points to, and the rest of my project to boot.
before: https://gyazo.com/e2ef491758bb5fd49452c42299e7d422
after: https://gyazo.com/7bd587968c5fa1e3f24869844f9b4451

When does the problem NOT occur?
Never

Workarounds:
N/A
Version control with a remote is very important. Use it.
I do - this is the first project that I haven't used a Github or Gitlab repo for. Setting up a repo with a week-old backup was the first thing I did after this happened.

That being said, a lot of developers still don't use version control, or even make weekly backups like I did, and this bug could destroy years of progress for them.
Okay, the problem appears to be that world.log always reads as file(""), and fdel("") will delete the current directory. Clearly this is no good.

I'm hesitant to change the log read behavior without understanding why it does what it does, but I can see no valid reason for fdel("") inside a project so I can disable that.
Lummox JR resolved issue with message:
Because reading the value of world.log returns file("") instead of a real filename, fdel(world.log) tried to delete the entire contents of the world's directory. I can see no legitimate reason to do this, and therefore fdel("") is ignored now.