Skip to content

Make mzscheme work when executed using a nonstandard argv[0] #3685

@iblech

Description

@iblech

What version of Racket are you using?
8.0 of course :-) Congratulations on that release!

What program did you run?

$ exec -a some-different-name ./mzscheme

What should have happened?
mzscheme should have started as normal, just as it does when invoked simply by ./mzscheme.

If you got an error message, please include it here.
The start aborts:

$ $ exec -a some-different-name ./mzscheme
read failed to read all 23 bytes from file /tmp/mzscheme
Aborted (core dumped)

Please include any other relevant details
The issue was noticed in NixOS (specifically this issue). There, the mzscheme binary is replaced by a wrapper shell script which first sets some environment variables, as NixOS takes care not to pollute the global /bin namespace (and their likes). As its final command, this wrapper shell script executes the true mzscheme binary (located in /nix/store/.../.mzscheme-wrapped) as follows:

exec -a mzscheme /nix/store/.../.mzscheme-wrapped "$@"

It appears that the true binary attempts to read some bytes from argv[0]. This fails because argv[0] points to the wrapper shell script instead of the true binary.

A simple way out for us would be to patch the source so that the true binary no longer uses argv[0] for direction but instead uses a hardcoded path. Could you point us to the relevant point in the source?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions