Repository navigation
test: lake: remoteExec, usageCutoffCrossTree, cacheInsertPartial as CI runs them - #7
Conversation
…I runs them
Three Lake tests failed in the job "build / Linux release" on the tag
v4.36-machcsl-r20 for defects of the tests, not of Lake.
remoteExec and usageCutoffCrossTree copy checked-in files with `cp` and then
edit the copies. `cp` keeps the mode of the source, and CI's step "Protect
Source Tree" makes every tracked file read-only, so the edit failed:
./test.sh: line 168: .../remoteExec/work/failed/Rx/B.lean: Permission denied
./test.sh: line 144: t2/lakefile.toml: Permission denied
The copies are now made writable, as `copy_to_work` in common.sh and `enter`
in remoteExec's test.sh make theirs.
cacheInsertPartial's preload (NoHardLink.c) replaced libuv's `uv_fs_link`
and `uv_fs_stat`. A release build links libuv statically into
libleanshared.so, with -Bsymbolic, so the runtime's calls of these functions
bind inside that library and the preload never ran: on the tag the hard link
into the cache succeeded, and the test found no "d2c4f49280adf1f1.art: not
cached" line. The preload now replaces the C library's `link`, which libuv's
`uv_fs_link` calls, and `syscall` for `statx`, which libuv's `uv_fs_stat`
calls; a process calls the C library through the dynamic linker, so the
preload takes these calls in a release as in any other build. The test's
cases and expectations are unchanged. fork/v4.36-lake-cache-insert carries
the same NoHardLink.c and gets the same change.
Part of LINUX-1736.
Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
…ntegration The heads of the pull requests that make r21's CI member and its -r21 copies, merged on the first integration commit: #6 (the CI member, on the trunk), #7 (remoteExec, usageCutoffCrossTree and cacheInsertPartial in the service-mode member), #8 (cacheInsertPartial in the cache-insert member), #9 (ccIdentity), #10 and #11 (usageCutoffCrossTree in the two pack members) and #12 (the Windows declaration in the lazy-import-names member). The merge needs no resolution: its tree is the first integration commit's tree with each pull request's change, and where two of them make the same change (usageCutoffCrossTree's writable lakefile, cacheInsertPartial's preload) that change once. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
…and holds libc stat Review of the previous commit found two defects in NoHardLink.c, the preload of cacheInsertPartial: - Its `syscall` read six `long` arguments with `va_arg` for every call, whatever the number: undefined behavior for a call with fewer arguments (libuv calls it with three for getrandom) or with other types (statx passes `int`s and pointers). - It held only libuv's `syscall(SYS_statx, ...)`. Where statx fails with ENOSYS or EPERM (an old kernel, a seccomp filter), libuv calls the C library's `stat` instead, and the barrier of the writer-race case was never reached. `syscall` is now a few instructions, for x86-64 and aarch64, that read no argument and leave the argument registers and the stack as the caller set them: for SYS_statx they jump to a C function whose parameters are the five arguments of libuv's `uv__statx` with their types (int, const char *, int, unsigned int, buffer), which holds the barrier or calls the C library's `syscall` with exactly those; for any other number they jump to the C library's `syscall`. On both processors a variadic call passes integer and pointer arguments as a prototyped call does, so the jumps are defined by the calling convention. The C library's `syscall` is looked up at the first call, with the argument registers saved, since another library's constructor can call `syscall` before this preload's would run. The barrier also holds the C library's entry points that libuv's fallback can reach, each with its own parameter types and each forwarding to the C library's definition: `stat`, `stat64`, `fstatat`, `fstatat64` and `statx` (glibc 2.28 and 2.33 on), and `__xstat`, `__xstat64`, `__fxstatat` and `__fxstatat64`, which a library built against glibc before 2.33 calls (the release builds against glibc 2.26), found by their glibc symbol version. The comment on hard links now names only the path it covers: Lean's `IO.FS.hardLink` calls libuv's synchronous `uv_fs_link`, which calls `link`. test.sh is unchanged: every case and assertion stays. Checked with gcc 15 and glibc 2.43 on x86-64: the preload builds with `-Wall -Wextra -Werror` (also at `-O2 -D_FORTIFY_SOURCE=2`). A driver holds `syscall(SYS_statx, ...)`, `stat`, `stat64`, `fstatat`, `fstatat64`, `statx` and the versioned `__xstat`, `__xstat64`, `__fxstatat` and `__fxstatat64` for the barrier's path and passes other paths through, as it does `syscall` for mmap (six arguments), getrandom and getpid, also from a constructor that runs before the preload's; `link` fails for the chosen prefix only. libuv 1.48.0, linked into a shared library with -Bsymbolic as in a release, gives ENOENT for the barrier's path on the statx route and, with statx refused by a seccomp filter, on its fallback to `stat`. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
…tion The new heads of three pull requests after their review, merged on the previous integration commit: #6 (the CI member: `release_tag` is checked in the one step that reads it and later steps read a Boolean), #7 and #8 (cacheInsertPartial's preload forwards `syscall` without reading its arguments and holds the C library's stat entry points too). The merge needs no resolution: its tree is the previous integration commit's tree with the two changed files of these pull requests. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
…jump to null Three points of the review of the previous commit, all in NoHardLink.c, the preload of cacheInsertPartial; test.sh is unchanged. - The versioned lookups of the pre-2.33 glibc names use `dlvsym`, which only glibc has, so the preload no longer compiled against musl. They now use it under `__GLIBC__` only, and `dlsym` otherwise (where those names do not exist, and the call fails with ENOSYS as for any missing definition). - The hooks of the `stat` family and the function types they call through took `void *` buffers, so those types did not match the C library's. The file now declares `struct stat`, `struct stat64` and `struct statx` without defining them, and each hook and type takes its own one; the file still includes no <sys/stat.h>. - If `dlsym(RTLD_NEXT, "syscall")` found nothing, the statx helper called address zero and the `syscall` instructions jumped to it. Both now go to `nhl_syscall_missing`, which sets errno to ENOSYS and returns -1. Checked with gcc 15 and glibc 2.43 on x86-64: the preload builds with `-Wall -Wextra -Werror` (also at `-O2 -D_FORTIFY_SOURCE=2`), and against the headers of musl 1.2.5 too; the driver of the previous commit and the libuv 1.48.0 test (statx route and, under a seccomp filter, the fallback to `stat`) give the same results. A test build whose lookup of `syscall` finds nothing makes `syscall` return -1 with ENOSYS, on the first call and later ones, and in the statx helper, while the barrier still holds its path. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
…ation The new heads of #7 and #8 (cacheInsertPartial's preload: a musl build, the stat structs' own pointer types, and no jump to address zero when the C library's `syscall` cannot be found), merged on the previous integration commit. The merge needs no resolution: its tree is the previous one with the one changed file of these pull requests. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
|
Review pass by a reviewer of another model family (openai/gpt-6.2-sol), read-only, against the change's rules: a test changes only to fix its own defect, never to skip, exclude or loosen it.
|
…out compgen
The rehearsal of the tag build (CI's Linux release and Linux aarch64 jobs)
failed the test remoteExec in three of its groups.
`native` and `digests`: the link of a module's shared library on the build
service stopped with
ld: cannot find -lc++ ... cannot find -lc++abi ... cannot find -luv
The service links with `LAKE_REMOTE_EXEC_CC` and Lean's own link flags,
which name `-lc++`, `-lc++abi`, `-luv`, `-lgmp`, `-lssl` and `-lcrypto`.
A standalone toolchain (a release, or CI's build/stage2) keeps those as
static archives in `<sysroot>/lib`, and a local link with the bundled
compiler finds them there (its internal flags pass `-L <sysroot>/lib`). The
service's request passed only `-L <sysroot>/lib/lean`, so the link found
them only where the service's compiler had them itself: on the machines
where the test passed, the system has libuv and the toolchain links the
system's C++ library, while CI's compiler (Nix's, run with `PATH` as its
whole environment) has none of them. The request's link now also passes
`-L <sysroot>/lib`, after `-L <sysroot>/lib/lean`; the README and the doc
comment of `NativeAction.request` say where a link searches. The link
command changes, so the actions of native links have new digests.
`base`: the test waited for the fake's slow write with `compgen -G`, a
builtin that a bash built without programmable completion lacks (Nix's
bash, which CI's shell runs: "compgen: command not found" at test.sh:543).
The two helpers now test the glob with `[ -e ]`. Every case and assertion
of the test stays.
Part of LINUX-1736.
Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
The new head of #7 (a service link also searches the sysroot's `lib`, where a standalone toolchain keeps the static libraries Lean's link flags name; remoteExec's helpers test a glob without `compgen`), merged on the previous integration commit. The merge needs no resolution: its tree is the previous one with the three changed files of #7's new commit. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
|
Review pass, round 4 (openai/gpt-6.2-sol, read-only) of the new commit after the tag-build rehearsal.
|
The second rehearsal of the tag build (CI's Linux aarch64 job) failed the
test remoteExec in row N11 (cases/native.sh:272), at the row's first build,
which runs under the fallback `local` while the service does not answer.
The local link of Nat0.Tac's module library stopped with
ld: cannot find -lc++ ... cannot find -lc++abi
The row's local C compiler is LEAN_CC, a script that runs
`LAKE_REMOTE_EXEC_CC -g`. Lake gives a LEAN_CC compiler Lean's link
flags, which name `-lc++`, `-lc++abi`, `-lgmp`, `-luv`, `-lssl` and
`-lcrypto`, with only `-L <sysroot>/lib/lean`: the `-L <sysroot>/lib` of
the internal linker flags is for Lean's own compiler only, in Lake as in
leanc. A standalone toolchain (CI's build/stage2) keeps those libraries
as static archives in `<sysroot>/lib`, where CI's `cc` (Nix's) does not
look. Where the test passed, the toolchain links the system's C++ library
and the system has the others.
The script now also passes `-L <sysroot>/lib` (LAKE_REMOTE_EXEC_SYSROOT's,
which the service's links search since the previous commit). So do the
two other local compilers of the group that link a library here: row
N15's (the module libraries built under the fallback) and row N17's
(Nat0's library outside the input root). On CI the group stopped at N11,
so rows N12 to N19 did not run. Row N14's script only compiles (its link
goes to the service), and no other row's runs a local link. No case,
assertion or expectation changes.
Part of LINUX-1736.
Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
…egration Three test-only commits for the rows of remoteExec that failed on CI's toolchain in the second rehearsal, merged on the previous integration commit with no resolution: - #7's new head: the LEAN_CC scripts of rows N11, N15 and N17 pass the toolchain's lib directory, where its static libraries are. - Two follow-ups of the release resolution (branch provisional/l1736-resolution-followups): N15's fresh tree compiles with the service's compiler, and N14 and N15 keep one local C compiler for every build of a row's tree; the second records the r21 choice that a service-mode object's trace keeps the local compiler's flags. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
|
Review pass, round 5 (openai/gpt-6.2-sol, a reviewer of another model family, read-only) of head
|
…y run
Review of the previous commit found that the LEAN_CC scripts of rows N11,
N15 and N17 had the sysroot's library directory written into their
source by `printf`, and so had the service's compiler and N17's log
file: a `$` or a `"` in such a path would change how the script parses.
The scripts now expand the exported LAKE_REMOTE_EXEC_CC and
LAKE_REMOTE_EXEC_SYSROOT when they run, and N17's script writes its log
beside its own directory (`${0%/*}/../N17.cc.log`, the same file as
before). The variable LOCAL_CC_LIB goes; its comment now describes the
scripts. No case or assertion changes.
Part of LINUX-1736.
Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
The previous commit made the compiler scripts of rows N11, N15 and N17
expand their paths when they run. The other scripts and sources that the
test generates had the same defect: a path written into their source by
`printf` or an unquoted here-document, where a `$` or a `"` in the path
would change how the source parses. They are:
- the compiler scripts of row N3 (its log), of row N14 (its down file and
the service's compiler) and of D1 in cases/digests.sh (the service's
compiler);
- test.sh's fork bridge (the fake's path);
- the environment file that row S3's bridge sources in cases/probe.sh
(TMPDIR);
- row N15's Nat0/Slow.lean, whose `#eval` had the fake's down file and
log as string literals.
The scripts now expand exported variables when they run
(LAKE_REMOTE_EXEC_CC, BRIDGES), or find their files beside their own
directory (`${0%/*}`). Slow.lean reads FAKE_DOWN_FILE and FAKE_LOG from
the environment of its compile. No case or assertion changes.
Part of LINUX-1736.
Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
… into the provisional integration #7's two new commits and the release resolution's third follow-up (branch provisional/l1736-resolution-followups): every script or source file that remoteExec generates expands its paths when it runs instead of having them written into its text, so a path holding a space, `$` or a quote no longer changes how it parses. Merged on the previous integration commit with no resolution; the change is the one the gate and CI-like runs tested. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
|
Review pass, round 6 (openai/gpt-6.2-sol, a reviewer of another model family, read-only) of head
|
|
Release rehearsal: run 46160867934 passed on integration commit |
0e3c245
into
fork/v4.36-lake-remote-fallback-flat-r21
Three Lake tests failed in the job "build / Linux release" on the tag
v4.36-machcsl-r20 for defects of the tests, not of Lake.
remoteExec and usageCutoffCrossTree copy checked-in files with
cpand thenedit the copies.
cpkeeps the mode of the source, and CI's step "ProtectSource Tree" makes every tracked file read-only, so the edit failed:
The copies are now made writable, as
copy_to_workin common.sh andenterin remoteExec's test.sh make theirs.
cacheInsertPartial's preload (NoHardLink.c) replaced libuv's
uv_fs_linkand
uv_fs_stat. A release build links libuv statically intolibleanshared.so, with -Bsymbolic, so the runtime's calls of these functions
bind inside that library and the preload never ran: on the tag the hard link
into the cache succeeded, and the test found no "d2c4f49280adf1f1.art: not
cached" line. The preload now replaces the C library's
link, which libuv'suv_fs_linkcalls, andsyscallforstatx, which libuv'suv_fs_statcalls; a process calls the C library through the dynamic linker, so the
preload takes these calls in a release as in any other build. The test's
cases and expectations are unchanged. fork/v4.36-lake-cache-insert carries
the same NoHardLink.c and gets the same change.
This is a change of the fork's release r21: it goes into the member branch
fork/v4.36-lake-remote-fallback-flat-r21, which r21 merges in place of the member it copies. It merges as a squash after its review, when r21 is cut.After its review, two more commits change cacheInsertPartial's preload:
syscallis an x86-64/aarch64 entry that reads no argument and sends onlystatxto a typed function; typed hooks hold the C library's stat entry points too (libuv's fallback whenstatxfails);dlvsymonly with glibc; no jump to address zero when the C library'ssyscallcannot be found.After the tag-build rehearsal, one more commit: a build-service link of a module's shared library also searches the sysroot's
lib(Lake'sNativeAction.request), where a standalone toolchain keeps the static libraries that Lean's link flags name, and remoteExec's helpers test a glob withoutcompgen, which CI's bash lacks.After the second rehearsal, three test-only commits: the
LEAN_CCscripts of rows N11, N15 and N17 also pass the toolchain'slibdirectory, where a standalone toolchain keeps the static libraries Lean's link flags name; and every script or source file remoteExec generates reads its paths when it runs instead of having them written into its text.Why this pull request's own
build / Linux releaseis red: the job at1a9633e3stops atUpload Lake Cachebefore any test runs. Its member branch uses upstream's workflow, and this fork has no Lake cache endpoint or key. The CI member (#6) fixes the upload step and removesLEAN_GITHASHfrom the test environment. This pull request needs a passing rehearsal on the release's combined tree before it merges.Dispatch: LINUX-1736