[Toybox] [PATCH] tests.tar: fix tests for macOS.

Rob Landley rob at landley.net
Sat Sep 17 14:09:48 PDT 2022


On 8/31/22 14:54, enh wrote:
> On Tue, Aug 30, 2022 at 4:20 AM Rob Landley <rob at landley.net
> <mailto:rob at landley.net>> wrote:
> 
>     On 8/29/22 19:22, enh via Toybox wrote:
>     > ping? i saw you added another tar test, but let me know your thoughts on this
>     > before i rebase and fix the new test...
> 
>     Sorry, under the weather all weekend (and today). Pascal's Apology probably
>     applies to some of the emails I've sent, except instead of them being long due
>     to lack of time they're long due to lack of focus...
> 
>     Applied. 
> 
> thanks! (i actually let slip a "woo hoo!" when i saw the github ci green again
> for the first time in many weeks!)
>  
>     I wanted to clean it up to not be testing for darwin 13 separate times
>     and haven't worked out how yet, but can do so later.
> 
> since i'm the only one who actually has a mac (and, not coincidentally, the only
> one who really cares about mac tests in ci), any time there's something like
> that just let me know what you want and i can do it.

I saw the mac tests broken on github after that recent patch, and had a window
open with the error list, but you got your fix patch in first because it was 3
deep in my todo stack...
 
>     (I need some sort of group
>     skip mechanic, ala "optional".  Which I note is only still used in
>     tests/sort.test since I yanked most command sub-options, so I should probably
>     revisit that too. A simple shell "if test; then ... fi" doesn't say "skipped"
>     for the tests it skipped, and saying SKIPNEXT=5 instead of =1 and having it
>     count down seems a bit brittle vs START/STOP marker...)
>  
> ah, okay, yeah --- you can do the infrastructure :-)
> 
> i wished i'd had that too, but at the same time i was unconvinced we'd manage to
> keep things physically grouped like that, or that it would be clear without
> indentation, or that we'd be happy with the result even if we had the option.

The count can be set crazy high and we can zero it, so we can both have groups
that run from start to end _and_ "skip next one" or "skip next three".

And if "toyonly" increments the count instead of setting it to a specific value,
that works both within a skipped block and outside of a block...

