Sitelet https://github.com/NetHack/NetHack/pull/1629
Skip to content

Use fqname for save (de)compression in plname_from_file - #1629

Open
daeho-ro wants to merge 1 commit into
NetHack:NetHack-5.0from
daeho-ro:fix-plname-from-file-fqname
Open

daeho-ro wants to merge 1 commit into
NetHack:NetHack-5.0from
daeho-ro:fix-plname-from-file-fqname

Conversation

@daeho-ro

@daeho-ro daeho-ro commented Jul 9, 2026

Copy link
Copy Markdown

Will resolve #1628

plname_from_file() passed the relative gs.SAVEF to nh_uncompress() and
nh_compress(), so freopen() resolves the path against the current working
directory. That fails when the save directory (VAR_PLAYGROUND) differs from
the directory NetHack chdir()s into at startup (HACKDIR), as in some packaged
builds: starting with an existing save prints "freopen of save/<uid><name>
for compress failed; (2) No such file or directory" and corrupts the display.
Qualify the path with fqname(gs.SAVEF, SAVEPREFIX, 0), as the other save-file
paths already do.
@pat-rankin

Copy link
Copy Markdown

There's.a reason that fork+exec of compress does not use absolute paths. Unfortunately I don't remember what that reason is. Permission issues with the subprocess most likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading a saved game fails when the save folder isn't the game folder

2 participants