andsens / homeshick

git dotfiles synchronizer written in bash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

homeshick does not track rest of the files in directory if it finds root-owned files in directory.

absorber opened this issue · comments

Steps to reproduce:

  1. Populate an empty directory called hometest/ with files using this command: touch {a..z}.sh
  2. sudo git clone a repo (in my case I cloned this repo)
  3. homeshick generate a new castle (my example: rootest)
  4. Track the directory with homeshick

Observed result:

$ homeshick track rootest hometest/
        track gitest/hometest/s.sh
        track gitest/hometest/v.sh
        track gitest/hometest/p.sh
        track gitest/hometest/h.sh
        track gitest/hometest/j.sh
        track gitest/hometest/e.sh
        track gitest/hometest/d.sh
        track gitest/hometest/b.sh
        track gitest/hometest/i.sh
        track gitest/hometest/k.sh
        track gitest/hometest/n.sh
        track gitest/hometest/t.sh
        track gitest/hometest/Lynis/READMEmv: cannot move `/home/le/gitest/hometest/Lynis/README' to `/home/le/.homesick/repos/rootest/home/gitest/hometest/Lynis/README': Permission denied
ln: failed to create symbolic link `/home/le/gitest/hometest/Lynis/README': File exists
        track Unable to add file to git. Git says: fatal: pathspec 'home/gitest/hometest/Lynis/README' did not match any files

Expected result:
Track all files inside that directory except root files and warn the user that the root-owned files could not be tracked.


I wasn't sure whether this was a git issue or a git issue, but from my understanding it first tries to move the files, and upon error on the move (because those are root-owned files) git fails because it expects files there.

I wasn't sure whether this was a git issue or a git issue, but from my understanding it first tries to move the files, and upon error on the move (because those are root-owned files) git fails because it expects files there.

Yep, you're right. homeshick needs to be a little more fault tolerant in general. Right now it just bails if anything goes wrong. This relates a little to #101, where homeshick also fails too early.

So after a year of procrastination ;-) I am going to close this one as "wontfix". An error during recursive tracking might be an indication of user error. homeshick track can be quite disruptive if you track the wrong directory.

When the user runs track, he expects everything to go well - if it doesn't, he made a wrong assumption and homeshick should bail.

Remember: You can always just run find hometest -user absorber | xargs homeshick track rootest :-)