> i almost sent a patch that had a has_working_sparse_files variable instead,
> which at least seemed a bit more intention-revealing (and, tbh, i'm expecting
> that some day someone will report that one of the more exotic linux filesystems
> doesn't do sparse files properly!).

Reiserfs is finally going away! https://lwn.net/Articles/904101/

The rest of the Linux-native filesystems actually get tested. None of the
read-only ones (squashfs, romfs, cramfs, iso9660...) can participate in testing.
I suppose somebody might use VFAT or even whatever they're calling ntfs this week...

Huh, what are the filesystems in play in vanilla linux? Let's see...

  grep -r 'MODULE_ALIAS_FS' linux/fs | sed 's/[^"]*"\([^"]*\).*/\1/' | xargs

And... thank you SO MUCH fuse/virtio_fs.c. where is KBUILD_MODNAME set... in
scripts/Makefile.lib. I'm guessing from fs/fuse/Makefile that it's "virtiofs"?
Ok, manually fixed up list, and let's alphebetize it, and the result:

9p adfs affs afs autofs befs bfs binfmt_misc btrfs ceph cifs coda configfs
cramfs debugfs ecryptfs efivarfs efs erofs exfat ext2 ext3 ext4 f2fs fuse
fuseblk fusectl gfs2 gfs2meta hfs hfsplus hostfs hpfs iso9660 jffs2 jfs minix
msdos nfs nfs4 nfsd nilfs2 ntfs ntfs3 ocfs2 ocfs2_dlmfs omfs openpromfs overlay
qnx4 qnx6 reiserfs romfs smb3 squashfs sysv tracefs ubifs udf ufs v7 vboxsf vfat
virtiofs vxfs xfs zonefs

I need to update blkid, don't I? (Did I ever get "file" to call the blkid code?)

Ok, categorizing:

  Synthetic filesystems: autofs, binfmt_misc, configfs, debugfs, efivarfs,
                         openpromfs (sun), tracefs,
  Network filesystems: 9p, afs (read only), ceph, cifs/smb3, coda,
                       fuse/fuseblk/fusectl, gfs2/gfs2meta, hostfs, nfs/nfs4,
                       vboxsf (virtualbox), virtiofs,
  Fucking stupid: nfsd, ksmbd
  Foreign OS: adfs (arm acorn), affs (amiga), befs (BeOS), bfs (unixware),
              hfs(mac), hfsplus(mac), hpfs(OS/2), minix, ntfs/ntfs3 (microsoft),
              ocfs2/ocfs2_dlmfs (oratroll), omfs (sonicblue), qnx4, qnx6,
              reiserfs (murderer), sysv/v7 (AT&T), ufs (BSD), vxfs (sco)
  Wrappers: ecryptfs (obsolete ala 726464596b5d), overlay
  Read Only: cramfs, efs (SGI), erofs (huawei NIHfs), iso9660, romfs, squashfs,
             udf (DVD)
  Flash: f2fs (2012 samsung), jffs2 (2001), ubifs, zonefs
  Genericish: exfat/msdos/vfat, jfs (IBM, obsolete ala e471e5942c00),
              nilfs2 (NTT, Japan's phone company), xfs (SGI)
  Linux: btrfs, ext2, ext3, ext4

Ok, everything above "flash" can probably be safely ignored, and for the moment
I'm ignoring the flash ones too. I already test on ext4, and should probably
test on btrfs. I can set up an xfs partition. On the fence about vfat...

Hang on, how the heck is "tmpfs" not in this list? Sigh, gonna have to do a
second pass...

>     Also, the hashes changing when anything differs is frustrating. I wanted to be
>     sure I was creating binary identical tarballs, and I am, but... is there a
>     better way to test that? (WITHOUT having the output each thing's comparing
>     against be 20 lines of hex dump... Maybe just a few tests can be hashes and the
>     rest can be tar -tv or something? Skipping half the tests entirely and calling
>     that "compliance" is frustrating. Yes the important thing is that it not fail,
>     but passing a test by sabotaging the test is not ideal. Hmmm...)
> 
>     What _are_ the different permissions for a symlink on mac? 
> 
> they're actually in the script already: that's
> what https://github.com/landley/toybox/blob/master/tests/tar.test#L141
> is doing (for the tests that already use `tar tv` rather than SHAs). 

So their symlinks aren't world writeable by default?

Except the symlink permissions don't override the target permissions (depending
on how the checks go they're effectively or-ed together because you pass symlink
permission check to _get_ to the target permission check, kinda like traversing
directories to get to files), so what they're saying is "nothing symlinked to
can be world writeable, because security!"

Meaning you can never have a writeable symlink to /dev/null when you want output
to get discarded. Because the mac people tried to be clever again.

How does ANYONE manage to use this operating system? (Yeah yeah, beats Windows.
Damning with faint praise, that.)

>     Could you hack
>     something like this into your test (with VERBOSE=all and the darwin skipnots
>     commented out) and run it on mac and send me the saved tarballs? I'd like to
>     know what I'm up against...
> 
> that doesn't work because testdir gets deleted? (and you can only run `make
> tests` on the mac, not `make test_tar` because the infrastructure for the latter
> assumes realpath, which doesn't exist on macOS.)

Ah. Hmmm. Speaking of changing semantics, I need some sort of TEST_NOT_HOST=1
(not calling it that) so individual tests get tested in a toybox make_airlock.

Hmmm[2]: toybox has realpath, but it's in:

$ git diff toys/*/readlink.c | diffstat
 readlink.c |   92 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 73 insertions(+), 19 deletions(-)

I _really_ need to get that finished and checked in...

> even putting a `sleep 666` at the end of tar.test, `find . -name save.*` doesn't
> find anything?

Lemme try doing alternate sha1sums with the other symlink permissions (dunno
_how_ I'm gonna hack that up) and see if pushing to a github branch gives me
passing mac tests on that. Probably not _today_... :)

> (anyway, like i say, i don't think you need this anyway because the hack for the
> appropriate expected permissions is already in the script if you just want to
> switch those tests from SHAs to `tar tv`?)

Hmmm... probably an easier fix. (I want _some_ tests to be sha1 because "binary
identical" is a goal. But it makes the tests DARN brittle and impossible to
debug when they DON'T work...)

Rob


More information about the Toybox mailing list