Skip to content

Commit 84ff842

Browse files
authored
Prevent the use of the root folder as workspace (#1052)
1 parent fb297c4 commit 84ff842

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

  • vscode
    • rootfs/etc/s6-overlay/s6-rc.d/init-code-server

vscode/DOCS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ return to the defaults as delivered by this add-on, do the following:
104104
Although we support ARM devices, please be aware, that this add-on is quite
105105
heavy to run, and requires quite a bit of RAM. We do not recommended to run
106106
it on devices with less than 4Gb of memory.
107+
- **Do not use the root directory (`/`) as your workspace.** Opening the root
108+
directory causes severe performance issues, as VS Code will attempt to index
109+
the entire filesystem, resulting in excessive CPU and memory usage. Always
110+
use `/config` (the default) or another specific directory. The add-on will
111+
prevent startup if the root directory is configured as the workspace.
107112
- "Visual Studio Code is unable to watch for file changes in this large
108113
workspace" (error ENOSPC)
109114

vscode/rootfs/etc/s6-overlay/s6-rc.d/init-code-server/run

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ if bashio::config.has_value 'config_path'; then
2828
if ! bashio::fs.directory_exists "${config_path}"; then
2929
bashio::exit.nok "Configured config path does not exists"
3030
fi
31+
# Prevent using root directory as workspace to avoid performance issues
32+
if [[ "${config_path}" == "/" ]]; then
33+
bashio::exit.nok \
34+
"Using the root directory (/) as workspace is not allowed. " \
35+
"This causes severe performance issues as VS Code will index " \
36+
"the entire filesystem. Please use /config or another specific " \
37+
"directory instead."
38+
fi
3139
fi
3240

3341
# Ensure persistent data folder exists.

0 commit comments

Comments
 (0)