Skip to content

Commit

Permalink
Handle permission errors while generating paths on Darwin
Browse files Browse the repository at this point in the history
On Darwin, Nix may invoke SCons in a sandbox which lacks access to
/etc/paths.d. Handle PermissionError while iterating through
/etc/paths.d to support sandboxed environments such as Nix.
  • Loading branch information
al3xtjames committed Sep 23, 2024
1 parent 5404eb7 commit 2d5e3a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Some manpage cleanup for the gettext and pdf/ps builders.
- Some clarifications in the User Guide "Environments" chapter.

From Alex James:
- On Darwin, PermissionErrors are now handled while trying to access
/etc/paths.d. This may occur if SCons is invoked in a sandboxed
environment (such as Nix).


RELEASE 4.8.1 - Tue, 03 Sep 2024 17:22:20 -0700

Expand Down
4 changes: 4 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ FIXES
- Fix a problem with compilation_db component initialization - the
entries for assembler files were not being set up correctly.

- On Darwin, PermissionErrors are now handled while trying to access
/etc/paths.d. This may occur if SCons is invoked in a sandboxed environment
(such as Nix).

IMPROVEMENTS
------------

Expand Down
2 changes: 1 addition & 1 deletion SCons/Platform/darwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def generate(env) -> None:
# make sure this works on Macs with Tiger or earlier
try:
dirlist = os.listdir('/etc/paths.d')
except FileNotFoundError:
except (FileNotFoundError, PermissionError):
dirlist = []

for file in dirlist:
Expand Down

0 comments on commit 2d5e3a4

Please sign in to comment.