bpftrace icon indicating copy to clipboard operation
bpftrace copied to clipboard

New delete syntax conflicts with multi-delete syntax

Open ajor opened this issue 4 months ago • 13 comments

Related to #3472.

Multi-delete syntax:

@[10] = 100;
delete(@[10], @[11]); // delete element with key 10 and element with key 11

New delete syntax:

@[10] = 100;
delete(@, 10); // delete element with key 10

@key = 10;
delete(@, @key); // !!! does not delete element with key 10 - this instead triggers the multi-delete variant

Complete repro

This script should work with the new syntax, but that would require deleting the multi-delete syntax:

# bpftrace -e 'BEGIN { @[10] = 100; @val = 10; delete(@, @val); exit(); }'
stdin:1:33-41: ERROR: Argument mismatch for @: trying to access with no arguments when map expects arguments: 'int64'
BEGIN { @[10] = 100; @val = 10; delete(@, @val); exit(); }
                                ~~~~~~~~

ajor avatar Oct 07 '24 13:10 ajor