Weird autogenerated directories containing config files

Hello Garuda users,

I fixed a really stupid error of mine and I like to share it with you.

This is the problem, can you guess what’s wrong :wink:?

When I started programs from the shell or the launcher, it autogenerated directories named tilde “~” containing a .config directory which contained config files belonging to the started program. It used these config files instead of the configuration files in my $HOME/.config directory.

It took me multiple days until now when I actually figured it out. Even worse, this problem made me lose all my configuration data, and luckily only the ~/.config, .cache and ~/.gnupg/ data. I went into a folder, saw the useless directory called “~” and wanted to delete that autogenerated directory in the shell:grimacing::person_facepalming::person_facepalming:t2::person_facepalming:t4::man_facepalming:t6::woman_facepalming:t5::woman_facepalming:t3: !! There are certain rm -r commands that a normal user NEVER should execute. The tilde expansion killed all of my config and luckily it was stopped by the write-protection of ~/local/share, otherwise almost one year of Garuda usage (and my master thesis work) would have had a desastrous outcome. (The reaction to deleting important files is different story…)

Well, one of my first attempts was to search config files for the ASCII sequence ~~/. Totally useless because I suspected a corruption of config files during my yokelish file recovery attempt. This was not the case.

Later I realized, this directory structure …/~/.config is only generated in my home directory or in the directory in which the program command ran.

Finally, I realized, my problem only occurs when using Bash but not when using Fish. (I have bash as default shell due to these cryptic but productive special features such as found in variable expansions.) I realized, I must have made an error while configuring a bashrc a short time ago.

Well, this was the problem:

export XDG_CONFIG_HOME="~/.config"

Many of you will be smarter than me and directly see the issue.

I actually know, that tilde expansion does only work outside of quotes. I just was fooled by the thought of tilde being expanded to a path that contained whitespace (now I think, this is even fine) and with no further thought I put double quotes around it. Some people call this a “brain fart”. And heck, this was a seminal one. It made me lose half a week of work and some money for the recovery program which recovered almost only corrupted (zeroed) files. (It seems there is no working open source or cost free software for recovering files from a BTRFS when you forgot to turn on snapshots or backups for certain files.)

Simple fix:

export XDG_CONFIG_HOME="$HOME/.config"

Laziness in typing is the enemy. I hope, this story could be useful if eventually someone else stumbles upon a similar problem.

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.