From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 9A5573858D32 for ; Sun, 15 Oct 2023 19:19:18 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9A5573858D32 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697397561; cv=pass; b=DYCfKEjQfmhZ1ejkz/BO517ePzudtKKBwU9z4f5vgur54UxMolp2vn4ZJvxMdOypau2w/5pdI27EipANae01/wp/w2ITbNvxcPepYfaJUeW27Pfsg27ebrj2HGw1HH+heqjaMRPF9ltyTfur66/9Yp4NxNBvLx3zmzyhwO63bA0= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697397561; c=relaxed/simple; bh=XsUX4Qri1jPSvVn5aofvMOC0nSJWQTNZq9nw9RqmVjk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=dRxy1ayZ0XIrL8a7bBM3io6Zg/HGCKnpuUwR4wtzftG4JhcMnam06AeWoAaYen2tt2ZKnnmoOW19LBtRby6gKrS/YZhhKLXkmUNHKMlqLHJQr8YyGaixffiHMXi6yBa8qmTN4fncH7eRc/51ETDMxaKbIHVNUHh2qWrrksd96U8= ARC-Authentication-Results: i=2; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A5573858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39FItc5U004770; Sun, 15 Oct 2023 19:19:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : content-type : mime-version; s=corp-2023-03-30; bh=fOXXRGdGWCwCVoKVPlxUoUtLhdiOe75T/uDFHaVAQ48=; b=C6abAeWm1Qlv+YSQuEu8gYpH1tYhk0QwrKBe5CPwdF0uEbBNC3mSjw6YNAI4du8Im8rE iB3/pX1SrjjJT9vunSIpXSLggzvvgG50a4A2WGtnWTI1S2wk6QHMvEQIHafNyy3T2tEE HH1A4hKNJWIs4KzX+Pup/YeyKBXSfqPpMmrPwnTkwA703SXr8A08Yy3hOw7CnQR8hv98 YYAHI7kBQiOzk3tSob/e8INgd+3myZZp4CKr7joCeqaNtJuShdulo7SUkEo8E8V+hOWo m34fED6GV0UGav381KKqa3W4ZHDPk8yQKle/CsIsAsZvqZp8m+UyiiElYxde3ZnyyYo4 VQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tqk3jhe3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 15 Oct 2023 19:19:12 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39FIGcg1027137; Sun, 15 Oct 2023 19:19:12 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3trg51gh3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 15 Oct 2023 19:19:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fMh07CnKgbPnAepqFN4GZvvc5jC8VRWCaZL5cFV4qvDdV9yzZH997mKtYq9txdAQhS4/rzPPftDjACIF8lmwyjfzNK1kgKUp2n4Ypox49ttqeRgQx+NTkgkeXDbFER3p45GnKz2QY05NuYI7S6tG/lDquzsTeknU0KL7GU358ZE3nVkbxsFqUWRtWMPetWmZ302pL3h4re52905ttwySRmCEDdEv4qoDF/fhUBlNYXBOif3y8fRRFADd1XGLiIMBV+H58w4E3m678y0ljTafsB+goL+Zi9KYtOhFjh/OzkOg34DDUKWDfiUYAxEMpH9mb9Ua2WHMHZk/pamSQ4+6ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fOXXRGdGWCwCVoKVPlxUoUtLhdiOe75T/uDFHaVAQ48=; b=ZlNn766m1o6orFUthvIWgU1AjvN2LUujg2kpXCrO13xN5WPnTk9dsqPA+edX4atu/Jo1oJw7zx6Thun99GR9wk6IIzR+hlfb3VkpnQMQVs12AkG+i2nsCnygjb9jYRNg9xCybk4qWrGqwQLADfnYyKL/1pjCwO22ECgeXRBlIxUUogqjyZ1iGRyljyDHoaHagWDGfpfXL1uUoyFLkxNHgo5So0vFEboBWUgxGldRER3NODRsBx16rdqpbfO5o/CdGeuIUaYNhggi8ckdgBENbxBfI6SDtBXICcCRVwSU3ky6f6dqKp7N4VSvLoaF/1++CBuxH6QdONWlgM6EAa3KFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fOXXRGdGWCwCVoKVPlxUoUtLhdiOe75T/uDFHaVAQ48=; b=wHOBFW+dTp/zS0d2MkwL3WNR8ZuwLW9Rh/dPb1NMOHFw9wkEAfcDwSYrCiRRjMinCalnb5aQkM4cisDWMVxJSYALK0cDA724qbH5HOfPlxl8etD1r/LRfxJ90GLKXZPuDx8Kkbv4nqzJCYbQBomyYdbrqQ3iAwPo1/DQ5Ejhg2o= Received: from DS0PR10MB6798.namprd10.prod.outlook.com (2603:10b6:8:13c::20) by DS7PR10MB5151.namprd10.prod.outlook.com (2603:10b6:5:3a4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Sun, 15 Oct 2023 19:19:03 +0000 Received: from DS0PR10MB6798.namprd10.prod.outlook.com ([fe80::19ff:c8cb:d04d:8b5a]) by DS0PR10MB6798.namprd10.prod.outlook.com ([fe80::19ff:c8cb:d04d:8b5a%4]) with mapi id 15.20.6863.043; Sun, 15 Oct 2023 19:19:03 +0000 From: Nick Alcock To: Torbjorn SVENSSON Cc: , Subject: Re: [PATCH] libctf: check for problems with error returns References: <20231009151146.3818141-1-torbjorn.svensson@foss.st.com> <20231013140152.427376-1-nick.alcock@oracle.com> <482ae0a8-85c7-3a46-df1e-2d5850b7824b@foss.st.com> Emacs: you'll understand when you're older, dear. Date: Sun, 15 Oct 2023 20:18:51 +0100 In-Reply-To: <482ae0a8-85c7-3a46-df1e-2d5850b7824b@foss.st.com> (Torbjorn SVENSSON's message of "Fri, 13 Oct 2023 20:31:09 +0200") Message-ID: <87ttqrae3o.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LO2P123CA0082.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::15) To DS0PR10MB6798.namprd10.prod.outlook.com (2603:10b6:8:13c::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB6798:EE_|DS7PR10MB5151:EE_ X-MS-Office365-Filtering-Correlation-Id: fd79ba88-6c3c-42a1-983d-08dbcdb39773 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YOMwu4LsUqq8MPGcQGhD2rjTvOqNiB8g7zpDvcFAVYDE8FCZJHxol9lt4V/hCzgKPDYDi8cb9hNrBl/XefJVDAbYleJGYfS9ES56EDybIAegq+V6o+n++a2ZRaGovGe9ZiHHFitggewnXMCzE0FTFCNiPeDJGkmQeRsxGzBZK4zMLuNlFbPCC6ipmXB5MG2VFooHb6Q4kubhDqM8/2VonMCE+ANjLkhS0XTRkYxw8VmfKokQS1lrP7acd65RW0ALKSRSUj2Tsu9Ag2ED8beBTQ/78GUdQcir3lDSu0rp/01vNKoSSPshRiKomjYb14gXzkGz/pgVKbLm3WE2GZGZtSKM8L5BAOaVOxQwhr7PATwytHdMI6DcV3HeqsaBb7YbUm3IOHxwRNWfMKE2gEqvnvBrWaXYnmZDasL1jjDGCNydWN4bRVm1xhc1S4lih5Mwuzk5BF0IKWHDek/aTt0kd+X9BajeMrdGSYf2vOn1/TCmI2gcgXoBeO+XGWj0WEDelICgi14yYnBKSaPVmz7fUUkdKt8v4zObQj+W8XXP+/iNDGQ3XWYZZ+S8JOnNY5j+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB6798.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(376002)(346002)(366004)(136003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(9686003)(6512007)(38100700002)(478600001)(6486002)(5660300002)(44832011)(8936002)(8676002)(4326008)(4001150100001)(86362001)(2906002)(316002)(6916009)(54906003)(66556008)(36756003)(41300700001)(66476007)(66946007)(6666004)(53546011)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?C2wOjEg4JWsLqtt7kS/qp5lOocTOMFJVwWfVPHe/KxnGPLjbGxWZ1FIlJS1B?= =?us-ascii?Q?2Y/ktwRzv4hy4P52d8i3HQntWt+m5ocOX7Xumw3RHft1X3oTA7cQav6jN9YT?= =?us-ascii?Q?NFByezDK8ZS+DpEQ6kPiONoTwpxLWLuHL3zbg7hbfktPIbEqbT3TUbYwQl1f?= =?us-ascii?Q?TqmRfPsC0AKClYc7/idpsdcbiPiMLy8GkJewv7FxhhaezJrbvLlQgdkcA4Ee?= =?us-ascii?Q?uzfGSv86Pa3H8qcP3TiYMBsGnu6Q0un3Ge7Qf40fNGP61dZ/PeSHTp6LGzRk?= =?us-ascii?Q?1/o+eR3ZR93NzkZ+tzo4NVffyOpcP9QDCyoT9LR8/Nb7ol4NOZIVha7qe1P5?= =?us-ascii?Q?7I3oHEeRT2m6mAsu3iot8ayo8ZROX2BFwgZxylSXLW5XO4NIDJKPHHEhrkcV?= =?us-ascii?Q?GrdCfzDOykueRocP3KBSWwZlqAivUG8wPPEd+gawBZ8Tx0yW2YHNQKntK16X?= =?us-ascii?Q?pwEBoMGoe/ifpK4RKMgRmnloHS3sXxjn7dQKHcGLohvDpIhtlfqQ7DLKmnic?= =?us-ascii?Q?B0spmtuuCCna6Xqiqc32rrKwjizHK7PFORvQLt4YPRYqXe5U4IPd6WE5crVQ?= =?us-ascii?Q?pCQQUOmUrBNMjExlahVytW9GjPRdeSfogtYeoCtKPcRkTnT4E4NqXFj8Jdr6?= =?us-ascii?Q?v5RhTcxOD0jKYbCzrClSvT/ufBVbnEPXjU03Y7V6uwi4C0hEXQtAYuAsikSU?= =?us-ascii?Q?xblu5Qq8r06QNVwaA8FaAC266ezWMDNcj3nNoR+kJi8Rpo6F/Vwirl1kAtYy?= =?us-ascii?Q?TvPUMoS3dcS5bsATGFld7/1v3mfTNA6Dxreezs8jFLXh+5uOQYqEx517XqYR?= =?us-ascii?Q?Savg3RKEjs+q31IHflyty+CDzBP1EVhj3hwDIS/sowfNL93XqEU3uzGtYKb9?= =?us-ascii?Q?eR06TVdfAnmkTrbvqlbpRkojUpdQEaCEnERNvL/FGArO2aznF4EZZJKzHuBY?= =?us-ascii?Q?EcroZspFI9k0Di80KCy64ebnWoT+pEtBqPv+u+8SyJpH0+DJkGxE6kp+rmO4?= =?us-ascii?Q?iZGHt9LO93XLdAumkR0QGCG3lpyeOrJdKyhTbACmvDpyQ4iSXD4WzHeMGjbU?= =?us-ascii?Q?q2gu8CubLcIvI1mla9WPl5ZR5j1kuRI5xPLN8v442HQ4jkDy81DrL4za/ZWW?= =?us-ascii?Q?Y2TpiF6Yvkt+M1WF2yghLle8PhUHyeSfvb+umbjAWiZlw7dH1kXJe5GJq0At?= =?us-ascii?Q?v1p3g6OJN0LXkRr0T3ge6XyCv2flXt066jyf/bCdfW3tcl68qjI0jvjkYJvc?= =?us-ascii?Q?VZJdkAkFkDYcV3GlQSpzsLUKA05mlVBf3wmLcMCNlmBGZVAjQcG2g6K+SeJT?= =?us-ascii?Q?gl/187SpGB4RK0s3BwJCEZvlfqfnfLssSF/LZIP3DNGljz3344c9/tcrOwIy?= =?us-ascii?Q?gnevoO0mrHynM6xTOrNGcrw7RtRYIrxBG2xwyQo8as+L3Hyr9B1Urby6OacH?= =?us-ascii?Q?F+AewU6P82MtcyDEMEylWTqIxLjX9ZjB6Qgj1pxe9OE9zEH7cYlHkwqFO1A7?= =?us-ascii?Q?mokw5D9z4HyCGM2BFtafNBBKQIYzVkMIFWEtCSDFZPSIuHWqWzLMlg4DXhoh?= =?us-ascii?Q?A++Ej89n6XlsXLyQCVWXQRwMD7gx9aUA9BAx9Lqm6LvOW3wLKrngIYGE03Hb?= =?us-ascii?Q?pw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: n2fsvHln3x9LD/QRik7vHyJP+NCwqJOmhmqoxHqA+FMSx9TGR2WdqEOYSls2mhfCZgIU7JXdfHtrud9pJn5vkwuaqNU3I9pqfC3Jxw0DJf7dPNQTYeIWm5oIuh3tdx1D3mDki7hiQRBkm0hmTHv13t1NYCIH0DmQzUU8b3/I0DUsEVva0MVkqjlQSudtR9GHHCCOb2rgTYHwvO1iqbz1eq7x021QIqgN7Z5jNu9CFUdSNLcbYEIPP+EEM9vZ5bQPxW3BZ4uDMa1SdJi0vbFzYKogxY/Op0z35UdPqzkkcGff5CTMWMMi1Dib5iRVvir2XIC3iVVcdRmhUcWb9ETGzN/WqHQrHTtn+BTQALKHD+A23hqEpdnAGommdF5ldErGBsyAW5XNOAZGWztixaAYPWLHxC8dnsZa8fk9FieL32Xxs5Yb183XrZycLrsF7I7jaHAOvs3oKHd8ABfephEIKxdTzyMifC83LnpgDY7wJ3rfYsqT1YBW8y5D2B/cgUOCpEBljyXq5+LVCrJ/GZA1PYDdmyaJhcdR9Eebil8P0vlDbvPo7YvYdxTlotvjdIS2ebxwuIeEKbVsAUU50R0EgSwdLRazEMuIre2R4XqbpTZWxwarHYRaSTv84SwzkyJoEpWDqQl3rcFQ5ixMry86HO3wkYcw0kqprWj6KtJ7qtpzWbVGLt4fi57oiBDSO7z8fthUeCLne8+KoXAfrzOAvT80KXjzOr7gwODowrV9wMw9FL8d9FZdRaTFn5Z9Tel8+PCQtWoDySqcxod/VJKouUjvZvKxzwedkwDFZn1tEBw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd79ba88-6c3c-42a1-983d-08dbcdb39773 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB6798.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2023 19:19:02.8892 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AcMJB7mCmTTvTSwIIwaoo5x0sPQl2izsRidu2oY0EVUN7xHH4tpkd1sszHxN0mFUhZu7gn4WWqckNuZbtnRuyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5151 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-15_06,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310150176 X-Proofpoint-GUID: uNKGBJayJkr0gmwhcrDWhGarB_VuauSa X-Proofpoint-ORIG-GUID: uNKGBJayJkr0gmwhcrDWhGarB_VuauSa X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 13 Oct 2023, Torbjorn SVENSSON told this: > Hi Nick, > > Thanks for validating this patch! > > On 2023-10-13 16:01, Nick Alcock wrote: >> We do this as a writable test because the only known-affected platforms >> (with ssize_t longer than unsigned long) use PE, and we do not have support >> for CTF linkage in the PE linker yet. > > Is it visible in PE too or only PE32+? Maybe not important, but the > Arm built variant does not trigger the fault (same source tree as I > found the issue in, but they build 32-bit and I build 64-bit) when > I've executed the GCC testsuite. The underlying fault is client-side and is visible in anything that does a ctf_member_next on a platform with sizeof(ssize_t) > sizeof(unsigned long). The specific instance you saw (a hanging linker) requires CTF in the input and a linker that deduplicates it, and right now that is ELF only (because it was painful enough to add that I didn't have the stamina to add anything else -- if anything else *is* added, it will probably be PE next, but right now linking PE just blindly concatenates CTF sections, which isn't very useful). >> PR libctf/30836 >> * libctf/testsuite/libctf-writable/libctf-errors.*: New test. >> --- >> .../testsuite/libctf-writable/libctf-errors.c | 74 +++++++++++++++++++ >> .../libctf-writable/libctf-errors.lk | 1 + >> 2 files changed, 75 insertions(+) >> create mode 100644 libctf/testsuite/libctf-writable/libctf-errors.c >> create mode 100644 libctf/testsuite/libctf-writable/libctf-errors.lk >> Your patch looks good, and passes every test I can throw at it. I think >> it can go in. You cleaned up a bunch of outright errors in this area, >> too, especially in ctf-dedup: thanks! > > There is still some potential for cleanup as some functions are > returning "unsigned long", but think it should perhaps be ctf_id_t > instead. The only one of those i can see is ctf_lookup_symbol_idx. That's returning a symbol index, not a type ID, so should definitely not be returning a ctf_id_t. Perhaps it should be an int, but I'm not sure how big symbol tables in the set of all executable formats can actually be... Hm, actually, there is one bit you might want to adjust in ctf-lookup.c. You fixed one call to ctf_lookup_symbol_idx () in ctf_lookup_by_sym_or_name (): if ((symidx = ctf_lookup_symbol_idx (fp, symname)) == (unsigned long) -1) goto try_parent; but the other one, in ctf_lookup_symbol_idx () itself (doing a recursive call to check parent dicts), still says if ((psym = ctf_lookup_symbol_idx (fp->ctf_parent, symname)) != CTF_ERR) Both symidx and psym are unsigned long variables, so probably both should be checking against (unsigned long) -1. >> (You probably want to adjust the commit log so that the version history >> is at the bottom rather than the top, or drop it entirely.) > > My plan was to drop that part. Aha right. > Do you think I should have a changelog entry for the commit and if so, > what should I write in it? Should I list every function that is > touched (more or less half of the ctf_* functions defined...) or is > there some better way to document this change? You can just say Affected functions adjusted. or something. A giant list adds no value, I think. >> Here's a testcase that fails on mingw64 in the absence of your patch, >> without requiring a cross-build to an ELF arch. (It also checks at >> least one instance of the other classes of error return in libctf.) >> I'll push this after your commit goes in. (I can push it, with an >> adjusted commit log, if you want. > > Fine either way. Either reply to my question about changelog or just merge it with the correct answer :) ... I think there's one more tiny change :/ >> + /* Third error class: ssize_t return. Create a type to iterate over first. */ >> + >> + if ((itype = ctf_add_integer (fp, CTF_ADD_ROOT, "int", &encoding)) == CTF_ERR) >> + fprintf (stderr, "cannot add int: %s\n", ctf_errmsg (ctf_errno (fp))); >> + else if ((stype = ctf_add_struct (fp, CTF_ADD_ROOT, "foo")) == CTF_ERR) >> + fprintf (stderr, "cannot add struct: %s\n", ctf_errmsg (ctf_errno (fp))); >> + else if (ctf_add_member (fp, stype, "bar", itype) < 0) >> + fprintf (stderr, "cannot add member: %s\n", ctf_errmsg (ctf_errno (fp))); > > Should these be if-else-if-else-if-statments like above or just 3 "free-standing" if-statements? I.e. should the 3 potential issue > be visible in the same run or should they require 3 consecutive runs if all of them are failing? I was wondering if this was too clever (or unclear!) but the intent is to only do the later things if the earlier ones didn't fail, i.e. what would be foo || bar || baz in the shell. (Later operations will also fail if any of them fail, but the fprintf's from the first failure will suffice to make the whole test fail -- so maybe it's safe to just do them in sequence even if the earlier ones failed. Excessive paranoia on my part perhaps, given that we don't *expect* any of these to fail: it's just setting things up for the *actual* tests, of ctf_member_info and ctf_member_next.) >> + if (ctf_member_info (fp, stype, "bar", &mi) < 0) >> + fprintf (stderr, "cannot get member info: %s\n", ctf_errmsg (ctf_errno (fp))); >> + >> + /* Iteration should never produce an offset bigger than the offset just returned, >> + and should quickly terminate. */ >> + >> + while ((ret = ctf_member_next (fp, stype, &i, NULL, NULL, 0)) >= 0) { >> + if (ret > mi.ctm_offset) >> + fprintf (stderr, "ssize_t return: unexpected offset: %zi\n", ret); (here.) -- NULL && (void)