[Toybox] [PATCH] dirtree.c: avoid spurious EINVAL warnings.

Rob Landley rob at landley.net
Sat Dec 14 15:40:48 PST 2019


On 12/13/19 6:36 PM, enh via Toybox wrote:
> An Android engineer complained that they were seeing this when not
> running as root:
> 
>   $ adb shell ls
>   ls: ./postinstall: Invalid argument
>   ls: ./init: Permission denied
>   ls: ./data_mirror: Invalid argument
>   ls: ./init.environ.rc: Invalid argument
>   ls: ./metadata: Invalid argument
>   acct
>   adb_keys
>   apex

Are you sure that's current? init isn't listed to stdout: the current code is
saying "permission denied" but also listing them.

I think the goto error would discard postinstall and such, yes. (Still don't
have this selinux test environment set up...)

>>From strace, it was here:
> 
>   newfstatat(4, "adb_keys", 0x7fc67eca88, AT_SYMLINK_NOFOLLOW) = -1
> EACCES (Permission denied)
>   readlinkat(4, "adb_keys", 0x5e843c7720, 4095) = -1 EINVAL (Invalid argument)
> 
> So stop looking at st.st_mode (and then deciding to do a readlinkat())
> if we didn't actually successfully stat().

I'm wondering if I should mask out the permission denied too? We're now
displaying what information we _do_ have on those entries to stdout (the other
ones were discarded because goto error, but the "permission denied" ones
should), and when you request info it can't fetch it gives you ??? output.

Not sure what the right behavior is here. (It's a UI question really.)

Rob



More information about the Toybox mailing list