gxpkg incorrect deletes all files in project. #1405

Open
opened 2026-02-05 17:12:55 +00:00 by ober · 2 comments
ober commented 2026-02-05 17:12:55 +00:00 (Migrated from github.com)

gxpkg-deletes-files.sh
I've attached an example test script to reproduce the error.

Reproduces the bug where 'gerbil pkg install' run from within a project
directory (one that has gerbil.pkg + .gerbil/) can wipe project contents.

Root cause: setup-local-pkg-env! in gerbil/tools/env.ss detects gerbil.pkg
in CWD and sets GERBIL_PATH=./.gerbil. All subsequent gxpkg operations
(clean, build, uninstall) then operate on the local .gerbil/ context.
The pkg-uninstall function runs: rm -rf $GERBIL_PATH/pkg/
and pkg-clean runs build.ss clean, which can cascade into removing
project build artifacts and sometimes source files.

[gxpkg-deletes-files.sh](https://github.com/user-attachments/files/25104587/gxpkg-deletes-files.sh) I've attached an example test script to reproduce the error. Reproduces the bug where 'gerbil pkg install' run from within a project directory (one that has gerbil.pkg + .gerbil/) can wipe project contents. Root cause: setup-local-pkg-env! in gerbil/tools/env.ss detects gerbil.pkg in CWD and sets GERBIL_PATH=./.gerbil. All subsequent gxpkg operations (clean, build, uninstall) then operate on the local .gerbil/ context. The pkg-uninstall function runs: rm -rf $GERBIL_PATH/pkg/<package> and pkg-clean runs build.ss clean, which can cascade into removing project build artifacts and sometimes source files.
vyzo commented 2026-02-05 17:20:12 +00:00 (Migrated from github.com)

thats a clean operation working as intended.

thats a clean operation working as intended.
drewc commented 2026-03-13 01:24:12 +00:00 (Migrated from github.com)

thats a clean operation working as intended.

First I've seen this, so I'm right in the middle. gerbil pkg install is not gerbil pkg clean and automagically removing anything not specifically stated without a (Y/n) prompt has cost me tens of thousands. Not gerbil's fault, but still.

So, not a bug, but NOT A FEATURE, especially for us stoners. Before any rm we should prompt unless a --noprompt or --no-longer-stoned tag is passed. Cool?

> thats a clean operation working as intended. First I've seen this, so I'm right in the middle. `gerbil pkg install` is not `gerbil pkg clean` and automagically removing anything not specifically stated without a `(Y/n)` prompt has cost me tens of thousands. Not gerbil's fault, but still. So, not a bug, but NOT A FEATURE, especially for us stoners. Before any `rm` we should prompt unless a `--noprompt` or `--no-longer-stoned` tag is passed. Cool?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mighty-gerbils/gerbil#1405
No description provided.