On 21-07-2022 17:11, ( wrote:
couldn't we just use `-DSHELL_PATH=/gnu/store/...`?

Using SHELL_PATH instead of the __guix_bin_sh sounds better, yes.  But it's not 'just use -DSHELL_PATH=', we still need to change 'system' appropriately.

Would this not violate POSIX? Since, as far as I can see,
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html>
does not give the implementation license to implement system(3) as a
macro.
Probably. But does that really matter?  The standard exists for a reason, but we aren't aiming for POSIX certifications and it isn't the law or something ... seems rather inconvenient for development outside a build environment though, so perhaps SHELL_PATH could somehow fallback to /bin/sh when outside a build environment.
  We could do

```
int system(const char *command) {
        return __guix_run_in_shell(command, __guix_bin_sh);
}

Needs a 'static' to avoid multiple definitions on the same thing, but yes, that would avoid the macro problem (though not sufficient for some FFI).

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to