[Toybox] macOS sitrep

enh enh at google.com
Sat Dec 8 17:18:50 PST 2018


On Fri, Dec 7, 2018, 19:36 Rob Landley <rob at landley.net wrote:

>
>
> On 12/7/18 8:28 PM, enh wrote:
> > On Tue, Dec 4, 2018 at 8:05 PM Rob Landley <rob at landley.net> wrote:
> >>
> >> On 12/4/18 7:06 PM, enh wrote:
> >>> okay, so now toybox builds out of the box (with a custom .config) i
> >>> added a bunch more stuff to my .config. the following were all
> >>> painless:
> >>>
> >>> ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
> >>> comm count cpio crc32 cut dirname dos2unix du echo egrep env expand
> >>> factor false fgrep file flock fmt ftpget ftpput grep groups head help
> >>> hexedit hostname iconv id kill killall5 link ln logname md5sum microcom
> >>> mkdir mkfifo mktemp nc netcat nice nl nohup od paste patch printenv
> >>> printf pwd pwdx readlink realpath renice rev rm rmdir sed seq setsid
> >>> sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort split
> strings
> >>> tac tee timeout true truncate tty uname uniq unix2dos unlink usleep
> >>> uudecode uuencode uuidgen w watch wc which who whoami xargs xxd yes
> >>
> >> Could you send me your .config? I can check in a "make macos_defconfig".
> >
> > with the two extra patches i just sent to the list, you can build a
> > whole bunch of stuff:
>
> Applied.
>
> > ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
> > comm count cpio crc32 cut date dirname dos2unix du echo egrep env
> > expand factor false fgrep file find flock fmt ftpget ftpput getconf
> > grep groups head help hexedit hostname iconv id kill killall5 link
> > ln logger logname ls md5sum microcom mkdir mkfifo nc netcat nice nl
> > nohup od paste patch printenv printf pwd pwdx readlink realpath renice
> > rev rm rmdir sed seq setsid sha1sum sha224sum sha256sum sha384sum
> > sha512sum sleep sort split strings tac tee time timeout touch tr true
> > truncate tty uname uniq unix2dos unlink usleep uudecode uuencode uuidgen
> > w watch wc which who whoami xargs xxd yes
>
> Which means it's _not_ building.... (rummage rummage)
>
> acpi blkid blockdev bunzip2 bzcat chattr chroot chrt chvt cp df dmesg eject
> fallocate free freeramdisk fsfreeze fstype fsync halt hwclock i2cdetect
> i2cdump
> i2cget i2cset ifconfig inotifyd insmod install ionice iorenice iotop
> killall
> login losetup lsattr lsmod lspci lsusb makedevs mix mknod mkpasswd mkswap
> mktemp
> modinfo mount mountpoint mv nbd-client netstat nproc oneit partprobe passwd
> pgrep pidof ping ping6 pivot_root pkill pmap poweroff prlimit ps readahead
> reboot reset rfkill rmmod setfattr shred stat su swapoff swapon
> switch_root sync
> sysctl tail taskset test top tunctl ulimit umount uptime vconfig vmstat
>
>
> Hmmm... bunzip2 and bzcat are easy, reset, sync, mktemp, and test might
> already
>

mktemp was disabled here only because ToT was broken. iirc I've built it
before.

work, shred is trivial but silly on journaled filesystems (it was a
> request),
> dunno how much work stat is, tail has two codepaths and one's probably
> easy...
>
> The cp/install/mktemp/mv cluser... dunno what's missing? IN theory the
> openat()
> stuff is posix-2008?
>

I explained in my mail *and* had a TODO comment in .config explaining it :-P

Basically, BSD has a different API for xattrs.

ps/top/iotop/pkill/pgrep are probably a nightmare because of the /proc
> stuff and
> I have no idea what a macos equivalent would look like.
>

Yeah, one of the build guys tells me he's actually looked at this recently
and found that there doesn't seem to be an official API. Meh... We can
worry about these if we ever have real macOS users.

Most of the rest probably doesn't apply conceptually. (I mean... maaaaaybe
> blkid? Dunno what macos does for mount...)
>
> > i've basically ignored pending for now, because i was only originally
> > hoping to answer the question "is this feasible?" and i think we have
> > a pretty strong "yes" that includes most of the things we'd need for a
> > mac AOSP build already.
>
> Cool.
>

(You'll see I did build tr, even though it's in pending. That was because
the build guy specifically asked. But I don't plan on using anything in
pending in the build. I'm concerned enough about stability as it is,
without relying on things that are going to get major rewrites.)

> i might try to get the xattr portability wrapper done before i have to
> > give the mac back, but otherwise i'm hanging the "mission
> > accomplished" banner for now and will worry about actually, you know,
> > _using_ this stuff some other day. probably after i've finished
> > getting linux AOSP builds switched over, which is much more
> > interesting to me anyway (and especially in the short term).
>
> I wonder how horrible building this subset under https://midipix.org
> and/or the
> Windows linux binary running thingy interface is?
>
> > i've attached my config. note that i've included TODOs explaining why
> > a few of the main failures don't build. tail's inotify is
> > interesting/annoying.
>
> It's all for FLAG_f. I could add a compile-time probe with a config symbol
> and a
> portability.h stub? (Or move the sys/inotify.h #include into portability.h
> so
> #ifdef APPLE could #else it...)
>

Yeah, that works for tail. I suggested the ON_BSD/ON_LINUX for general use
because it seemed like that would be a better way to have the config stuff
work. I was thinking more of things like insmod. But maybe there aren't
actually many cases where the whole command is meaningless (as opposed to
just some specific option).

Like I say, I'll try to have a look at the last few POSIX toys before I
return the loaner Mac. (And I'll borrow another when I've finished
switching AOSP over for Linux and I'm ready to think seriously about macOS.)

>>> (i haven't even bothered trying anything from pending.)
> >>
> >> If you get the urge for specific commands out of there, lemme know. I
> just
> >> finished redoing test.c and I'm squinting at tftpd.c now (using a
> dhcp/bootp
> >> thing at $DAYJOB)...
> >
> > of the stuff in pending, AOSP builds would use dd, diff, egrep, grep,
> > tar, and tr.
>
> grep isn't in pending, but I need to add --color support.
>

Yes, to me that's conceptually still in pending because I think it's going
to be a pretty big rewrite 😀

> all of which were on your "non-trivial" list. (we're
> > _building_ toybox's grep family, but we're still using the BSD ones.
> > Q/master is currently using toybox dd [P had BSD dd].)
>
> Lemme see what I can get done on grep --color this weekend...
>

If you're quick I might even risk switching Android over for Q... December
is when I stop making drastic changes. My notes only really mention --color:

grep --- missing --color. compare performance with BSD grep before
switching; BSD grep has workarounds for performance in the BSD regex
implementation (if we find anything we should see if we can fix bionic
instead).

The macos regex() implementation is still a bit different from any of the
> linuxes, might still cause a problem there...
>

But probably similar to bionic, I'd imagine...

Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20181208/d8280418/attachment-0001.htm>


More information about the Toybox mailing list