BunsenLabs/bunsen-utilities

bl-conky-manager ignores symlinks to conky files

Closed this issue · 3 comments

Line 152 in bl-conky-manager test for the existence of a "regular file" ([[ -f $file ]]) and will ignore anything else. I assume this was done to skip over directories, etc., but it also ignores symlinks. (I found that because I keep a conkyrc I created elsewhere and wanted to link it into the directory to use it with the conky manager; I worked around this with a hardlink, but that is not always an option.) Unless there is a good reason (i.e. something does not work with symlinks), I would suggest fixing that, either by changing the test to just exclude directories ([[ ! -d $file ]]) or by explicitly allowing symlinks ([[ -f $file ]] || [[ -L $file ]]). (There are several other things that could fail and that one could test for, e.g. files without read permissions, but these are not common and one can almost never test for every possible contingency.) Thanks!

Hi @tdanhorn thanks for your attention to this.
However, I'm unable to reproduce this issue.
According to man bash:

CONDITIONAL EXPRESSIONS
...
Unless otherwise specified, primaries that operate on files follow sym‐
bolic links and operate on the target of the link, rather than the link
itself

The -f condition has no such extra specification, and I've just confirmed in a quick test that [[ -f $file ]] tests the link target, if $file is a symlink.

In fact, ~/.config/conky already contains a symlink: BL-Default-conky.conf which points to BL-Lithium-conky.conf in the same directory. Both filenames appear in bl-conky-manager when I run it.

That leaves the question of why your symlinked file failed to be detected. Could you try again to make sure there wasn't a typo when you created the symlink?

Thanks for looking into this. You are right, I can't reproduce it either now, my bad. I probably had a broken symlink when I tried.

Anyway, thanks for your interest in BunsenLabs!