On 3/27/24 08:31, Rob Landley wrote:
>>> ipcrm, ipcs,
>> I don't know how I'm supposed to test resources I have no way to create,
>> we'll need ipcmk eventually. These seem more feasible to test, although
>> their tests will fail under mkroot until we
>> have ipcmk
> To be honest, I'm tempted to clean up and promote them to "examples". Leaving
> them "default n". There in case somebody needs it, but if so it would be nice 
> if
> they could send us a note letting us know they exist...

I did a quick cleanup pass on ipcrm, but... yeah, I have no idea how to test 

Also... what ARE keys vs IDs? I thought ID was a number and a key would be
arbitrary strings, because a key gets washed through a lookup function and an id
is just strtol(), but the code that's there does:

function(int key, char *name...)
  id = strtol(name, &c, 0);
  if (*c) {
    error_msg("invalid number :%s", name);

  if (key) {
    if (id == IPC_PRIVATE) {
      error_msg("illegal key (%s)", name);

IPC_PRIVATE is zero. So even if you set "key" to 1, strtol() has to consume the
whole thing or you get "invalid number" error and an abort before it even checks
key. There's no !key test around that first bit. And then right afterwards it
checks if the strtol() it did returned zero (IPC_PRIVATE is zero) and barfs if
it did, so even if that first part WAS a thinko with a missing test, it still
wouldn't work for anything that didn't at least START with a nonzero number.

So what's a "key"?

I did a "git log */ipcrm.c" over in busybox and there hasn't been a patch to it
from an actual USER of this command since it was introduced.

It's all code size shrink, compiler flag damage, white space fixes, help text
style updates, annotating with size estimates, NOEXEC, "make GNU licensing
statement forms more regular", "use can't instead of cannot", using EXIT_SUCCESS
and EXIT_FAILURE macros (really???), whatever "strtoul() fixes" was, and so on.
Churn for being a busybox applet, global search and replace over the tree.

No actual _user_ of the code has touched it since it was added to the tree, and
it turns out that was MY fault:

  commit 6eb1e416743c597f8ecd3b595ddb00d3aa42c1f4
  Author: Rob Landley <r...@landley.net>
  Date:   Mon Jun 20 04:30:36 2005 +0000

    Rodney Radford submitted ipcs and ipcrm (system V IPC stuff).  They could
    use some more work to shrink them down.

And in my defense, I had no idea what they WERE back then. That whole mess
started with a poke from some Qualcomm developers from India:


Which led to a newbie looking for something to do asking how you submit new
commands to the project:


And then two other devs piping up to show interest:


Which led to the patch.

So three people showed interest in 2005, resulting in a new dev porting the
commands from util-linux-2.12a, but none of them actually submitted anything
like a test case:


So I have what I think is a cleaned up version but can't prove I didn't break
it, and I have no idea if 19 years after it was added to busybox and then (as
far as I can tell) completely ignored... anyone still cares?

Toybox mailing list

Reply via email to