rcm icon indicating copy to clipboard operation
rcm copied to clipboard

rcup ignoring empty folders even if not empty in first entry of DOTFILES_DIRS

Open schmijos opened this issue 8 years ago • 2 comments

I'm using Thoughtbot's dotfiles and my own dotfiles-local.

How can I force rcup to overwrite a config file with a symlink pointing to dotfiles-local?

In my specific example I want to replace the installer generated gnupg configuration with my own one.

I've a .gnupg folder in my home directory looking like this:

ls ~/.gnupg
gpg-agent.conf pubring.gpg    random_seed    trustdb.gpg
gpg.conf       pubring.gpg~   secring.gpg

and I've a gnupg folder in my dotfiles-local looking like this:

ls ~/dotfiles-local/gnupg
gpg-agent.conf gpg.conf

When it comes to lsrc everthing seems like expected:

lsrc
...
/Users/josua/.gnupg/gpg-agent.conf:/Users/josua/dotfiles-local/gnupg/gpg-agent.conf
/Users/josua/.gnupg/gpg.conf:/Users/josua/dotfiles-local/gnupg/gpg.conf
...

But if I execute rcup, it doesn't ask to overwrite the file .gnupg/gpg-agent.conf with a symlink to dotfiles-local/gnupg/gpg-agent.conf like I would expect. All other symlinks are created. For some which are present in dotfiles and where I have a .local in dotfiles-local I'm asked if they should be overwritten. But nothing happens for files which are already somewhere in the filesystem (not being symlinks) outside of dotfiles and dotfiles-local.

Is that intended behaviour?

Update:

I found out, that it works if I put the gnupg config files under dotfiles/gnupg/ and under dotfiles-local/gnupg/.

Could this be an issue of https://github.com/thoughtbot/dotfiles instead of rcm?

Update 2:

It seems there was some confusion about that already: https://github.com/thoughtbot/dotfiles/commit/8c77a89bc3797ace04fcaab807ce5f6bbccda914

Update 3:

It seems to be an issue of rcm.

Apparently rcm ignores empty folders. So it's not enough to specify DOTFILES_DIRS="$HOME/dotfiles-local $HOME/dotfiles" in dotfiles/rcrc. In my case dotfiles was authoritative for deciding if a folder was empty even if dotfiles-local should have had precedence.

As a workaround or maybe even better practise I just copied the dotfiles/rcrc to dotfiles-local/rcrc and also rcup dotfiles-local instead of dotfiles.

I wouldn't have noticed the problem if I had a dotfiles-local/rcrc in the first place.

schmijos avatar Aug 10 '16 19:08 schmijos

Interesting. So, a minimal test case is:

dotfiles-A/directory
dotfiles-B/directory/file
rcup -d dotfiles-A -d dotfiles-B

This will cause .directory/file not to be symlinked?

mike-burns avatar Dec 26 '16 21:12 mike-burns

I cannot confirm with 1.3.3. All looks fine :

rcm imperator:~ [147]% mkdir dotfiles-global/emptyone
rcm imperator:~ [148]% mkdir .dotfiles/emptyone
rcm imperator:~ [149]% echo 'Content' > .dotfiles/emptyone/notsoempty
rcm imperator:~ [150]% lsrc -d dotfiles-global -d .dotfiles
/home/rcm/.date:/home/rcm/.dotfiles/date
/home/rcm/.emptyone/notsoempty:/home/rcm/.dotfiles/emptyone/notsoempty
/home/rcm/.realdotdir1/dotdate:/home/rcm/.dotfiles/realdotdir1/dotdate
/home/rcm/.tmp/rcmoutfile:/home/rcm/.dotfiles/tmp/rcmoutfile
rcm imperator:~ [151]% rcup -d dotfiles-global -d .dotfiles
rcm imperator:~ [152]% lsrc -d dotfiles-global -d .dotfiles
/home/rcm/.date:/home/rcm/.dotfiles/date
/home/rcm/.emptyone/notsoempty:/home/rcm/.dotfiles/emptyone/notsoempty
/home/rcm/.realdotdir1/dotdate:/home/rcm/.dotfiles/realdotdir1/dotdate
/home/rcm/.tmp/rcmoutfile:/home/rcm/.dotfiles/tmp/rcmoutfile
rcm imperator:~ [153]% ll /home/rcm/.dotfiles/emptyone/notsoempty    
-rw-rw-r-- 1 rcm rcm 8 Dec  8 01:39 /home/rcm/.dotfiles/emptyone/notsoempty

mat-m avatar Dec 08 '19 00:12 mat-m