libctf: failure to open parent dicts that exist should be an error
commit61914bb6990c943c65fa8e10b1577c0808016149
authorNick Alcock <nick.alcock@oracle.com>
Fri, 26 Apr 2024 17:09:38 +0000 (26 18:09 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 17 May 2024 11:58:17 +0000 (17 12:58 +0100)
tree226e40c8d05041c9ef253e78ccfe1ae84078d931
parent7bc376bb9705cf66eea7b9a39442852b173ba6eb
libctf: failure to open parent dicts that exist should be an error

CTF archive member opening (via ctf_arc_open_by_name, ctf_archive_iter, et
al) attempts to be helpful and auto-open and import any needed parent dict
in the same archive.  But if this fails, the error is not reported but
simply discarded, and you silently get back a dict with no parent, that
*you* suddenly have to remember to import.

This is not helpful behaviour: if the parent is corrupted or we run out of
memory or something, the caller is going to want to know!  Split it in two:
if the dict cites a parent that doesn't exist at all (a lot of historic
dicts name "PARENT" as their parent, even when they're not even children, or
perhaps the parent dict is stored separately and you plan to manually
associate it), we skip it as now, but if the import fails with an actual
error other than ECTF_ARNNAME, return the error and fail the open.

libctf/
* ctf-archive.c (ctf_arc_import_parent):  Return failure if
        parent opening fails for reasons other thnn nonexistence.
(ctf_dict_open_sections): Adjust.
libctf/ctf-archive.c