--- a/stuff.txt
+++ b/stuff.txt
@@ -1,7 +1,7 @@
Hello
there
general
-Kenobi
+Homie
how
art
thou
6. Create stuff.txt and put this in it
Hello
there
general
Kenobi
how
art
thou
### Control Scenario - Bun patch works, and direct patch works
1. Run patch `-p1' --no-backup-if-mismatch -d '.' < './fix.patch`. This is the normal gpatch behavior
2. As a result you should see a success message and stuff.txt should have “Homie” instead of “Kenobi”, meaning the patch worked
3. undo the patch in stuff.txt so it says Kenobi again.
4. Run `bun run index.ts`
5. You should see another success and stuff.txt is again changed to “Homie”.
6. Undo the patch again
### Problem scenario - direct patch works, Bun command fails.
1. Make sure stuff.txt is in the original state, with Kenobi
2. Create an inner folder (I called mine src) and move stuff.txt into that folder.
3. Change fix.patch to point to the correct paths, aka:
--- a/src/stuff.txt
+++ b/src/stuff.txt
@@ -1,7 +1,7 @@
Hello
there
general
-Kenobi
+Homie
how
art
thou
4. From the original directory (aka not src), run the patch command again, i.e.: patch `-p1' --no-backup-if-mismatch -d '.' < './fix.patch`
5. Confirm that this succeeded and still changed the values in stuff.txt from Kenobi to Homie, and then reset it back to Kenobi
6. Run `bun run index.ts` again. You should see a failure with: `/opt/homebrew/bin/patch: **** out of memory`
### What is the expected behavior?
Bun execution of gpatch should succeed in both cases, not produce an `out of memory` error.
### What do you see instead?
`/opt/homebrew/bin/patch: **** out of memory`
### Additional information
I understand this is a niche interaction of a particular shell command executed within Bun. But given the exact same scenario works with the direct command, I feel this could be a problem within Bun. I also wonder if the same bug causing this could be breaking other command executions
What version of Bun is running?
1.1.36
What platform is your computer?
Darwin 23.6.0 arm64 arm
What steps can reproduce the bug?
Setup Steps
brew install gpatch
) - version 2.7.6. (Can checkpatch --version
to confirm)bun init
index.ts
with this:try { await $
patch '-p1' --no-backup-if-mismatch -d '.' < './fix.patch'
; console.log("Succeeded :)"); } catch(e) { console.log("Failed :("); }--- a/stuff.txt +++ b/stuff.txt @@ -1,7 +1,7 @@ Hello there general -Kenobi +Homie how art thou
Hello there general Kenobi how art thou
--- a/src/stuff.txt +++ b/src/stuff.txt @@ -1,7 +1,7 @@ Hello there general -Kenobi +Homie how art thou