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

[1.79] Shell is bricked/borked if you navigate to a certain directory

Started by Boom, 28 April 2017 - 04:32 AM
Boom #1
Posted 28 April 2017 - 06:32 AM
VERSION: 1.79

DESCRIPTION:
The ComputerCraft built-in shell will break if you navigate to /rom/help (CC helpfiles directory)

EXPECTED RESULT:
You cannot execute any commands, but you can forcefully restart or shutdown your computer via the CTRL+S/CTRL+R key combo.

REPRODUCTION STEPS:
  • Type cd /rom/help to visit the CC helpfiles directory
  • Try to execute any command (cd, ls, help, shutdown, restart, etc.)
SCREENSHOT/VIDEO:
Spoiler

THIS IS NOT A BUG. PLEASE SEE SQUIDDEV'S EXPLANATION BELOW.

Mods, please lock this thread kthx
Edited on 29 April 2017 - 02:29 AM
SquidDev #2
Posted 28 April 2017 - 07:24 AM
This isn't a bug, just a effect of how the shell works. When you run a program like "ls", it will look for the file in each element of the path. On a normal computer, the path is roughly ".", "/rom/programs", "/rom/programs/rednet", etc…

This means when you are in the "/rom/help" directory and run "list", it looks in the /rom/help directory first, finds the documentation file, and tries to execute that. However, the contents of "/rom/programs/list" is

ls will list all the directories and files in the current location. Use "type" to find out if an item is a file or a directory.
This obviously isn't a valid Lua file, and so errors. If you need to get out, just give the absolute path to the "cd" program: "/rom/programs/cd ../".

TLDR: Not a bug, just caused by weird shell mechanics.

See also
Edited on 28 April 2017 - 05:30 AM
Lupus590 #3
Posted 28 April 2017 - 11:08 AM
either way, I would suggest that Dan200 should probably make the shell use the path and then local files (perhaps with local files being forced with ./fileName )
CLNinja #4
Posted 28 April 2017 - 10:32 PM
either way, I would suggest that Dan200 should probably make the shell use the path and then local files (perhaps with local files being forced with ./fileName )
Thats how my friend and I designed our OS Vorbani. It will always point to our sbin or bin folders first (path in this case) and then you need to force local files if you even want to run them.