SuperCuber / dotter

A dotfile manager and templater written in rust 🦀
The Unlicense
900 stars 48 forks source link

[BUG] Moving file outside of folder creates error #161

Closed Poaclu closed 5 months ago

Poaclu commented 10 months ago

Environment

Description

I moved some of my config files from inside folders to root. Example : one of my files was in tmux/.tmux.conf, and I renamed it to just tmux at the folder root.

Once I updated the dotter global config file, I kept having errors (after at least 5 to 10 tries), for tmux it was this :

[ERROR] Failed to delete symlink "tmux/.tmux.conf" -> "/home/poaclu/.tmux.conf"
Caused by:
    detect symlink's current state
    get source state
    read contents of file that isn't symbolic or directory
    Not a directory (os error 20`

Every config file was up-to-date with my new config. I then checked the .dotter/cache.toml file :

[symlinks]
tmux = "/home/poaclu/.tmux.conf"
"tmux/.tmux.conf" = "/home/poaclu/.tmux.conf"

I guessed the error came from there. I then deleted the .dotter/cache.toml, redeployed dotter and it worked.

Reproduction

I don't know exactly how to reproduce it, but this error happened for 5 files that I did this action for (at the same time). So I guess :

Expected behavior

A clear and concise description of what you expected to happen : I guess deleting absent files that are not in the dotfiles folder, or at least asking the user if the file is still in use ?

Actual behavior

I already explained what happened, please ask more questions if needed. I reproduced the error and got this log :

[ INFO] [-] symlink "tmux/.tmux.conf" -> "/home/poaclu/.tmux.conf"
[ERROR] Failed to delete symlink "tmux/.tmux.conf" -> "/home/poaclu/.tmux.conf"
Caused by:
    detect symlink's current state
    get source state
    read contents of file that isn't symbolic or directory
    Not a directory (os error 20)
[ INFO] [+] symlink "tmux" -> "/home/poaclu/.tmux.conf"
[ERROR] Creating symlink "tmux" -> "/home/poaclu/.tmux.conf" but target exists and doesn't point at source. Skipping.
[ERROR] Some files were skipped. To ignore errors and overwrite unexpected target files, use the --force flag.

Here's a full version of my log, if needed

Don't hesitate to contact me if needed.