Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document requirement for GNU Diff/Patch #130

Open
mallardduck opened this issue Apr 2, 2024 · 0 comments
Open

Document requirement for GNU Diff/Patch #130

mallardduck opened this issue Apr 2, 2024 · 0 comments

Comments

@mallardduck
Copy link
Member

The functionality of generating and applying the diff patches are dependent on local system diff and patch binaries.

Per these lines:

pathToDiffCmd, err := exec.LookPath("diff")

pathToPatchCmd, err := exec.LookPath("patch")

Unfortunately, a "normal assumption" would probably be that "This is all a golang script, so the execution shouldn't be affected by local environment variances." So without this requirement documented clearly then we can encounter unexpected behavior explained by "well it works on my machine".

This was all learned in a first hand experience based on PRs I was working on last friday. We were seeing that even if I made no changes at all and ran make charts then it would results in file modifications. Eventually it was all tracked down to the fact that on macOS they ship with a BSD based "Apple" version of diff and patch. See:

→ patch --version
patch 2.0-12u11-Apple

→ diff --version
Apple diff (based on FreeBSD diff)

After using brew to install gpatch and diffutils packages I have GNU versions and get expected results:

→ patch --version
GNU patch 2.7.6

→ diff --version
diff (GNU diffutils) 3.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant