Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/patches/88d183843ff68cd0 # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/omega-mv#386 (code only) closed derived `88d183843ff68cd0` #386 Imported from GitHub aien-dev/omega-mv#386 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `c02b278c5ebb7b0f152196a70a527a020c900b16` · Head `7d42d8881e4259c9ee5ddbe7a6c249bf8f59c7be` ### Fetch it A git bundle of the pull request's head, 8296 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/88d183843ff68cd0.bundle -o 88d183843ff68cd0.bundle git fetch 88d183843ff68cd0.bundle refs/pull/386/head ``` Raw bundle · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 386 7d42d8881e4259c9ee5ddbe7a6c249bf8f59c7be ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":386,"url":"https://github.com/aien-dev/omega-mv/pull/386","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:40Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index bc28b1ce6..fa85f5e71 100644 --- a/.crumb +++ b/.crumb @@ -76,7 +76,7 @@ }, { "digest": "2aa8396144fa241f695a99c882fc347425604ac4822d5162be9c3ad80354fc9f", - "last_commit": "0863d99e", + "last_commit": "c02b278c", "name": "research", "purpose": "Directory research. Purpose not yet described by a human." }, @@ -87,14 +87,14 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "c06c116644765d66e2c7346e99179861cbb7bba7e8e932ff40b6c51983d90d01", - "last_commit": "22f7fb72", + "digest": "20df1488b5097b3dd816f33ac66fd6adff4c224bcdfcdb0f1f528c9ba15f8294", + "last_commit": "c232f147", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "ab439a7b4cb25cc9b3169441a99613e076152c3eaf12f976a24fafdc13a2dda5", - "last_commit": "fbc58ab6", + "digest": "4405dd867c07c00ecd36438d84cdc032964cbb602acf0e7879e7d04c1b0f0306", + "last_commit": "c232f147", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -105,15 +105,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:2755733c8b603a39f6684a82cdcdc90451890c2e7ed326478aea5c1c609efb7a", - "compiled_at": "2026-10-10T06:34:22Z", + "children_root": "sha256:a3e22417aa8a93c54be0f58911a29a344171f57e7b4ea39f27f11d70c1eb512d", + "compiled_at": "2026-10-10T07:10:33Z", "compiler": "crumb-compile/1", - "digest": "sha256:b5043503e26c1bfe35d1bb2fd1ae9be2a00bf50a8fd0a9e20fc384d543f66cc0", + "digest": "sha256:70ecff8baceced23db2763990a33f5859bb2af1ddfe20a2b1cdaaf666cc4a34b", "evidence_files": 6829, "evidence_root": "sha256:d430e46c9eac00396e5c58c2c8e60eb961500973312cc5eee25cf9d37e75bea2", "files": 9236, - "generated_at_commit": "cc969626bdd09e353f365bbdfa3368834a9409e6", - "source_tree": "sha256:0385587193f33b1a92f3cd846fd753b0ccad36b1824edb81505b82f1963cab5b" + "generated_at_commit": "8986a9d15f651e2554c9cc18bac5f52f9a682081", + "source_tree": "sha256:06912de6ab43af74d37816795507a4a6ea95f61062dffdc261099ced29df4560" }, "owner_lane": "", "provenance": { diff --git a/src/.crumb b/src/.crumb index 2ed87b64d..efb50da19 100644 --- a/src/.crumb +++ b/src/.crumb @@ -62,128 +62,128 @@ "children": [ { "digest": "e999ad5d79b28e45cf3c87fca942087088f243bdfd0e55da7948eb5d6e619460", - "last_commit": "7350a61", + "last_commit": "7350a61c", "name": "algebra", "purpose": "Directory src/algebra. Purpose not yet described by a human." }, { "digest": "24b48531671e1ad40c520571c43aa6fa8dfe43ce7139a5724f31afa9f8411afd", - "last_commit": "834ee93", + "last_commit": "834ee93e", "name": "ans", "purpose": "ANS (Alignment Navigation System), Inertial Alignment v1: frozen reference atoms, drift filter o" }, { "digest": "5b110f4a6136ebd3d6703590962b7beed9f8cec034c2d12944b1590434e3c747", - "last_commit": "d48ab89", + "last_commit": "d48ab89e", "name": "autodiff", "purpose": "M21 OMEGA_AUTODIFF: reverse-mode tape over M20 tensor CPU ops, caller-owned nodes and scratch, p" }, { "digest": "18e933f213d7958215bb0ecf09116e5c21d3b335cfdabc1ffbf7a2a4e98b5250", - "last_commit": "f7b4389", + "last_commit": "f7b43890", "name": "compiler", "purpose": "Directory src/compiler. Purpose not yet described by a human." }, { "digest": "41faf68aa92b4f16b40243239e1866110a443ce284ff9f7ec3b125b289bcd845", - "last_commit": "3c82389", + "last_commit": "3c82389f", "name": "crumbline", "purpose": "Directory src/crumbline. Purpose not yet described by a human." }, { "digest": "945ae745a338467614bee287efb628f38f53ad83e4842c1a7fbf7d0b91a8da57", - "last_commit": "00f54b6", + "last_commit": "00f54b6b", "name": "dual_experiment", "purpose": "DUAL applicability experiment library (ARCH-0031 offline evidence lane): deterministic discrete " }, { "digest": "62a0884e7f075eb3c92b22fc400234a06bd8c3020fc75e55a9b0c0f0f6a26d7e", - "last_commit": "1a147e4", + "last_commit": "1a147e40", "name": "estimation", "purpose": "Directory src/estimation. Purpose not yet described by a human." }, { "digest": "330c407ff51bfd684e062707c055f58f325f5af16fe9764889aec3a7ffeb31ac", - "last_commit": "3108fc2", + "last_commit": "3108fc2f", "name": "fabric", "purpose": "Directory src/fabric. Purpose not yet described by a human." }, { "digest": "3bdcb211108a4fdc33550b2c54df3167dd15d4a5fe004eefbcef11b489d0e27a", - "last_commit": "71c6ff8", + "last_commit": "71c6ff88", "name": "language", "purpose": "Directory src/language. Purpose not yet described by a human." }, { - "digest": "bac52a0d2c450354c2862c720e19363d5eb7bed4b5b47615c7ca734a729e1ab7", - "last_commit": "7adf33e", + "digest": "533a65c9091db1180f3effaad24a9e4e18edb019095fbeee72896842256824ae", + "last_commit": "c232f147", "name": "osh", "purpose": "osh (Omega-native shell, arch#158) lexer unit: layout list, generator, osh_lex.osc, C reference " }, { "digest": "8383106b5d1b3adbc44b8e837a5d1f5ff6699a6d54070068e36716b2a32390d5", - "last_commit": "d550b70", + "last_commit": "d550b705", "name": "path", "purpose": "Directory src/path. Purpose not yet described by a human." }, { "digest": "6974fb2a6051d3a1b07153ced8cddc6a81d04a79d229b5c9a18e00f7d2c55d25", - "last_commit": "965edfb", + "last_commit": "965edfbf", "name": "physics0", "purpose": "PD-0 hidden-equation benchmark (Physics-0 Discovery Engine cut 1): world, oracle, scorer, ladder" }, { "digest": "c43b60db4a5183a3ca59c2e24a0978f463e8ac3aa7a2ed0c54947eb085c4eb9e", - "last_commit": "3ef4f69", + "last_commit": "3ef4f69c", "name": "polyglot", "purpose": "Directory src/polyglot. Purpose not yet described by a human." }, { "digest": "98acfce1a1131f63cb89cce389b153d85952ccdcf5f3e0462c080a159b45ec44", - "last_commit": "01f6a74", + "last_commit": "01f6a746", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, { "digest": "9f6d98a6d9b0020aa56df481a5ab3aa301533cb85173f96a851d1d779fca2d3a", - "last_commit": "5ae192a", + "last_commit": "5ae192a4", "name": "searchtrace", "purpose": "Directory src/searchtrace. Purpose not yet described by a human." }, { "digest": "ae63793b7b13442e349e438229fccf6a859a5be55343cdd997e35f2966c1157c", - "last_commit": "f633e34", + "last_commit": "f633e343", "name": "tensor", "purpose": "M20 OMEGA_TENSOR: immutable tensor semantic layer, views, generation-checked storage, CPU realiz" }, { "digest": "be7e624435df81eae403f51a381acf480e9fd2f2a04eb34e955547973645b95d", - "last_commit": "54826a3", + "last_commit": "54826a37", "name": "train", "purpose": "Directory src/train. Purpose not yet described by a human." }, { "digest": "78c180a66607ebaf93e6ef6a6a56a3059ebf97db394d76af50c0e3f25d2be639", - "last_commit": "2564f57", + "last_commit": "2564f57a", "name": "turing", "purpose": "Directory src/turing. Purpose not yet described by a human." }, { "digest": "daf5e5e90c1ccb4c089220a6545844dbe4078a233f1777e8145b74f1bf5dd5fe", - "last_commit": "40d1ea3", + "last_commit": "40d1ea37", "name": "visor", "purpose": "Directory src/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:1fe047c4933784ac25ab5bd834b9677180143f30a22f91432c009878d5a00b97", - "compiled_at": "2026-10-09T04:11:18Z", + "children_root": "sha256:929f3977e499383b95697b8580b85402005a7b084fa4a66f66ca0d1052b99118", + "compiled_at": "2026-10-10T07:03:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:c06c116644765d66e2c7346e99179861cbb7bba7e8e932ff40b6c51983d90d01", + "digest": "sha256:20df1488b5097b3dd816f33ac66fd6adff4c224bcdfcdb0f1f528c9ba15f8294", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 445, - "generated_at_commit": "7adf33efee7b590d919662b54df824f0c2cf2cbf", - "source_tree": "sha256:53cb7c5b9b55f98a01b5efadbc049231a9fbd485731c0d91b84516b3d594e23f" + "generated_at_commit": "c232f14719faa20164d737af494a368061866e83", + "source_tree": "sha256:9372ca100be9726ff75e8f29626894dd76cd26ff38eb838e64d3a5cd9b927fb7" }, "owner_lane": "", "provenance": { diff --git a/src/osh/.crumb b/src/osh/.crumb index 19415bcbd..2beddccb8 100644 --- a/src/osh/.crumb +++ b/src/osh/.crumb @@ -3,21 +3,21 @@ "generated": { "children": [ { - "digest": "6e571ea9d38be544ba34197741022963e7d58b3f264b2992d4a3f266de6a22b6", - "last_commit": "7adf33e", + "digest": "38f6dfb3bf8da056fd3463410dccfd45ca6554e2b41879e2d7f3fdf64d7392ad", + "last_commit": "c232f147", "name": "host", "purpose": "osh Linux host: execution service (request decoder, resolution, builtins, redirections, pipeline" } ], - "children_root": "sha256:f78fa9adb0402a9c251fe3b206c56b23fd698011a51a72cc408479bf20225b66", - "compiled_at": "2026-10-09T04:11:18Z", + "children_root": "sha256:806c9878b9234cb364d70ef8ba6abe25df737141697c2bcbeac26e054e7583aa", + "compiled_at": "2026-10-10T07:03:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:bac52a0d2c450354c2862c720e19363d5eb7bed4b5b47615c7ca734a729e1ab7", + "digest": "sha256:533a65c9091db1180f3effaad24a9e4e18edb019095fbeee72896842256824ae", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 31, - "generated_at_commit": "7adf33efee7b590d919662b54df824f0c2cf2cbf", - "source_tree": "sha256:ad3d00f50624469724e62cc25e76cea9ad20f6eb4027caeace07aa21fcf5fcaf" + "generated_at_commit": "c232f14719faa20164d737af494a368061866e83", + "source_tree": "sha256:3fdf2a33db4e72afbd86eafd246acbb94b27e38bc21c2e63b9e3b0e6523e2cca" } }, "name": "osh", diff --git a/src/osh/host/.crumb b/src/osh/host/.crumb index 82984707b..a95935ea4 100644 --- a/src/osh/host/.crumb +++ b/src/osh/host/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-09T04:11:18Z", + "compiled_at": "2026-10-10T07:03:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:6e571ea9d38be544ba34197741022963e7d58b3f264b2992d4a3f266de6a22b6", + "digest": "sha256:38f6dfb3bf8da056fd3463410dccfd45ca6554e2b41879e2d7f3fdf64d7392ad", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 16, - "generated_at_commit": "7adf33efee7b590d919662b54df824f0c2cf2cbf", - "source_tree": "sha256:ece8557c3e1d5ea71058159fc79f7148e4862e2cd710c12f952f60a3e10d84ca" + "generated_at_commit": "c232f14719faa20164d737af494a368061866e83", + "source_tree": "sha256:c4b1744b1ef3b4033108eb0f9b8939193a5eee3f40e878996d0250d546dfb7de" } }, "name": "host", diff --git a/src/osh/host/osh_builtin.c b/src/osh/host/osh_builtin.c index c2c297edd..849ee86f7 100644 --- a/src/osh/host/osh_builtin.c +++ b/src/osh/host/osh_builtin.c @@ -10,8 +10,9 @@ * numbers strtoimax/strtoumax base 0 (decimal, 0x hex, 0 octal); a leading ' or " gives the next byte's * value; a bad number prints its numeric prefix (or 0), emits a diagnostic, and the status is 1. * %c first byte of the argument, nothing for an empty argument. - * cd: cd [DIR | -]; DIR defaults to $HOME; logical (-L) path handling only: PWD is the lexical result, "." and ".." - * resolved textually; CDPATH is NOT supported; no options. + * cd: cd [-L|-P] [--] [DIR | -]; DIR defaults to $HOME; -L (default): PWD is the lexical result, "." and ".." + * resolved textually; -P: PWD from getcwd; cd "" is a no-op (bash). CDPATH is NOT searched: a relative DIR not + * anchored with ./ or ../ is refused while CDPATH is set (omega#344). */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -105,19 +106,36 @@ static int logical_pwd(const OshSession *s, char *out, size_t cap) static int bi_cd(OshSession *s, const OshCmd *c, const int io[3], int in_parent) { - int show = 0; + int show = 0, physical = 0, i = 1; const char *dir; - if (c->nargv > 2) { osh_diag(io[2], "cd: too many arguments"); return 1; } - if (c->nargv == 1) { + /* options as bash: -L (the default) and -P; "--" ends them; anything else is "invalid option", status 2 */ + for (; i < c->nargv && c->argv[i][0] == '-' && c->argv[i][1]; i++) { + if (strcmp(c->argv[i], "--") == 0) { i++; break; } + for (const char *o = c->argv[i] + 1; *o; o++) { + if (*o == 'L') physical = 0; + else if (*o == 'P') physical = 1; + else { osh_diag(io[2], "cd: -%c: invalid option\ncd: usage: cd [-L|-P] [dir]", *o); return 2; } + } + } + if (c->nargv - i > 1) { osh_diag(io[2], "cd: too many arguments"); return 1; } + if (c->nargv == i) { dir = osh_var_get(s, "HOME"); if (!dir || !*dir) { osh_diag(io[2], "cd: HOME not set"); return 1; } - } else if (strcmp(c->argv[1], "-") == 0) { + } else if (strcmp(c->argv[i], "-") == 0) { dir = osh_var_get(s, "OLDPWD"); if (!dir || !*dir) { osh_diag(io[2], "cd: OLDPWD not set"); return 1; } show = 1; } else { - dir = c->argv[1]; - if (!*dir) { osh_diag(io[2], "cd: %s: No such file or directory", dir); return 1; } + dir = c->argv[i]; + if (!*dir) return 0; /* bash 5.2: cd "" changes nothing and succeeds */ + /* CDPATH is not searched. bash would go to $CDPATH/DIR when that exists, so a relative name that is not + * anchored with ./ or ../ could silently mean a different directory: refuse it while CDPATH is set. */ + const char *cdpath = osh_var_get(s, "CDPATH"); + int anchored = dir[0] == '/' || (dir[0] == '.' && (dir[1] == 0 || dir[1] == '/' || (dir[1] == '.' && (dir[2] == 0 || dir[2] == '/')))); + if (cdpath && *cdpath && !anchored) { + osh_diag(io[2], "cd: %s: CDPATH is set and osh does not search it; use ./%s or an absolute path", dir, dir); + return 1; + } } char old[PATH_MAX], joined[2 * PATH_MAX + 2], cur[PATH_MAX]; if (logical_pwd(s, old, sizeof old)) { osh_diag(io[2], "cd: cannot determine current directory"); return 1; } @@ -133,6 +151,10 @@ static int bi_cd(OshSession *s, const OshCmd *c, const int io[3], int in_parent) if (canon(joined, cur, sizeof cur)) { osh_diag(io[2], "cd: %s: File name too long", dir); return 1; } if (osh_effect_check(s, OSH_OP_CHDIR, cur, io[2]) != OSH_E_OK) return 1; if (chdir(cur) != 0) { osh_diag(io[2], "cd: %s: %s", dir, strerror(errno)); return 1; } + if (physical) { /* -P: PWD is the physical directory with symbolic links resolved; the lexical one if the kernel cannot say */ + char phys[PATH_MAX]; + if (getcwd(phys, sizeof phys)) strcpy(cur, phys); + } /* A child context keeps its own copy of the table, so setting here is safe in both cases. */ (void)in_parent; osh_var_set(s, "OLDPWD", old); @@ -359,7 +381,7 @@ static int bi_unset(OshSession *s, const OshCmd *c, const int io[3]) return 2; } for (; i < c->nargv; i++) { - if (!osh_name_valid(c->argv[i])) { osh_diag(io[2], "unset: '%s': not a valid identifier", c->argv[i]); status = 1; continue; } + if (!osh_name_valid(c->argv[i])) continue; /* bash 5.2: unset of a non-identifier is silent and succeeds (omega#344) */ osh_var_unset(s, c->argv[i]); } return status; diff --git a/src/osh/host/osh_exec.c b/src/osh/host/osh_exec.c index c89690196..3c4f82391 100644 --- a/src/osh/host/osh_exec.c +++ b/src/osh/host/osh_exec.c @@ -13,7 +13,7 @@ * bare names are not found (127); process-global environ is never consulted after osh_session_init. An empty * element means the current directory (POSIX). Names containing '/' are used as given, never searched. * - Statuses: not found 127; found but not executable, a directory, or execve refused (including ENOEXEC: a script - * without a shebang is NOT run through sh) 126; killed by signal 128+n. + * without a shebang is NOT run through sh) 126; killed by signal 128+n, with a "Name (signal n)" line on stderr except for SIGINT and SIGPIPE (bash prints "Killed" and "Terminated" too). * - STOPPED MEMBERS (no job control in R1): the wait loop notices a stop of ANY member (SIGSTOP, SIGTSTP, ...), sends * SIGKILL to the pipeline (killpg when it has its own group, else to each unreaped member), reaps all, writes a * diagnostic, and the pipeline status is 128+stopsig of the first member seen stopped. The stopped member is @@ -547,6 +547,27 @@ static int wait_all(OshSession *s, OshResult *res, Child *ch, int n, pid_t pgid, return first_stop; } +/* bash's "Killed" / "Terminated" line for a member that died of a signal (omega#344 RISK-8); SIGINT and SIGPIPE + * stay silent, as in bash. */ +static const char *signame(int sig) +{ + switch (sig) { + case SIGHUP: return "Hangup"; + case SIGQUIT: return "Quit"; + case SIGILL: return "Illegal instruction"; + case SIGABRT: return "Aborted"; + case SIGBUS: return "Bus error"; + case SIGFPE: return "Floating point exception"; + case SIGKILL: return "Killed"; + case SIGSEGV: return "Segmentation fault"; + case SIGTERM: return "Terminated"; + case SIGUSR1: return "User defined signal 1"; + case SIGUSR2: return "User defined signal 2"; + case SIGALRM: return "Alarm clock"; + default: return "Signal"; + } +} + static void run_pipeline(OshSession *s, const OshRequest *r, JCtx *jc, OshResult *res) { int n = r->ncmds; @@ -710,6 +731,11 @@ static void run_pipeline(OshSession *s, const OshRequest *r, JCtx *jc, OshResult if (s->after_launch_hook) s->after_launch_hook(s->after_launch_ctx); int stopsig = wait_all(s, res, ch, n, pgid, own_pg); if (tty) tcsetpgrp(s->tty_fd, getpgrp()); + for (int i = 0; i < n; i++) { + const OshCmdResult *cr = &res->cmd[i]; + if (cr->outcome == OSH_OUT_COMPLETED && cr->termsig && cr->termsig != SIGINT && cr->termsig != SIGPIPE) + osh_diag(s->fd[2], "%s: %s (signal %d)", r->cmd[i].nargv > 0 ? r->cmd[i].argv[0] : "?", signame(cr->termsig), cr->termsig); + } res->status = stopsig ? 128 + stopsig : res->cmd[n - 1].status; for (int i = 0; i < n; i++) if (res->cmd[i].err != OSH_E_OK && res->cmd[i].err != OSH_E_NOT_FOUND && res->err == OSH_E_OK) res->err = res->cmd[i].err; diff --git a/tests/.crumb b/tests/.crumb index 1b8d062eb..641e0dbe5 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -199,8 +199,8 @@ "purpose": "Simulated M16 driver for numeric resource-lifecycle tests. No device execution or numeric parity" }, { - "digest": "28f6692284fe7212911bd3b34371abcade37106df0f3fc1879c7e283259a660d", - "last_commit": "19f73c70", + "digest": "cfe2153fbe174096ed94d42ab23fe87a7a0587913166d0ea3fe8636c26f6aaa3", + "last_commit": "c232f147", "name": "osh", "purpose": "osh lexer host driver, vendored aien-protocols PR#16 draft vectors (5ae5292)" }, @@ -212,7 +212,7 @@ }, { "digest": "fe59556d80381a125c896f9667229e57743f21b224e1bfc4195f6d7998cb9531", - "last_commit": "63079ac5", + "last_commit": "fbc58ab6", "name": "physics0", "purpose": "PD-0 gates: world self-test, oracle calibration, learner L0/L1/NULL, mutations, OSC differential" }, @@ -289,15 +289,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:712eea8a72ff83795cb69b3070f792ccbb5d64b6992acfc4ee3379ba916ff1c3", - "compiled_at": "2026-10-10T06:00:18Z", + "children_root": "sha256:cfe7652a1025666e2b3abc661c0dd027a504e6b9b3bf009186deca93ed177095", + "compiled_at": "2026-10-10T07:03:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:ab439a7b4cb25cc9b3169441a99613e076152c3eaf12f976a24fafdc13a2dda5", + "digest": "sha256:4405dd867c07c00ecd36438d84cdc032964cbb602acf0e7879e7d04c1b0f0306", "evidence_files": 11, "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2", "files": 948, - "generated_at_commit": "0d5b3f2d3e1273587c8c206ac14ea67b551e52e4", - "source_tree": "sha256:1bb6b108cb5571ef0aac7766760617bb0c8bf2b91994a585bdf393411040a7fa" + "generated_at_commit": "c232f14719faa20164d737af494a368061866e83", + "source_tree": "sha256:17ae5796613d62944c9feba7d19078ccdf76aa1c165b29e324d68433e0f0e31a" }, "owner_lane": "", "provenance": { diff --git a/tests/osh/.crumb b/tests/osh/.crumb index ee116a851..5d6664f6b 100644 --- a/tests/osh/.crumb +++ b/tests/osh/.crumb @@ -4,32 +4,32 @@ "children": [ { "digest": "97c53eecc61307ddcd838ba005820fa8091ea06d97ad6427776a141a0616c1a1", - "last_commit": "b37592b", + "last_commit": "b37592b3", "name": "e2e", "purpose": "end-to-end tests of the osh program: argprint helper plus a runner comparing native and OSH_INTE" }, { - "digest": "42ff361ad0a9e05937e60d330e1bffaaf647fb0424ed103766d1989b7f2c0804", - "last_commit": "d2ab554", + "digest": "8cafcafd34533ed60a6372202a13b33e562488f7c39a92e9a6739888dda2ecb2", + "last_commit": "c232f147", "name": "host", "purpose": "tests for the osh Linux host adapter execution service (hand-built request records, helper-mode " }, { "digest": "27e4840c198f9b3f0d6acdcb5a279124a157199ab42632d4be18c79e9ac1b5cd", - "last_commit": "4cc3bdd", + "last_commit": "4cc3bdda", "name": "trace", "purpose": "Core-only step traces of the osh shell units over fixture scripts (OSH-AIENOS-0 differential fix" } ], - "children_root": "sha256:f3d920a90abfbae3f25e8a1dbe149b3fa026bb75d9080304a23e25103bf7dfbe", - "compiled_at": "2026-10-09T21:50:08Z", + "children_root": "sha256:5c1280781d81ea21dd8624affb5a98559ef526f34e8b2e3408de11457d5e3364", + "compiled_at": "2026-10-10T07:03:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:28f6692284fe7212911bd3b34371abcade37106df0f3fc1879c7e283259a660d", + "digest": "sha256:cfe2153fbe174096ed94d42ab23fe87a7a0587913166d0ea3fe8636c26f6aaa3", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 93, - "generated_at_commit": "d2ab554be81f4f7d7506afab8a6cfc9a0db64a27", - "source_tree": "sha256:027232267f338bd2001a0e7eb31631f315a0cdcd2e423dc7eacfc662842aae52" + "generated_at_commit": "c232f14719faa20164d737af494a368061866e83", + "source_tree": "sha256:627213beac2cb555eff2b8555b6cdefa8f1c7146ac399c7b6210230de3b1dc82" } }, "name": "osh-tests", diff --git a/tests/osh/host/.crumb b/tests/osh/host/.crumb index e19e66e09..2f015347f 100644 --- a/tests/osh/host/.crumb +++ b/tests/osh/host/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-09T21:50:08Z", + "compiled_at": "2026-10-10T07:03:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:42ff361ad0a9e05937e60d330e1bffaaf647fb0424ed103766d1989b7f2c0804", + "digest": "sha256:8cafcafd34533ed60a6372202a13b33e562488f7c39a92e9a6739888dda2ecb2", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 3, - "generated_at_commit": "d2ab554be81f4f7d7506afab8a6cfc9a0db64a27", - "source_tree": "sha256:7f5e59dff1e027b6bad0cc585cf1dcae1342ac220f21d4a0880c0e7ebc3244d1" + "generated_at_commit": "c232f14719faa20164d737af494a368061866e83", + "source_tree": "sha256:eb592378cb5f1792745dad3c1e4007ac2432c2ec8b39ad0c79b76e049591ebf9" } }, "name": "host-tests", diff --git a/tests/osh/host/test_osh_host.c b/tests/osh/host/test_osh_host.c index 3af14b25a..a5667bf29 100644 --- a/tests/osh/host/test_osh_host.c +++ b/tests/osh/host/test_osh_host.c @@ -37,6 +37,12 @@ static unsigned char gen_byte(unsigned long i) { return (unsigned char)((i * 265 static int helper_main(int argc, char **argv) { const char *op = argc > 2 ? argv[2] : ""; + if (!strcmp(op, "die")) { /* die of a signal (omega#344 RISK-8 tests) */ + int sig = argc > 3 ? atoi(argv[3]) : SIGTERM; + signal(sig, SIG_DFL); + raise(sig); + return 99; + } if (!strcmp(op, "echo")) { for (int i = 3; i < argc; i++) printf("%s%s", i > 3 ? " " : "", argv[i]); printf("\n"); @@ -431,6 +437,77 @@ static void test_builtins(void) cmd(b, OSH_B_CD, "cd", P("absent-dir"), NULL); CHECK(go(&t, b, &r) == 1 && strcmp(osh_var_get(&t.s, "PWD"), P("d1")) == 0, "failed cd keeps PWD"); + /* omega#344 RISK-3 and NITs: cd -L, -P, --, invalid option, cd "", CDPATH refusal */ + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "-L", P("d1/sub"), NULL); + CHECK(go(&t, b, &r) == 0 && strcmp(osh_var_get(&t.s, "PWD"), P("d1/sub")) == 0, "cd -L DIR"); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "--", P("d1"), NULL); + CHECK(go(&t, b, &r) == 0 && strcmp(osh_var_get(&t.s, "PWD"), P("d1")) == 0, "cd -- DIR"); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "-P", P("d1/sub"), NULL); + { + char phys[PATH_MAX]; + CHECK(go(&t, b, &r) == 0 && getcwd(phys, sizeof phys) && strcmp(osh_var_get(&t.s, "PWD"), phys) == 0, "cd -P sets PWD to the physical directory"); + } + t_clear(&t); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "-x", P("d1"), NULL); + CHECK(go(&t, b, &r) == 2, "cd -x is an invalid option, status 2"); + o = t_err(&t); + CHECK(strstr(o, "cd: -x: invalid option") != NULL, "cd -x diagnostic, got '%s'", o); + free(o); + { + char keep[PATH_MAX]; + snprintf(keep, sizeof keep, "%s", osh_var_get(&t.s, "PWD")); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "", NULL); + CHECK(go(&t, b, &r) == 0 && strcmp(osh_var_get(&t.s, "PWD"), keep) == 0, "cd \"\" is a no-op with status 0"); + } + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", P("d1"), NULL); + go(&t, b, &r); + osh_var_set(&t.s, "CDPATH", P("absent-dir")); + t_clear(&t); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "sub", NULL); + CHECK(go(&t, b, &r) == 1 && strcmp(osh_var_get(&t.s, "PWD"), P("d1")) == 0, "relative cd refused while CDPATH is set"); + o = t_err(&t); + CHECK(strstr(o, "CDPATH is set") != NULL, "CDPATH diagnostic, got '%s'", o); + free(o); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", "./sub", NULL); + CHECK(go(&t, b, &r) == 0 && strcmp(osh_var_get(&t.s, "PWD"), P("d1/sub")) == 0, "anchored ./sub still works with CDPATH set"); + osh_var_unset(&t.s, "CDPATH"); + b = nb(0, 0); + cmd(b, OSH_B_CD, "cd", P("d1"), NULL); + go(&t, b, &r); + + /* omega#344 NIT: bash 5.2 returns 0 and says nothing for unset of a non-identifier */ + t_clear(&t); + b = nb(0, 0); + cmd(b, OSH_B_UNSET, "unset", "1x", NULL); + CHECK(go(&t, b, &r) == 0, "unset 1x succeeds as in bash"); + o = t_err(&t); + CHECK(o[0] == 0, "unset 1x is silent, got '%s'", o); + free(o); + + /* omega#344 RISK-8: a member killed by a signal gets a message, except SIGINT and SIGPIPE */ + t_clear(&t); + b = nb(0, 0); + helper(b, "die", "15", NULL); + CHECK(go(&t, b, &r) == 143 && r.cmd[0].termsig == SIGTERM, "SIGTERM death is status 143, got %d", r.status); + o = t_err(&t); + CHECK(strstr(o, "Terminated (signal 15)") != NULL, "Terminated message, got '%s'", o); + free(o); + t_clear(&t); + b = nb(0, 0); + helper(b, "die", "13", NULL); + CHECK(go(&t, b, &r) == 141, "SIGPIPE death is status 141, got %d", r.status); + o = t_err(&t); + CHECK(o[0] == 0, "SIGPIPE death stays silent, got '%s'", o); + free(o); + /* export / unset in parent; exported reaches children, unexported does not */ b = nb(0, 0); cmd(b, OSH_B_EXPORT, "export", "XA=1", "XB", NULL); ```