This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MindenCucc's profile picture

NTFS Filesystem breaking bug

Started by MindenCucc, 21 April 2015 - 09:32 PM
MindenCucc #1
Posted 21 April 2015 - 11:32 PM
Using CC, you can corrupt your Windows filesystem very easely.

Video: https://www.youtube....h?v=IeD4p9gtHRE
–Note: YT successfully downscaled the video so bad, that it's almost unreadable. Watch at your own risk of being blind from the poor quality.


Commands to repeat the process (don't do it)
SpoilerNote: you DON'T want to try this out on your real computer (I did, so I now suffer from the corruption :(/>)
Spoiler

> dir
some thing
> mkdir asd
> dir
some thing asd
> cd asd
asd > mkdir test
asd > dir
test
asd > cd test
asd/test > mkdir ...
asd/test > dir
asd/test > cd ...
asd/test/... > dir
Java Exception Thrown:
java.lang.NullPointerException
asd/test/... > mkdir ...
asd/test/... > dir
asd/test/... > cd ...
asd/test/.../... > dir
Java Exception Thrown:
java.lang.NullPointerException
-- And here goes the final touch
asd/test/.../... > mkdir ..
asd/test/.../... > dir
Java Exception Thrown:
java.lang.NullPointerException
asd/test/.../... > mkdir meh
mkdir:8: Access denied
-- And from now, the asd/test folder is damned :P/>

I'm using the 1.73 version for MC1.7.10 using Forge #1291 on Java1.8.0-ea-b120 x64 running under Windows 8 x64, but this kind of information is almost useless, because I think, the core of the bug is in the Java language itself.

I think this could be fixed by checking the path for too many dots in one place, and erroring "Invalid path"

Also note to Dan: if you could, please add a config option to do a .printStackTrace() on caught exceptions, it could help a lot for mod devs who integrate into your mod.
Edited on 21 April 2015 - 09:43 PM
Creator #2
Posted 22 April 2015 - 10:03 AM
Hey, thanks for warning us not to break our system. Do you know what causes the bug?

I mean, thanks for breaking your system for us. The least you deserve is a +1
Edited on 22 April 2015 - 08:04 AM
MindenCucc #3
Posted 22 April 2015 - 10:32 AM
Do you know what causes the bug?

I think, the core of the bug is in the Java language itself.
Edited on 22 April 2015 - 08:47 AM
Creator #4
Posted 22 April 2015 - 02:45 PM
I meant what stopps working in ntfs that breaks the dir
Cranium #5
Posted 22 April 2015 - 04:40 PM
This has absolutely nothing to do with the NTFS filesystem.
You're creating adirectory that you shouldn't, and the default OS doesn't know what to do with a directory named "…"
Just don't do that. You can't create a directory like that in regular OSes, because they prevent you from doing so; for this very reason.
MindenCucc #6
Posted 22 April 2015 - 05:26 PM
This has stuff to do with Windows being a derpy OS, that hates anything that is not normal… Linux does not break, because it's a normal OS-kernel-thingy… I mean, it DOES break more easily than Windows, but only if you don't know how to use it :P/> Also, ext4 is the best filesystem, because it's REALLY hard to break it. I'll try this out on my 3 Linuxes, and report the progress.
Edited on 22 April 2015 - 03:28 PM
MindenCucc #7
Posted 22 April 2015 - 05:45 PM
It works on Slackware64, but not on Android.

Proof:
Spoiler
Also… Here, have this kitty:
Spoiler�� 😸 Too bad :(/>
Edited on 22 April 2015 - 03:50 PM
MindenCucc #8
Posted 22 April 2015 - 06:13 PM
Lol, wait… Appearently it looks like, that CC (or Windows) thinks, that the filesystem is populated with folders that contain only dots :lol:/> :P/>

Images:
Spoiler


Edit: lol, it looks like, it's Windows's part:
Spoiler
Edited on 22 April 2015 - 04:20 PM
Cranium #9
Posted 22 April 2015 - 08:04 PM
Right, as said before though, it's not a ComputerCraft bug at all. It's simply that any filesystem doesn't appreciate a directory with that kind of designation. It just doesn't know what to do with it.
Bomb Bloke #10
Posted 22 April 2015 - 11:27 PM
You can't create a directory like that in regular OSes, because they prevent you from doing so; for this very reason.

Thing is, Java is running in a "regular OS" - Windows, and apparently in MindenCucc's case it's not preventing anything.

That aside, try "cd …" in CC yourself and see what happens. Don't bother about trying to create such a directory; just give the command a go as-is. Now try it again in a Windows command prompt and note the difference in your results.

Personally, I was unable to get "mkdir …" do anything under my setup (Windows 8.1, Java 1.8, CC 1.74pr20).
apemanzilla #11
Posted 22 April 2015 - 11:47 PM
You can't create a directory like that in regular OSes, because they prevent you from doing so; for this very reason.

Thing is, Java is running in a "regular OS" - Windows, and apparently in MindenCucc's case it's not preventing anything.

That aside, try "cd …" in CC yourself and see what happens. Don't bother about trying to create such a directory; just give the command a go as-is. Now try it again in a Windows command prompt and note the difference in your results.

Personally, I was unable to get "mkdir …" do anything under my setup (Windows 8.1, Java 1.8, CC 1.74pr20).

I'm having the same results. Windows 7 64-bit, Java 1.6 through 1.8, CC 1.73. mkdir … doesn't do anything as far as I can tell.
Cranium #12
Posted 22 April 2015 - 11:51 PM
I should have clarified then. You can't do this in a normal command prompt or within the system. It's technically possible to create the directory, but normally those commands are ignored because it would create an erroneous directory name.
theoriginalbit #13
Posted 23 April 2015 - 12:27 AM
Right, as said before though, it's not a ComputerCraft bug at all.
I would debate that it is a CC bug, it is an oversight that should have been captured.
Rule #1 of software development: don't assume error checking and validation is performed unless explicitly stated in the language specification documentation.
Cranium #14
Posted 23 April 2015 - 12:41 AM
I would debate that it is a CC bug, it is an oversight that should have been captured.
Rule #1 of software development: don't assume error checking and validation is performed unless explicitly stated in the language specification documentation.
I dunno, it sounds to me like going into the doctor saying that it hurts every time you stab yourself in the leg. Any sane person would say that it's idiotic to want to do this. Just because you have the ability to do things, doesn't mean you should and then complain when it breaks things.
Edited on 22 April 2015 - 10:42 PM
Lupus590 #15
Posted 23 April 2015 - 07:49 AM
I would debate that it is a CC bug, it is an oversight that should have been captured.
Rule #1 of software development: don't assume error checking and validation is performed unless explicitly stated in the language specification documentation.
I dunno, it sounds to me like going into the doctor saying that it hurts every time you stab yourself in the leg. Any sane person would say that it's idiotic to want to do this. Just because you have the ability to do things, doesn't mean you should and then complain when it breaks things.

I would suggest that Dan200 puts in a check (and server owners too with a resource pack) as there are a lot of young players on the forums who may make this mistake. I'm 20 and didn't know this would happen, although I would not have named any folders with just dots.
MindenCucc #16
Posted 23 April 2015 - 08:54 AM
Funny fact: I discivered this bug while making my emulator. I asked my friend about "what if instead of hardcoding '..', check if the path contains only dots, since str.Any(chr => chr == '.') is a really fast way in checking for dots." He did not knew it, so I checked, and I could make dirs with name that only contain dots . I fixed this issue by ignoring alot of dots in the path.
Edited on 23 April 2015 - 06:59 AM