Closed VorpalBlade closed 1 year ago
In case this helps, I have the very same problem (on macOS 13.1, although I doubt it has any impact), and was about to open a new issue when I noticed this one. The problem seems to appear each time a diff is shown, I've also observed it when doing chezmoi re-add --interactive
and then hitting d
to get the diff.
Out of curiosity I decided to run chezmoi under valgrind to see if it would report any sort of memory error when printing a diff.
There are lots (invalid reads and writes mostly)! But they also show up for chezmoi doctor, chezmoi --help etc. Most are attributed to runtime or various upstream libraries though. Or perhaps go is incompatible with valgrind?
There should probably be a separate bug opened about that.
Perhaps this is already fixed by https://github.com/twpayne/chezmoi/pull/2707.
I also tried the binary from github.
Is this referring to the release binary? If so, could you possibly test on a local build of the latest commit?
@bradenhilton It was the release yes.
I'm not set up (or have the knowledge) to build Go code. I use C++/Python/Rust for the most part.
As @bradenhilton says, #2707 should fix it. I'm pretty sure this is a duplicate of #2706.
You can download a build from the latest master here.
Re valgrind, feel free to open an issue but it sounds like valgrind and Go do not support each other. Go is a memory safe language and doesn't do anything particularly weird (although the BoltDB library chezmoi uses does do some funky memory protection stuff).
You can download a build from the latest master here.
Yes, that fixes it.
Re valgrind, feel free to open an issue but it sounds like valgrind and Go do not support each other. Go is a memory safe language and doesn't do anything particularly weird (although the BoltDB library chezmoi uses does do some funky memory protection stuff).
It seems to indeed be incompatible based on some googling. That seems quite inconvenient if you are doing FFI with a C library or similar though. All of the errors happens before the first line of output from chezmoi (during static constructors perhaps? If that is a thing in Go).
Great, thanks for testing. I've just tagged v2.29.4
which includes the fix (rollback to sergi/go-diff 1.1.0). The release with the fix should be available in about 45 minutes.
Describe the bug
chezmoi diff
/chezmoi apply -v
display incorrect diffs sometimes. Actually applying does do the right thing however.This has been going on for a little while, but at first I thought it was my modify script doing something wrong. Now I have seen the same issue for plain chezmoi-managed files without scripts or templates as well.
To reproduce
common.sh.sys
andcommon.sh.chezmoi
: files.tar.gzThe first diff is completely wrong, and copies lines from earlier in the file.
Expected behavior
What normal diff produces:
Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context