dotdrop
dotdrop copied to clipboard
[bug] Unknown format code ValueError when do dotdrop compare
Dotdrop version (and git commit if run from source): v1.14.0 https://github.com/deadc0de6/dotdrop/tree/fix-428
Describe the bug
Get below error when run dotdrop compare:
Traceback (most recent call last):
File "/usr/bin/dotdrop", line 33, in <module>
sys.exit(load_entry_point('dotdrop==1.14.0', 'console_scripts', 'dotdrop')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/__init__.py", line 13, in main
if dotdrop.dotdrop.main():
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/dotdrop.py", line 952, in main
ret, command = _exec_command(opts)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/dotdrop.py", line 874, in _exec_command
ret = cmd_compare(opts, tmp)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/dotdrop.py", line 459, in cmd_compare
if not _dotfile_compare(opts, dotfile, tmp):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/dotdrop.py", line 166, in _dotfile_compare
diff = comp.compare(src, dotfile.dst, ignore=ignores, mode=dotfile.chmod)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/comparator.py", line 66, in compare
ret = self._comp_mode(local_path, deployed_path, mode=mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/dotdrop/comparator.py", line 82, in _comp_mode
msg = f'mode differ {local_path} ({local_mode:o}) '
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Unknown format code 'o' for object of type 'str'
Value of local_path
: /home/xq/code/Git/dotfiles/dotfiles/vim/snip
.
Value of local_mode
: preserve
.
Steps to Reproduce
Steps to reproduce the behavior:
Create a dotfile with content:
config:
backup: true
banner: false
create: true
dotpath: dotfiles
ignoreempty: false
keepdot: false
workdir: ~/.config/dotdrop
dotfiles:
d__snip:
src: vim/snip
dst: /mnt/c/Users/xq/vimfiles/snip
chmod: preserve
profiles:
wsl-win:
dotfiles:
- d__snip
run dotdrop compare -p wsl-win
The error may is local_mode
is a python string.
Thanks for reporting this however you're saying you're running dotdrop from branch fix-428? Can you please try with the master branch and let me know if that bug is also there?
Hi @deadc0de6 , get same error when using master branch.
Ok, I'll look into it, thanks for testing
@roachsinai I did some refactoring on dotdrop. Can you retest it with the master branch and let me know if the bug is still here?
Hi @deadc0de6 on my test master branch fixed this issue. Thanks a lot!!!
Futher more, get below verbose if has unimported file under a directory which managed by dotdrop:
Cool! You can ignore unimported files with the ignore pattern. Do you need help?
Yeahhh, thanks a lot. Is there a doc link? And how about the modes differ
the reason is dst is windows filesystem (everything is 777).
Yes, you can either ignore completely anything that is not present in dotdrop with the global option ignore_missing_in_dotdrop
(doc is here). This option can also be set per dotfile (see here).
Or you can use patterns to match the different directory with cmpignore
(doc is here).
For example to ignore everything under snip
and watch_later
for some dotfile:
dotfiles:
d_some
dst: ~/.some
src: some
cmpignore:
- '*/snip/*'
- '*/watch_later/*'
Regarding the permission, there's currently no option to ignore those during a compare. Have you tried simply removing the chmod
entry on the dotfile? Since if on windows it's 777 anyway, there's no reason to have it in the config.
Thanks. Very helpful!
Regarding the permission, preserve remove the confirm when run dotdrop install
.