Closed xduugu closed 10 months ago
Hi @xduugu thanks for bringing this up.
The problem is that once Quadlet supports traversing a directory tree, following symlinks may lead to loops (see the reason why it is not supported in WalkDir
: https://github.com/golang/go/issues/4759).
I do like the idea of adding directories via the configuration file. @rhatdan @vrothberg WDYT?
We can't really use containers.conf
as it would binary-bloat Quadlet. And I do not like introducing "yet another" configuration file just for Quadlet.
I think we should restore the previous behavior as I consider a regression. Couldn't resolve the root directories before recursing/walking it? In this case, we could first resolve ~/.config/containers/systemd/
which resolves to ~/containers/quadlet
and then walk ~/containers/quadlet
for sub-directories.
If this works and we agree to move forward, the PR fixing it could also make the behavior explicit in the docs.
If the symlink resolution is only for the root directory, then I guess we can handle it and it will not cause any loops (since it is done only once). Is this the only case we want to support?
For this case, I think we can use: https://pkg.go.dev/io/fs#WalkDir
At least for my use case, root directory symlink support would be sufficient. However, I would somehow prefer smylinks at the first level below the root directory, but that is of course a little bit more complicated to implement.
The QUADLET_UNIT_DIRS
environment variable, which is intended for debugging purpose, would actually fulfill my need, but I don't know how to set the environment variable when quadlet is not executed from command line. Of course, it would be better, if it would not replace the unit search path, only adds additional directories to search for unit files.
Thanks a lot for the PR, @ygalblum!
Issue Description
I had symlinked
~/.config/containers/systemd/
to the directory~/containers/quadlet
which worked fine in podman version v4.6.2 and before. My setup broke with podman v4.7.0, because of commit 413552e that added support for unit files in subdirectories.https://github.com/containers/podman/blob/c3fae0136882e69b0f3fb4aa382156d63aa3f20f/cmd/quadlet/main.go#L148-L156
filepath.WalkDir explicitly does not support directory symlinks:
Directory symlinks inside of a directory
~/.config/containers/systemd/
also don't work because of this (and probably theinfo.isDir()
check).Steps to reproduce the issue
Steps to reproduce the issue
~/.config/containers/systemd/
to a directory that contains quadlet unit filesDescribe the results you received
Quadlet does not find the unit files anymore.
Describe the results you expected
Quadlet finds the unit files.
podman info output
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
Instead of adding back support for directory symlinks, it would also help if additional quadlet unit directories could be set via configuration file.