[Toybox] [PATCH] Fix the pidof comm test.

enh enh at google.com
Thu Feb 8 23:17:02 PST 2018


okay, ignore that patch (not least because it was an unrelated old
patch that's already been applied) and try this one instead... turns
out we have two separate pidof bugs on Android. which is only fitting,
because two separate bugs were raised today (though they were both for
this latter bug, not the comm bug i found myself while investigating).

[PATCH] Fix the pidof comm and cmdline tests.

If we have a 15-byte name, we don't know whether comm actually matches
or is a truncated form of a longer name that has a common prefix.

For example, with "this-is-a-very-long-name-that-is-too-long", we shouldn't
match "this-is-a-very-" (but the old code would).

The cmdline code was also broken on Android because it used basename(3)
rather than getbasename. This doesn't affect glibc because there's a
workaround in portability.h to ensure that we get the non-POSIX basename(3)
with glibc but then a non-glibc section that ensures everyone else gets
POSIX basename(3). That should probably be removed (and maybe `basename`
poisoned) to prevent similar mistakes in future.

Bug: http://b/73123244
---
 lib/lib.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)


On Thu, Feb 8, 2018 at 10:44 PM, enh <enh at google.com> wrote:
> If we have a 15-byte name, we don't know whether comm actually matches
> or is a truncated form of a longer name that has a common prefix.
>
> For example, with "this-is-a-very-long-name-that-is-too-long", we shouldn't
> match "this-is-a-very-" (but the old code would).
>
> Bug: http://b/73123244
> ---
>  lib/lib.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-the-pidof-comm-and-cmdline-tests.patch
Type: text/x-patch
Size: 2804 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20180208/dd9e98d5/attachment-0003.bin>


More information about the Toybox mailing list