3.6 KiB
Repo Fix Plan
Findings
Medium: Fresh install does not create /servers
Reference: install.lua:32-38
LIST_FILES downloads files under servers/, but install.lua only creates /programs, /apis, and /startup. On a fresh ComputerCraft machine, wget ... servers/ping-server.lua can fail because the parent directory does not exist.
Fix:
- Add
fs.makeDir('/servers');before downloading files. - Bump
install.lua_VERSION.
Medium: cube set-boot <machineId> cannot clear boot safely
Reference: programs/cube.lua:177-204, servers/cube-server.lua:57-60
The documented behavior says an empty command deletes the boot hook. The client sends nil when no command is provided, and the server calls writeFile('/.cubeboot', startupCommand). Writing nil can error, and even an empty string currently leaves an empty file instead of deleting /.cubeboot.
Fix:
- In
servers/cube-server.lua, ifstartupCommand == nil or startupCommand == '', delete/.cubebootand replytrue. - Otherwise write the command.
- Bump
servers/cube-server.lua_VERSION. - Optionally adjust the client message to say
boot DELETEDonly when the server replies successfully.
Medium: deploy-file reports success even when writes fail
Reference: servers/cube-server.lua:62-66, programs/cube.lua:242-248
deploy-file ignores the return value from writeFile and always replies true. If a parent directory is missing, the destination is read-only, or fs.open fails, the client counts the file as transferred.
Fix:
- Reply with the boolean result of
writeFile. - Have the client keep the existing error print when
resis false. - Bump
servers/cube-server.lua_VERSION.
Medium: Deployment cannot create new nested directories
Reference: servers/cube-server.lua:24-35, programs/cube.lua:20-38
cube deploy sends file paths recursively, but the server writes files directly without creating parent directories. This fails for new directories that do not already exist on the target cube.
Fix:
- Before writing a deployed file, create its parent directory when needed.
- Keep behavior minimal: derive the parent path from
payload.path, callfs.makeDir(parent)if not empty and not present, then write. - Return false if
payloadis malformed or the file write fails.
Low: set-boot help says [command], but only one argument is accepted
Reference: programs/cube.lua:6, programs/cube.lua:325
local cubeCommand, firstArg, secondArg = ... means cube set-boot 12 mining turtle start only sends mining; extra words are dropped. This matters for shell commands with spaces.
Fix:
- Use
table.pack(...)to collect all arguments. - For
set-boot, concatenate arguments after the machine id with spaces. - Preserve existing aliases and help behavior.
- Bump
programs/cube.lua_VERSION.
Proposed Order
- Fix
install.luato create/servers. - Fix
cube-server.luaboot clearing and deploy write reporting. - Add parent-directory creation for deployed files.
- Fix multi-word
cube set-bootcommand parsing. - Update module versions for changed files.
Verification
Manual/runtime verification is required inside ComputerCraft or CraftOS-PC because this repo has no runnable local test harness.
Suggested checks:
- On a clean machine, run the installer and confirm
/servers/*.luadownloads. - Run
cube set-boot <id>and confirm/.cubebootis deleted remotely. - Run
cube set-boot <id> program argand confirm the full command is stored. - Deploy a file inside a new nested directory and confirm it exists remotely.
- Force a bad deploy path or write failure and confirm the client reports an error instead of counting success.