Skip to content

Fix macos sandbox script incorrectly assuming that getconf doesn't exist#5780

Merged
dra27 merged 1 commit intoocaml:masterfrom
ElectreAAS:sandbox-shellfix
Jan 22, 2024
Merged

Fix macos sandbox script incorrectly assuming that getconf doesn't exist#5780
dra27 merged 1 commit intoocaml:masterfrom
ElectreAAS:sandbox-shellfix

Conversation

@ElectreAAS
Copy link
Copy Markdown
Contributor

@ElectreAAS ElectreAAS commented Jan 12, 2024

As noted in #5778, this is a proper bugfix:

  • [ -z /usr/bin/getconf ] tests if the literal string "/usr/bin/getconf" is empty - which is always false - and doesn't probe the filesystem at all.
  • command -v getconf >/dev/null actually asks the system if that command exists. The place where it is defined (/usr/bin or anything else) doesn't matter since we call it directly below.

It should be noted that if $TMPDIR is not set and getconf doesn't exist, we carry on the program silently. Is that intended?

I do not have a macos machine on hand and cannot test this, but this could be related to #4958

Copy link
Copy Markdown
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that by default macOS already defines TMPDIR during startup so this code is almost never executed in practice (i think the only way would be if you manually unset that variable or if you start your shell with env -i, which is definetely possible but unlikely)

@dra27 dra27 merged commit 285bf78 into ocaml:master Jan 22, 2024
@ElectreAAS ElectreAAS deleted the sandbox-shellfix branch January 22, 2024 13:15
@rjbou rjbou added this to the 2.2.0~beta2 milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants