
This probably fails "responsible disclosure", but it's not an RCE and frankly the whole bug is utterly hilarious so here we are... It's possible to open a file on a disk drive and continue to read/write to them after the disk has been removed: local disk = peripheral.find("drive") local input = fs.open(fs.combine(disk.getMountPath(), "stream"), "rb") local output = fs.open(fs.combine(disk.getMountPath(), "stream"), "wb") disk.ejectDisk() -- input/output can still be interacted with. This is pretty amusing, as now it allows us to move the disk somewhere else and repeat - we've now got a private tunnel which two computers can use to communicate. Fixing this is intuitively quite simple - just close any open files belonging to this mount. However, this is where things get messy thanks to the wonderful joy of how CC's streams are handled. As things stand, the filesystem effectively does the following flow:: - There is a function `open : String -> Channel' (file modes are irrelevant here). - Once a file is opened, we transform it into some <T extends Closeable>. This is, for instance, a BufferedReader. - We generate a "token" (i.e. FileSystemWrapper<T>), which we generate a week reference to and map it to a tuple of our Channel and T. If this token is ever garbage collected (someone forgot to call close() on a file), then we close our T and Channel. - This token and T are returned to the calling function, which then constructs a Lua object. The problem here is that if we close the underlying Channel+T before the Lua object calls .close(), then it won't know the underlying channel is closed, and you get some pretty ugly errors (e.g. "Stream Closed"). So we've moved the "is open" state into the FileSystemWrapper<T>. The whole system is incredibly complex at this point, and I'd really like to clean it up. Ideally we could treat the HandleGeneric as the token instead - this way we could potentially also clean up FileSystemWrapperMount. BBut something to play with in the future, and not when it's 10:30pm. --- All this wall of text, and this isn't the only bug I've found with disks today :/.
CC:Restitched Patchwork
This is a Work In Progress Port
This is an fork of Zundrel/cc-tweaked-fabric who's goal was to port SquidDev-CC/CC-Tweaked to fabric. I picked up maintaining the mod because the team working on Zundrel's fork, admitted they had gotten lazy so I picked it up to make it up to snuff with CC:T
Contributing
Any contribution is welcome, be that using the mod, reporting bugs or contributing code. In order to start helping develop CC:R there are a few rules
- Any updates that port commits from CC:T, MUST follow the format defined in patchwork.md otherwise they will not be accepted,
- Commit Message must be the same as it is in CC:T,
- patchwork.md must be updated in the following format
Comments, optional but useful if you had to do something differently than in CC:T (outside of Fabric/forge differences
```
commitID
commit title
commit desc
```
- Follow the fabirc programming guidelines as close as possible. This means you have to use
loom
mappings, - You cannot intentionally implement bugs and security vulnerabilities
- Unless the commit is a "patchwork" compliant commit, (IE: taken from CC:T), the lua code is off limits,s
Bleeding Edge Builds
Bleeding edge builds can be found here at github actions to simplify things
Community
If you need help getting started with CC: Tweaked, want to show off your latest project, or just want to chat about ComputerCraft, here is the Forum and the Discord
Known Issues
Main Known issue
- Mods that add blocks that can be used as peripherals for CC:T On forge, dont work with CC:R.
- This is because of the differences between forge and fabric, and that mod devs, to my knowledge have not agreed upon a standard method in which to implement cross compatibility between mods,
- Storage Peripherals throw a java "StackOverflowError" when using
pushItems()
,- Work around, you are probably using
pushItems(chest, 1)
or simular. please usepushItems(chest, 1, nil, 1)
.
- Work around, you are probably using
Known Working mods that add Peripherals
- Please let me know of other mods that work with this one
- Better End
- Better Nether