Repository: bitcoin
Issue: test: different error message fails rpc_signer.py
Labels: Tests

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

On my Ubuntu 24.04 system on running rpc_signer.py functional test (after compiling from source) fails the test which tests the case of missing script (on master and 28.x but passes on 27.x !) 
I tried running (with only regtest = 1 in bitcoin.conf)
```
bitcoind  -daemon  -signer=fake.py
bitcoin-cli enumeratesigners
```
to get the following:
```
execve failed: Not a directory (20)
```
which is different than what is asserted in the test.
I tried compiling 28.x and master on a Ubuntu 24.04 VM running on Qemu/KVM and the test passes there.

I followed all the steps for installing the dependencies mentioned in build-unix.md and checked the versions mentioned in dependencies.md . Also tried removing bitcoin and again compiling from source but the test still fails.

### Expected behaviour

The functional test should pass just like it does on the CI. 

### Steps to reproduce

I referred to build-unix.md for compile instructions and installing dependencies.
For master followed the following commands:
```
cmake -B build
cmake --build build
cmake --install build
build/test/functional/rpc_signer.py
```
which gives basically the following error:
```
Traceback (most recent call last):
  File "/home/codingp110/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
    self.run_test()
  File "/home/codingp110/bitcoin/build/test/functional/rpc_signer.py", line 56, in run_test
    assert_raises_rpc_error(
  File "/home/codingp110/bitcoin/test/functional/test_framework/util.py", line 151, in assert_raises_rpc_error
    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/codingp110/bitcoin/test/functional/test_framework/util.py", line 166, in try_rpc
    raise AssertionError(
AssertionError: Expected substring not found in error message:
substring: 'execve failed: No such file or directory'
error message: 'execve failed: Not a directory (20)'.
```
For 28.x and 27.x (used git worktree to create separate directories and then git reset hard to overwrite with upstream/28.x and upstream/27.x):
```
./autogen.sh
./configure
make
test/functional/rpc_signer.py
```
28.x gives similar error as master but 27.x passes!

### Relevant log output

relevant log (master):
```
2024-12-16T02:42:47.859000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/codingp110/bitcoin/test/functional/test_framework/util.py", line 160, in try_rpc
    fun(*args, **kwds)
  File "/home/codingp110/bitcoin/test/functional/test_framework/coverage.py", line 50, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/codingp110/bitcoin/test/functional/test_framework/authproxy.py", line 146, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: execve failed: Not a directory (20) (-1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/codingp110/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
    self.run_test()
  File "/home/codingp110/bitcoin/build/test/functional/rpc_signer.py", line 56, in run_test
    assert_raises_rpc_error(
  File "/home/codingp110/bitcoin/test/functional/test_framework/util.py", line 151, in assert_raises_rpc_error
    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/codingp110/bitcoin/test/functional/test_framework/util.py", line 166, in try_rpc
    raise AssertionError(
AssertionError: Expected substring not found in error message:
substring: 'execve failed: No such file or directory'
error message: 'execve failed: Not a directory (20)'.
```

running `bitcoind` with the `-signer=fake.py` and then getting strace output on running `enumeratesigners` rpc gave only the following major differences on master and 27.x
on master:
```
readv(6, [{iov_base="HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nDate: Sat, 14 Dec 2024 09:31:05 GMT\r\nContent-Length: 93\r\nConnection: close\r\n\r\n{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-1,\"message\":\"execve failed: Not a directory (20)\"},\"id\":1}\n", iov_len=220}], 1) = 220
```
on 27.x
```
readv(6, [{iov_base="HTTP/1.1 500 Internal Server Error\r\nContent-Type: application/json\r\nDate: Sat, 14 Dec 2024 09:32:19 GMT\r\nContent-Length: 96\r\nConnection: close\r\n\r\n{\"result\":null,\"error\":{\"code\":-1,\"message\":\"execve failed: No such file or directory\"},\"id\":1}\n", iov_len=242}], 1) = 242
```
but on doing the same for master and 28.x on a VM(Ubuntu 24.04.1 LTS on VirtualBox) gave the same strace output as my system but with the correct error message.

PS: The logs/outputs mentioned for master(except for the first one in this section) are old and not for master-b042c4f0538c

### How did you obtain Bitcoin Core

Compiled from source

### What version of Bitcoin Core are you using?

v28.99.0-b042c4f0538c 

### Operating system and version

Ubuntu 24.04.1 LTS

### Machine specifications

OS: Ubuntu 24.04
Architecture:             x86_64
CPU(s):                   8
Vendor ID:                GenuineIntel
  Model name:             12th Gen Intel(R) Core(TM) i3-1215U