-
Notifications
You must be signed in to change notification settings - Fork 181
Description
Erroneous Behavior
Symbolic links under CONFIG_DIR/topgrade.d/
are ignored even if they point to files.
Expected Behavior
The configuration files of the symbolic link destination are included.
Steps to reproduce
$ mkdir -p ~/.config/topgrade.d
$ cat >config.toml <<END
[misc]
no_self_update = true
END
$ ln -s ~/.config/topgrade.d/config.toml config.toml
$ topgrade --log-filter debug
# ~/.config/topgrade.d/config.toml is not included
Possible Cause (Optional)
Additional configuration files are searched in ConfigFile::ensure_topgrade_d()
.
That function filters entries of the directory by DirEntry::file_type()
and FileType::is_file()
.
DirEntry::file_type()
will not traverse symlinks (see std document).
FileType::is_file()
returns false
for symlinks (see std document).
So, entry.file_type()?.is_file()
returns false
for symbolic links.
Lines 534 to 543 in 960b14f
for entry in fs::read_dir(dir_to_search)? { | |
let entry = entry?; | |
if entry.file_type()?.is_file() { | |
debug!( | |
"Found additional (directory) configuration file at {}", | |
entry.path().display() | |
); | |
res.push(entry.path()); | |
} | |
} |
You can use Path::is_file()
as follows to follow symbolic links.
entry.path().is_file()
Problem persists without calling from topgrade
- Yes
- No
Did you run topgrade through Remote Execution
- Yes
- No
If yes, does the issue still occur when you run topgrade directlly in your
remote host
- Yes
- No
Configuration file (Optional)
Additional Details
-
Operation System/Version
-
Installation
-
Topgrade version (
topgrade -V
)