1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

Fix system.patches

Currently, `system.patches` doesn't work because it will attempt to first detect if the patch has already been applied by checking if it can be applied in reverse.

However, when that happens, `patch` detects that the supplied patch is incorrectly reversed and attempts to ask the user if they want to "Ignore -R":

```
Unreversed (or previously applied) patch detected!  Ignore -R? [y]
```

Because the output is piped to `/dev/null` the user will basically see nothing and `darwin-rebuild switch` will hang until the user presses "Enter" (possibly to check if the terminal is frozen). At which point, patch will ignore the --reverse and exit successfully, preventing the patch from being applied at all.

This change fixes that bug by using `--force` which tells patch that we know what we're doing and prevents it from prompting the user if they want to ignore `--reverse`.
This commit is contained in:
Marwan Aljubeh 2023-03-07 12:53:20 +00:00 committed by GitHub
parent 87b9d090ad
commit e62b83a934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,7 +62,7 @@ in
${concatMapStringsSep "\n" (f: ''
f="$(basename ${f})"
if ! patch --reverse --dry-run -d / -p1 < '${f}' &> /dev/null; then
if ! patch --force --reverse --dry-run -d / -p1 < '${f}' &> /dev/null; then
patch --forward --backup -d / -p1 < '${f}' || true
fi
'') cfg.patches}