Skip to content

[Bug]: RemoteRepo can't handle binary untracked file #390

@Egor-S

Description

@Egor-S

dstack version

master

Python version

3.7

Host OS

macOS 13.3.1

Host Arch

ARM

What happened?

Untracked and not ignored .DS_Store caused UnicodeDecodeError

Relevant log output

Traceback (most recent call last):
  File "/Users/egors/dstack/dstack/cli/dstack/cli/main.py", line 55, in <module>
    main()
  File "/Users/egors/dstack/dstack/cli/dstack/cli/main.py", line 51, in main
    check_cli_errors(args.func)(args)
  File "/Users/egors/dstack/dstack/cli/dstack/cli/common.py", line 129, in decorator
    func(*args, **kwargs)
  File "/Users/egors/dstack/dstack/cli/dstack/cli/common.py", line 129, in decorator
    func(*args, **kwargs)
  File "/Users/egors/dstack/dstack/cli/dstack/cli/commands/__init__.py", line 45, in __command
    self._command(args)
  File "/Users/egors/dstack/dstack/cli/dstack/cli/commands/init/__init__.py", line 53, in _command
    repo = RemoteRepo(local_repo_dir=Path.cwd())
  File "/Users/egors/dstack/dstack/cli/dstack/core/repo/remote.py", line 117, in __init__
    diffs.append(_add_patch(local_repo_dir, filename))
  File "/Users/egors/dstack/dstack/cli/dstack/core/repo/remote.py", line 179, in _add_patch
    for line in f:
  File "/opt/homebrew/opt/python@3.8/bin/../Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 553: invalid start byte

Additional Information

To resolve the issue we have to use git diff --binary format for binary files

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions