From: John Moon <quic_johmoo@quicinc.com>
To: Dodji Seketeli <dodji@seketeli.org>
Cc: <libabigail@sourceware.org>, Trilok Soni <quic_tsoni@quicinc.com>,
"Satya Durga Srinivasu Prabhala" <quic_satyap@quicinc.com>
Subject: Re: abidiff improvements for kernel UAPI checker
Date: Fri, 22 Sep 2023 13:02:36 -0700 [thread overview]
Message-ID: <78d1c98d-5863-4b1c-a0e9-9e5088be1d12@quicinc.com> (raw)
In-Reply-To: <44d76150-3e34-4bef-9970-d321f5bc224c@quicinc.com>
On 9/22/2023 11:28 AM, John Moon via Libabigail wrote:
> If not, I think this output is at least easier to post-process! For
> example, I could add logic to the script to do something like "if
> there's a deleted enum whose contents are present in an added enum,
> assume it's an addition to an anonymous enum and ignore".
>
Proof of concept to filter out anon enum additions from input like this:
2 removed types unreachable from any public interface:
[D] 'enum {HNS_ROCE_EXSGE_FLAGS=1, HNS_ROCE_RQ_INLINE_FLAGS=2, }'
at hns-abi.h:88:1
[D] 'enum {HNS_ROCE_RSP_EXSGE_FLAGS=1,
HNS_ROCE_RSP_RQ_INLINE_FLAGS=2, }' at hns-abi.h:93:1
2 added types unreachable from any public interface:
[A] 'enum {HNS_ROCE_CQE_INLINE_FLAGS=4, HNS_ROCE_EXSGE_FLAGS=1,
HNS_ROCE_RQ_INLINE_FLAGS=2, }' at hns-abi.h:88:1
[A] 'enum {HNS_ROCE_RSP_CQE_INLINE_FLAGS=4,
HNS_ROCE_RSP_EXSGE_FLAGS=1, HNS_ROCE_RSP_RQ_INLINE_FLAGS=2, }' at
hns-abi.h:94:1
---
#!/bin/bash
set -o errexit
# Take a line and form a normalized string representation
get_repr() {
local -r line="$1"
echo "$line" | grep -o '{.*}' \
| tr -d '{} ' \
| sed -e 's/,$//g' -e 's/,/\n/g' \
| sort -t= -k2 -n \
| xargs
}
input="${1:-/dev/stdin}"
deleted_anon_enum_reprs=()
added_anon_enum_reprs=()
while read -r line; do
if echo "$line" | grep -q "\[D\] 'enum {"; then
deleted_anon_enum_reprs+=("$(get_repr "$line")")
fi
if echo "$line" | grep -q "\[A\] 'enum {"; then
added_anon_enum_reprs+=("$(get_repr "$line")")
fi
done < "$input"
# If a deleted enum's representation appears in an added enum's
# representation, assume they're the same enum (just being added
# on to).
legit_breaks=${#deleted_anon_enum_reprs[@]}
for del_repr in "${deleted_anon_enum_reprs[@]}"; do
for add_repr in "${added_anon_enum_reprs[@]}"; do
if echo "$add_repr" | grep -q "^${del_repr}"; then
legit_breaks=$((legit_breaks - 1))
break
fi
done
done
echo "$legit_breaks breaks"
---
There may be a better way to do this sort of thing in a suppression, but
I'm not sure how given they operate on diffs (which wouldn't be created
in this case).
It feels hacky as the abidiff stdout isn't a stable API itself, but if
it sounds reasonable to you, I can bake the above filtering logic into
the next rev submitted upstream. Just let me know!
Thanks,
John
next prev parent reply other threads:[~2023-09-22 20:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 0:45 John Moon
2023-04-16 18:33 ` Trilok Soni
2023-04-21 18:21 ` Dodji Seketeli
2023-04-21 20:03 ` Dodji Seketeli
2023-04-24 18:39 ` John Moon
2023-05-10 14:21 ` Dodji Seketeli
2023-05-23 19:59 ` John Moon
2023-07-05 16:52 ` John Moon
2023-10-05 13:44 ` Support suppressing data members inserted right before flexible array members (was Re: abidiff improvements for kernel UAPI checker) Dodji Seketeli
2023-07-10 10:55 ` abidiff improvements for kernel UAPI checker Dodji Seketeli
2023-09-22 11:39 ` Dodji Seketeli
2023-09-22 11:51 ` Dodji Seketeli
2023-09-22 18:28 ` John Moon
2023-09-22 20:02 ` John Moon [this message]
2023-09-26 8:38 ` Dodji Seketeli
2023-09-27 17:37 ` John Moon
2023-09-29 9:52 ` Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=78d1c98d-5863-4b1c-a0e9-9e5088be1d12@quicinc.com \
--to=quic_johmoo@quicinc.com \
--cc=dodji@seketeli.org \
--cc=libabigail@sourceware.org \
--cc=quic_satyap@quicinc.com \
--cc=quic_tsoni@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).