[Toybox] macOS realpath test failures

Rob Landley rob at landley.net
Wed Nov 30 14:04:56 PST 2022


On 11/28/22 12:41, enh via Toybox wrote:
> github CI caught a few failures

Sigh. There's a reason this has been on the todo list for literally years. It's
corner cases all the way down and I don't have a mac test environment. (Works on
linux not on mac means a libc function is returning something different,
possibly because a syscall did, possibly because the VFS did something funky...)

> (https://github.com/landley/toybox/actions/runs/3561813808/jobs/5983047254):
> 
> PASS: realpath -s
> ............................................................................
> ................................................
> realpath: dos/three: Not a directory

Not a directory? Up top we did:

  mkdir -p one/two/three
  ln -s ./one uno
  ln -s one/two dos

I don't THINK anything's done a cd or filesystem write since then?
(one/two/three is a directory and dos points to "one/two"...)

> FAIL: realpath -s link/..
> echo -ne '' | "/Users/runner/work/toybox/toybox/generated/testdir/realpath" -es
> dos/three
> --- expected 2022-11-28 04:54:16.000000000 +0000
> +++ actual 2022-11-28 04:54:16.000000000 +0000
> @@ -1 +0,0 @@
> -/Users/runner/work/toybox/toybox/generated/testdir/testdir/dos/three

Debris from that failure...

> PASS: realpath -s .. eats symlink
> PASS: realpath -s .. eats symlink in $PWD

Neither of those actually looks at the filesystem because -s (don't expand
symlinks) so there's potentially a getcwd() prepend then the .. cancellation is
entirely string based...

> FAIL: realpath -es dangling symlink
> echo -ne '' | "/Users/runner/work/toybox/toybox/generated/testdir/realpath" -es
> dangling 2>/dev/null || echo ok
> --- expected 2022-11-28 04:54:16.000000000 +0000
> +++ actual 2022-11-28 04:54:16.000000000 +0000
> @@ -1 +1 @@
> -ok
> +/Users/runner/work/toybox/toybox/generated/testdir/testdir/dangling

Adding -e however checks if the result exists. And the failure here is it
SHOULDN'T, but MacOS thinks it DOES. (How do you even...?)

> PASS: realpath -ms
> realpath: one/two/ichi/two/ichi/two: Not a directory

Our old friend again...

> FAIL: realpath -es
> echo -ne '' | "/Users/runner/work/toybox/toybox/generated/testdir/realpath" -es
> one/two/ichi/two/ichi/two
> --- expected 2022-11-28 04:54:16.000000000 +0000
> +++ actual 2022-11-28 04:54:17.000000000 +0000
> @@ -1 +0,0 @@
> -/Users/runner/work/toybox/toybox/generated/testdir/testdir/one/two/ichi/two/ichi/two

Sigh. If I stick printfs into a commit and push to a branch it'll _sometimes_
run the tests on the new commit based on github server load, correct?

Lemme finish fixing cp -s first (I.E. the rest of my relative path untangling
todo item)...

Rob


More information about the Toybox mailing list