Skip to content

Commit 26b21d8

Browse files
committed
Bump to v0.99.3: handle getcwd return on Ubuntu glibc
Real fix for the ubuntu-latest CI failure that v0.99.1 / v0.99.2 diagnostic plumbing surfaced: Ubuntu's glibc declares getcwd with warn_unused_result, so the existing line in main.c getcwd(initial_dir, sizeof(initial_dir)); trips -Werror=unused-result. Capture the result and clear initial_dir on failure -- best-effort so the rest of the binary still launches if the lookup fails.
1 parent 4ced728 commit 26b21d8

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## v0.99.3
4+
5+
Handle `getcwd`'s return value in `main.c`. Ubuntu's glibc declares
6+
`getcwd` with `__attribute__((warn_unused_result))` and the
7+
bootstrap `CFLAGS` treat `unused-result` as an error, so the
8+
ignored-call line tipped over `-Werror=unused-result` on the
9+
ubuntu-latest runner. The macOS runner's libc declares the function
10+
without the attribute, so the same source compiled cleanly there
11+
and the regression went unnoticed locally on a gcc-14 + Debian
12+
glibc box where the attribute also doesn't fire. Fix is to capture
13+
the result and clear `initial_dir` on failure -- best-effort, so
14+
the rest of the binary still launches if the cwd lookup fails.
15+
316
## v0.99.2
417

518
CI follow-up to v0.99.1: also upload the captured build log as a

main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,14 @@ int main(int argc, char **argv)
720720
return exec_companion("mino-lsp", argv + first);
721721
}
722722

723-
getcwd(initial_dir, sizeof(initial_dir));
723+
/* Best-effort: clear the buffer if getcwd fails so any subsequent
724+
* use of initial_dir reads as the empty path rather than as
725+
* uninitialised stack. Ubuntu glibc declares getcwd with the
726+
* `warn_unused_result` attribute and the bootstrap CFLAGS treat
727+
* unused-result as an error. */
728+
if (getcwd(initial_dir, sizeof(initial_dir)) == NULL) {
729+
initial_dir[0] = '\0';
730+
}
724731

725732
/* Compute binary_dir from argv[0] for finding bundled lib/. */
726733
{

src/mino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
#define MINO_VERSION_MAJOR 0
2929
#define MINO_VERSION_MINOR 99
30-
#define MINO_VERSION_PATCH 2
30+
#define MINO_VERSION_PATCH 3
3131

3232
/*
3333
* Human-readable version string of the *linked* runtime, e.g. "0.48.0".

0 commit comments

Comments
 (0)