Skip to content

Commit cd719e6

Browse files
0.4.0 — repin the C library, which no longer answers a question with another one's answer (#10)
* 0.4.0 --- repin the C library, which no longer answers a question with another one's answer openkal-musl 0.7.0. Nothing in this package changes: it names the C library and the C library named the specification, so what moves is one line. What the consumers of this package get is measured rather than asserted. The same `std::filesystem` program, run over this stack and over the host's own toolchain, now agrees row for row where it did not: stat on a node naming another was a link, is what the name refers to is_regular_file on the same was false for bytes it could read file_size on the same was refused exists on one naming nothing was true is_directory in an enumeration was false for one naming a directory copy of a tree holding one was ENOSYS; one such node made a whole tree uncopyable readlink was ENOSYS equivalent of two different files was TRUE, with no error and `signal(SIGABRT, …)`, which any terminal library, death test or crash reporter performs before it does anything else, no longer ends the program. * README: the versions it names are the versions that exist Every README here opens by showing what a program writes in its manifest, which is the first thing a reader copies and the last thing anyone edits. These lines had drifted --- the specification's own README asked for a version four minor releases old --- and nothing checked them. `openkal/tools/check-readme-versions.sh` now does. * test: the operation that was a refusal and is now an operation examples/cxx asserted that creating a symbolic link is refused. openkal 0.9 added kal_fs_link_create, openkal-musl 0.7 answers symlinkat with it, and the refusal stopped arriving -- so this failed, which is the good case. An assertion that had merely tolerated both answers would have made the arrival of the operation invisible here, and this file is the only place in the ecosystem where a C++ standard library exercises it. The link is now created, read back, and asked about both ways: an enquiry that does not resolve reports the link, one that resolves reports the file, and the size read through it is the file's. Writing that produced a failure of its own worth recording. The target was first spelled `dir / "a.txt"', which looks more careful than `"a.txt"' and is wrong: a link's content is resolved relative to the directory holding the link, so it named cxx-probe.d/cxx-probe.d/a.txt and dangled. Three assertions failed against a port that was answering correctly. --------- Co-authored-by: speak-agent <x.d2learn.org@gmail.com>
1 parent 81a6c04 commit cd719e6

3 files changed

Lines changed: 46 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ C library.
66

77
```toml
88
[dependencies]
9-
openkal-llvm-runtime = "0.3.1"
9+
openkal-llvm-runtime = "0.4.0"
1010
```
1111

1212
A C++ standard library is not portable in the way a program is. It is

examples/cxx/src/main.cpp

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,60 @@ int main() {
9494
check(fs::file_size(dir / "b.txt", ec) == 10 && !ec,
9595
"and the copy has the same size");
9696

97-
// ⭐⭐ AND THE TWO OPERATIONS openkal HAS NO ATOM FOR, CHECKED AS REFUSALS.
97+
// ⭐⭐ AND THE OPERATION openkal HAS NO ATOM FOR, CHECKED AS A REFUSAL.
9898
//
99-
// `kal_node_info` carries a boolean `writable` and not a mode word, and
100-
// SURFACE.txt has no operation that creates a symbolic link. openkal-musl
101-
// therefore refuses `chmod` and `symlink` rather than succeeding and
102-
// reporting something else afterwards --- and a refusal that arrives as a
99+
// `kal_node_info` carries a boolean `writable` and not a mode word, so
100+
// openkal-musl refuses `chmod` rather than succeeding and reporting
101+
// something else afterwards --- and a refusal that arrives as a
103102
// `std::error_code` is what a C++ caller can act upon.
104103
//
105104
// ⚠️ THIS IS THE HALF THAT WOULD BE OMITTED. A probe checking only that the
106105
// supported operations work would pass just as well for a port that
107-
// silently accepted these two, which is the outcome the report
106+
// silently accepted it, which is the outcome the report
108107
// (openkal-linux#13) described as "expected 0600, got 0777".
109108
ec.clear();
110109
fs::permissions(dir / "a.txt", fs::perms::owner_read, ec);
111110
check(static_cast<bool>(ec), "changing permission bits is refused, not ignored");
112111

112+
// ⭐⭐ AND THE ONE THAT WAS A REFUSAL AND IS NOW AN OPERATION.
113+
//
114+
// This block read `create_symlink ... check(ec)` --- a link was refused,
115+
// and the refusal was the assertion. openkal 0.9 added `kal_fs_link_create`
116+
// and `kal_fs_link_read`, openkal-musl 0.7 answers `symlinkat` and
117+
// `readlinkat` with them, and the refusal stopped arriving.
118+
//
119+
// ⚠️ A TEST THAT ASSERTS A LIMITATION BECOMES FALSE WHEN THE LIMITATION IS
120+
// LIFTED, AND IT FAILS RATHER THAN GOING QUIET. That is the good case and
121+
// it is why the assertion was written this way round: had it merely
122+
// tolerated both answers, the arrival of the operation would have been
123+
// invisible here, and this file is the only place in the ecosystem where a
124+
// C++ standard library exercises it.
125+
// ⚠️ THE TARGET IS `a.txt' AND NOT `dir / "a.txt"'. A link's content is
126+
// resolved relative to the directory HOLDING THE LINK, not to the working
127+
// directory --- so the second spelling, which looks more careful, produces
128+
// `cxx-probe.d/cxx-probe.d/a.txt' and a dangling link. It was written that
129+
// way here first, and the three assertions below failed against a port that
130+
// was answering correctly.
113131
ec.clear();
114-
fs::create_symlink(dir / "a.txt", dir / "link", ec);
115-
check(static_cast<bool>(ec), "creating a symbolic link is refused, not ignored");
116-
132+
fs::create_symlink("a.txt", dir / "link", ec);
133+
check(!ec, "a symbolic link is created");
134+
check(fs::read_symlink(dir / "link", ec) == "a.txt" && !ec,
135+
"and reading it gives back the name it was made from");
136+
137+
// The distinction the link exists to make: an enquiry that resolves and one
138+
// that does not answer about different nodes. A port that conflated them
139+
// reported every link as the file it points at, which is what made a tree
140+
// containing one uncopyable.
141+
check(fs::is_symlink(fs::symlink_status(dir / "link", ec)) && !ec,
142+
"an enquiry that does not resolve reports the link itself");
143+
check(fs::is_regular_file(fs::status(dir / "link", ec)) && !ec,
144+
"and one that resolves reports the file it names");
145+
check(fs::file_size(dir / "link", ec) == 10 && !ec,
146+
"so the size read through it is the file's");
147+
148+
// ⭐ AND THE TREE IS STILL WALKABLE. `remove_all` recurses, and a directory
149+
// holding a link is the case where resolving during the walk removes the
150+
// wrong node or loops.
117151
fs::remove_all(dir, ec);
118152
check(!fs::exists(dir, ec), "the directory and its contents are removed");
119153

mcpp.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
namespace = "mcpplibs"
33
name = "openkal-llvm-runtime"
4-
version = "0.3.1"
4+
version = "0.4.0"
55
description = "LLVM's C++ runtime libraries — libc++, libc++abi and libunwind — configured for openkal-musl rather than for a host C library."
66
license = "Apache-2.0"
77
authors = ["mcpplibs"]
@@ -208,7 +208,7 @@ sources = [
208208
cflags = ["-DDISABLE_AARCH64_FMV=1"]
209209

210210
[dependencies]
211-
openkal-musl = "0.6.0"
211+
openkal-musl = "0.7.0"
212212

213213
[build]
214214
cxx_standard = "c++23"

0 commit comments

Comments
 (0)