TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.91k stars 176 forks source link

yadm doesn't process distro|d properly without lsb_release being available #455

Open erenfro opened 1 year ago

erenfro commented 1 year ago

Describe the bug

On Fedora 38, which does not come with lsb_release by default, I noticed my ~/.gitconfig wasn't being linked, and was actively removing any manually linked files to ~/.gitconfig##d.Fedora, provided that redhat-lsb-core, which provides lsb_release, was not installed. It should, by the docs, revert to os-release, and it fails that as well.

To reproduce

Can this be reproduced with the yadm/testbed docker image: [Yes/No]

Unknown, I don't do docker.

Steps to reproduce the behavior:

Create template alternative file for yadm, without having lsb_release installed, and run yadm alt.

Expected behavior

yadm should properly investigate os-release and determine distro from ID, and apply it.

Environment

Additional context

This used to work, because I've used it many times before. Perhaps I had lsb_release, as well, but I'm sure not always.

erenfro commented 1 year ago

Further investigations has provided some useful information on this. Apparently ID=fedora, is not the same as lsb_release -si's Fedora. Case problem.

erenfro commented 1 year ago

Further investigations, this is a common issue overall. lsb_release -si on Pop! OS shows Pop, but os-release is ID=pop. Linux Mint is Linuxmint and ID=linuxmint -- So this seems to be a simple case comparison issue going on, and a good graceful way to do that would be to lowercase compare both the filename key and the detected distro value.