Skip to content

Conversation

@fab4100
Copy link
Contributor

@fab4100 fab4100 commented Sep 2, 2025

If build dir is a symbolic link in a directory that is not mounted when bwrap is executed the make call will fail with:

bwrap: execvp spack: No such file or directory
make: *** [Makefile:9: spack-version] Error 1

Adding the -P option to the pwd command fixes this issue.

If build dir is a symbolic link in a directory that is not mounted when
`bwrap` is executed the `make` call will fail with:

```
bwrap: execvp spack: No such file or directory
make: *** [Makefile:9: spack-version] Error 1
```

Adding the `-P` option to the `pwd` command fixes this issue.
@bcumming
Copy link
Member

bcumming commented Sep 2, 2025

Thanks for the contribution.

Can you expand on a concrete example that motivated this change?

@fab4100
Copy link
Contributor Author

fab4100 commented Sep 2, 2025

I am configuring a new machine to use the tool. The config and meta data I put in a git repo for version control which I typically clone somewhere below my home where I then will execute the build. I usually build on a tempfs mounted on /dev/shm and for convenience I set a symlink to the build destination. In my metadata I use a Makefile to create the stackinator conf like this:

.PHONY: shmem conf clean build cache

BUILD_DIR = /dev/shm/fabianw/build

shmem: clean
	mkdir -p $(BUILD_DIR)
	rm -f build
	ln -s $(BUILD_DIR) build

conf: shmem
	stack-config --build $(BUILD_DIR) \
		--recipe ./recipe \
		--system ./phantom #\
		# --cache ./cache_conf.yaml # --develop

(the shmem target creates the symlink). After make conf I do cd build which then yields different paths for pwd or pwd -P when the PATH variable is set for the spack executable in the isolated build environment. It is probably more an issue of convenience on my workflow side but maybe pwd -P is still more safe in general (from the point of view of the isolated build env).

@fab4100
Copy link
Contributor Author

fab4100 commented Sep 2, 2025

My man pwd page mentions:

       If no option is specified, -P is assumed.

       Your shell may have its own version of pwd, which usually supersedes the version described here.  Please refer to your shell's documen‐
       tation for details about the options it supports.

This assumption does not seem to be true. My shell is bash 5.3.3 where man bash mentions:

       pwd [-LP]
              Print  the absolute pathname of the current working directory.  The pathname printed contains no symbolic links if the -P option
              is supplied or the -o physical option to the set builtin command is enabled.  If the -L option is used, the pathname printed may
              contain symbolic links.  The return status is 0 unless an error occurs while reading the name of the current directory or an in‐
              valid option is supplied.

I believe the default in my shell is without -P then.

@bcumming
Copy link
Member

bcumming commented Sep 2, 2025

Thanks for the extra detail!

On eiger I get that -L is the default:

$ pwd --help
pwd: pwd [-LP]
    Print the name of the current working directory.

    Options:
      -L        print the value of $PWD if it names the current working
                directory
      -P        print the physical directory, without any symbolic links

    By default, `pwd' behaves as if `-L' were specified.

@bcumming bcumming merged commit 1514e89 into eth-cscs:main Sep 2, 2025
2 checks passed
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.

2 participants