Skip to content

IBM i PASE /bin/sh isn't a POSIX executable #115

@NattyNarwhal

Description

@NattyNarwhal

IBM i has an AIX emulation environment; it puts normal AIX binaries in /QOpenSys/bin. What lies in /bin are actually symlinks to native IBM i programs that emulate POSIX binaries in the native IBM i environment. This isn't useful since we want a normal AIX binary for our POSIX shell.

$ ls -l /bin/sh
lrwxrwxrwx 1 qsys 0 62 Aug 10  2024 /bin/sh -> /QSYS.LIB/QSHELL.LIB/QZSHSH.PGM

Patch:

diff --git a/build.c b/build.c
index 7988423..a3fa4dd 100644
--- a/build.c
+++ b/build.c
@@ -282,7 +282,12 @@ jobstart(struct job *j, struct edge *e)
 	struct string *rspfile, *content;
 	int fd[2];
 	posix_spawn_file_actions_t actions;
+#ifdef __PASE__
+	/* IBM i puts AIX binaries in /QOpenSys; /bin has QShell *PGMs */
+	char *argv[] = {"/QOpenSys/bin/sh", "-c", NULL, NULL};
+#else
 	char *argv[] = {"/bin/sh", "-c", NULL, NULL};
+#endif
 
 	++nstarted;
 	for (i = 0; i < e->nout; ++i) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions