WIP: fix(env): a shared longshot_env.txt sets no paths, dumps, file-writing or builder switches, nor the control bridge #1177
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1177
Loading…
Reference in a new issue
No description provided.
Delete branch "TrashPanda/Longshot:fix/env-file-shared"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Linux, RTX 4070 Ti (game-free checks) · Needs: none
Why
A
longshot_env.txtis passed between players, and it could still set switches that write files where the game was started, name a folder, steer the builder an update runs, or turn on the control bridge. This is the env-file part of #218, split out so it can be reviewed and merged on its own.What changed
env_line_allowedinhost/hos_main.crefuses dump switches by family, the remaining path-valued switches, SDL's file-writing switches, the frame trace,RX_VK_DLSS_DIR,HOS_PGO,HOS_CONTROLandHOS_CONTROL_MEM, and of theLONGSHOT_names takes only the game's own. The environment and a fileHOS_ENV_FILEnames still set all of them.tests/test_env_file.pyscanshost/andgpu/for switches used as paths and fails when the shared file could set one.Commits, each with its original author and message:
892ab8eafix(env): keep dump switches and the last path-valued switches out of a shared hookshot_env.txt (hckrman101)A hookshot_env.txt is passed around between players, so it may not set
switches that name a file or folder. The list had drifted: RX_DUMP_IR,
RX_SCREENSHOT, RX_FLASH_LOG and HOS_SCAN_DT take a folder or file
prefix and were still accepted with a bare name, and RX_VK_DUMP_NATIVE
wrote files into the current folder. Dump switches are now refused by
family (any name with _DUMP), the four are refused by name, and
tests/test_env_file.py scans host/ and gpu/ for switches whose value is
used as a path and fails when the shared file could set one.
Co-Authored-By: Claude Opus 5.5 [email protected]
c232af4cfix(env): a shared hookshot_env.txt names RX_VK_DLSS_DIR only by a full local path (hckrman101)RX_VK_DLSS_DIR is the one path a shared hookshot_env.txt may still set.
A relative value (ngx, ., ../x) was taken and NGX resolved it against
whatever folder the game was started from, and a .. step could lead
out of the folder the value names. The file now takes only a folder
named in full on this PC (C:\x on Windows, /x on Linux) with no ..
step; shares and device paths stay refused. The process environment and
HOS_ENV_FILE still take any value.
tests/test_env_file.py checks a table of values for both systems.
Co-Authored-By: Claude Opus 5.5 [email protected]
a4889c87fix(env): keep SDL's file-writing switches and the frame trace out of a shared hookshot_env.txt (hckrman101)A shared hookshot_env.txt may set SDL_ switches. Two kinds of them make
the game write files where it was started, without end: the dummy and
offscreen video drivers' *SAVE_FRAMES (a picture each frame) and the
disk audio driver (SDL_AUDIODRIVER / SDL_AUDIO_DRIVER=disk: the sound to
sdlaudio.raw). The file now leaves those out, as it does the game's own
dump switches; other SDL switches (SDL_VIDEODRIVER=x11 and the like)
are taken as before. RX_VK_FRAME_TRACE, which adds a line to
hookshot_frames.csv each frame, joins the switches it takes no value for.
tests/test_env_file.py gains the cases; the readme says so.
Co-Authored-By: Claude Opus 5.5 [email protected]
831546bafix(env): a shared hookshot_env.txt sets only the game's own HOOKSHOT_ switches (hckrman101)hookshot_env.txt took every HOOKSHOT_ name without a path in its value.
Most of them are the builder's (HOOKSHOT_MEM_LIMIT_GB, HOOKSHOT_JOBS,
HOOKSHOT_LATEST_TAG, HOOKSHOT_KEEP_BUILD_FILES...), and the builder an
update starts from the game inherits the game's environment, so a shared
file could set how the update's build ran. HOOKSHOT_PREPARE_ONLY, set by
--prepare-shaders, kept the game from ever playing. The file now takes
only the game's own HOOKSHOT_NO_UPDATE_CHECK, HOOKSHOT_NO_AV1_NOTICE and
HOOKSHOT_OCCLUSION_OFF; the process environment and HOS_ENV_FILE still
set any.
tests/test_env_file.py looks through the builder's sources for HOOKSHOT_
names and checks the file takes none but the game's; the readme says so.
Co-Authored-By: Claude Opus 5.5 [email protected]
Ported to Longshot: LONGSHOT_NO_UPDATE_CHECK is not one of the game's (Longshot #13 removed the game's update check),
so the game's LONGSHOT_ names are LONGSHOT_NO_AV1_NOTICE and LONGSHOT_OCCLUSION_OFF.
049022f3fix(env): a shared hookshot_env.txt cannot turn on the control bridge (HOS_CONTROL, HOS_CONTROL_MEM) (Joey Magnus)HOS_CONTROL's value is a socket path, and a bare name passed the file's
no-path rule (a socket in the current folder). HOS_CONTROL_MEM opens guest
memory reads and writes over it. Both are refused by name, like the other
switches that name a file; tests/test_env_file.py found HOS_CONTROL.
e41e90c6fix(env): a shared longshot_env.txt no longer sets RX_VK_DLSS_DIR or HOS_PGO (Joey Magnus)RX_VK_DLSS_DIR picks the folder NGX loads DLSS's runtime from, and NGX takes the newest it finds: a full local path
still let a shared file point it at /tmp, /dev/shm, C:\Users\Public or a mapped drive, where anything can drop a
newer copy. The game's ngx folder and %LOCALAPPDATA%\Longshot\ngx ($XDG_DATA_HOME/longshot/ngx) need no switch, so the
file now refuses it like every other _DIR name; the environment and a file HOS_ENV_FILE names still set it.
HOS_PGO (a profiling build's counts, to the file it names) is refused too, so that every switch-gated write the game
keeps (tests/test_game_writes_no_links.py) is one the shared file cannot turn on.
Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 [email protected]
1ecaa16efix(env): main's LONGSHOT_ switches: LONGSHOT_OCCLUSION_OFF is gone, env_on reads the rest (Joey Magnus)Main removed LONGSHOT_OCCLUSION_OFF (test_switches_removed checks it is named nowhere), so the shared file's
LONGSHOT_ allow list keeps only LONGSHOT_NO_AV1_NOTICE, and the README says so. Main reads its LONGSHOT_
switches with env_on(), so test_env_file's scan of the game's names looks for env_on as well as getenv.
8a7f9df6fix(env): the env file's comment no longer names LONGSHOT_LATEST_TAG, which no builder looks for (test_no_release_lookup) (Joey Magnus)Measurements
Verdict: nothing to measure: a correctness fix off the frame path, covered by game-free checks.
Flags and settings
No switch is added or changed; the shared
longshot_env.txttakes fewer of them (above). Each still works from the environment or a fileHOS_ENV_FILEnames.Testing
Tested: On Linux (kernel 7.0), RTX 4070 Ti,
main@71b1edd8, this PR @8a7f9df6:tests/test_env_file.pypass. The full suite (tests/run_all.py) has not been run on this branch yet; a comment will follow when it has.Not tested: The game with a shared env file. Opened as work in progress until it runs in the game.
Must be tested:
Risks
What could break: a player's own
longshot_env.txtthat set one of these switches (they still work in the environment or throughHOS_ENV_FILE).Turning it off: revert the commit.
Compatibility: A
longshot_env.txtthat set one of the refused switches no longer sets it; the log says so.Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main.third_party/untouched (a new folder with aPROVENANCE.mdinstead).python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).When it applies
mainand passing here.Assisted-by:/Co-Authored-By:trailers.Tested in game: Linux (Ubuntu 26.04.1, kernel 7.0.0-43), RTX 4070 Ti 12 GB, NVIDIA 595.99.02, Ryzen 7 9800X3D: this branch built together with the other 18 split from #218 and #284-#288, merged onto main @
71b1edd8(make_game.py --update, build v3.0.0-rc.5-82-g5952bb3d), then played by a scripted tour through the control bridge (scripts/memtour.py: a save loaded, Zora's Domain, the Market, Hyrule Field and Death Mountain Trail, 40 s each with walking and camera swings). All 4 stops reached, a clean quit, and no device loss or Vulkan error in the log. The game started with an empty env file; the refused switches were not set in a shared file in the game (test_env_file covers them).Possibly related, for context:
Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.