Closed fuyufjh closed 4 months ago
I am aware of the issue, however I have trouble finding a fix. The problem only seems to happen on mac as I personally haven't encountered this problem on linux. Users have told me that you seem to be able to fix the build by pressing enter twice in the terminal running the build. This makes this issue even more confusing since there shouldn't be any way for terminal input to make it's way to the hanging patch process as the build script pipes files from stdin. As I don't have access to a mac I can't really work on a fix so unfortunately this will probably remain an issue for a while.
One thing I can think of is that mac has a different patch binary then linux so you could try to install GNU-patch, the patch binary I use on linux.
I can reproduce this bug on the same environment by:
cargo clean && cargo check
rquickjs-sys(build)
to cancel itcargo check
againWhen I enabled the verbose output, it blocked with the following output:
$ cargo c -vv
...
[rquickjs-sys 0.5.0] Applying patch patches/error_column_number.patch
[rquickjs-sys 0.5.0] patching file cutils.c
[rquickjs-sys 0.5.0] patching file cutils.h
[rquickjs-sys 0.5.0] patching file quickjs-atom.h
[rquickjs-sys 0.5.0] patching file quickjs-opcode.h
[rquickjs-sys 0.5.0] patching file quickjs.c
[rquickjs-sys 0.5.0] patching file quickjs.h
[rquickjs-sys 0.5.0] patching file 'tests/test_line_column.js'
Building [=======================> ] 360/365: rquickjs-sys(build)
Then I pressed enter, the build continued until completion:
Building [=======================> ] 360/365: rquickjs-sys(build)
[rquickjs-sys 0.5.0] Patch creates file that already exists! Assume -R? [y] patching file quickjs.c
[rquickjs-sys 0.5.0] patching file quickjs.c
[rquickjs-sys 0.5.0] Applying patch patches/get_function_proto.patch
[rquickjs-sys 0.5.0] patching file quickjs.c
[rquickjs-sys 0.5.0] patching file quickjs.h
...
The reason of the stuck appears to be that it prompts for user input, as it has been run once, so the file already exists.
Adding a -f
option to the patch command seems to successfully resolve this issue for me.
let mut child = Command::new("patch")
- .args(["-p1"])
+ .args(["-p1", "-f"])
Thank you! I have been really annoyed with this bug and my lack of ability to diagnose it.
I will fix it shortly.
cargo build
hangs here forever:I tried to find out the subprocess with
ps
command, and it turns out to hang onpatch -p1
Environment:
nightly-2023-12-26-aarch64-apple-darwin