From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by sourceware.org (Postfix) with ESMTPS id 5C3E63870891 for ; Mon, 1 Mar 2021 13:03:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C3E63870891 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 121D0XiP098586; Mon, 1 Mar 2021 13:03:39 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36ydgr3r58-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Mar 2021 13:03:39 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 121D0rdI099747; Mon, 1 Mar 2021 13:03:38 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2108.outbound.protection.outlook.com [104.47.58.108]) by userp3030.oracle.com with ESMTP id 37000vg96k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Mar 2021 13:03:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLuKB3m37G48hkqfriOunIfN2/lh7FPq7rnb0cbgbwR3DNhiBB9+/zVOfjJCWj9KMSDQpsdLjOX2ov8iD7mDHMaZFG5XiMnRk/WgKK4fUQ6xQCZm1gFzjoz6m0oub5CU8gBl5tc/ixnikqKq2KpWHVzqQvG8ilp50oW0qYa0i/MVzTErzloL7toCr2u0i3SttqKOKJxXmIBm+lSuN3awyAglsip8hqgEUVi/x5gjMvvH8i7N+wZRX6iKTP0hWVT8ifNlo91k2gI3KpGJj8gL7O8VyQJEUAGhHu1Cl9ZS75oZqcD6EYfaVWC+SEk9ZFkh3maPGHnvchKzY29quJOr1A== 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-SenderADCheck; bh=0iuxzL5R55ikmpTGD9/hTCI0j9pzM+zmoFhDTY0DCdI=; b=goUeV3+9PrHqPDUOUqRuZH275raYmvxrvarAAtLCmBxKMr2lQPQq5Wi0C4D0EWEncBxoOPm5ZQ/tDy99XijxyaQhArd+Jw/upXXVuosNqxjBr6Qls3jMCwlPdlbqDyw1b4jsrB/XiVwRslL43jhT9/ZA4ES7DAaXNA++1HF3RWwaa8giAuNBI4aIYB0bqZcF2RPwXhDi7NUju4cvMQNDT3ieX5xr2ps6lGeN+MjpclKyd5VH+orO7qhoG41pYiwg13i2caP/aqZOd5dlZa1nLudZ23TGmnAcAWREzIU8wYmRsfUyWQrnfizHGl3M6cW3qzKWIXFpAHNamXCWz3UXBg== 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 Received: from SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) by SA2PR10MB4731.namprd10.prod.outlook.com (2603:10b6:806:11e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Mon, 1 Mar 2021 13:03:36 +0000 Received: from SA2PR10MB4715.namprd10.prod.outlook.com ([fe80::bdcf:f0:1350:5fa2]) by SA2PR10MB4715.namprd10.prod.outlook.com ([fe80::bdcf:f0:1350:5fa2%6]) with mapi id 15.20.3890.020; Mon, 1 Mar 2021 13:03:36 +0000 From: Nick Alcock To: Nick Clifton Cc: Martin =?utf-8?Q?Li=C5=A1ka?= , "binutils\@sourceware.org" Subject: Re: RFC: Adding a fixed format output mode to readelf References: Emacs: resistance is futile; you will be assimilated and byte-compiled. Date: Mon, 01 Mar 2021 13:03:31 +0000 In-Reply-To: (Mike Frysinger via Binutils's message of "Fri, 26 Feb 2021 13:51:53 -0500") Message-ID: <877dmrm3fg.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3.50 (gnu/linux) Content-Type: text/plain X-Originating-IP: [2001:8b0:1101:10::2] X-ClientProxiedBy: LO4P123CA0007.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::12) To SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from loom (2001:8b0:1101:10::2) by LO4P123CA0007.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.28 via Frontend Transport; Mon, 1 Mar 2021 13:03:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 255a0ef9-4fc8-4c6f-c206-08d8dcb26d1b X-MS-TrafficTypeDiagnostic: SA2PR10MB4731: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LyB95F02G8Kx/rs3kj9rYoYbrjOSgYn3/Y0PZpqbDcl5D8NeAYlSsm6rHx/Vz2jk/IySrsMK6xeoC5lCmiXnurFgJ1BfXILKJ6uunBPaN2FI21v6zlwLRoHDQT7iQDJLCE/rXCRmW+AlM19UaOxV5uXXT+8lQrL1JqwJlWahBbhM1kmygcq5qvfVbNjOoe/+QifUWFut5QS1hXQzhv7+pIsOZsSWN965SDWU+Q5ijeoA7x+A6X3/pTj/9TSsM9dYFhDiXWdrEJz3LKYw7eNcgP11+kMOcCBEetGgB1KKWfPKCuWxICEx+3PFPngTEO0jJzzGhgPI1TDOhazsfpLJyKzzXOR8cUu2avYTzwVq0RvtVEBHGEeN/gCol+oA8f3l+Qv0EzMUpAm5O8c3j5uTgUlEs+YPdLby7/PCkS57svHVM/PQpLDaSEsBjzPaiiRQJb8Ea6ncbXkOUspPH0LwESFxbwmza99M214E7HwWwUPOXhrsu5wa2M958nGK4XLjMum6OTOnWQODq1Om5vR97Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4715.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(39860400002)(396003)(376002)(346002)(136003)(66476007)(66556008)(66946007)(8936002)(83380400001)(478600001)(8676002)(316002)(36756003)(6486002)(53546011)(6916009)(4326008)(2906002)(6666004)(54906003)(6496006)(52116002)(44832011)(9686003)(86362001)(186003)(16526019)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?ooJ4zKXGUPyZ1S6NAweqYCwTl40Q/HdYOQvtCkSp1B8LO3UdcytXqG3N5DlK?= =?us-ascii?Q?6PnS1jIrhImcoQvMGHjNk/2S8RTeUuDq00VDCGfiNO5Q/Sca83JSHBHvPWUT?= =?us-ascii?Q?Oti+AFk6mh7dIzeH+ANSvfVHnyrZU6J0HCRcb7WikuQFqr4LAWMNAhaWUTU7?= =?us-ascii?Q?+2xAZMWawlS+Apd76FrTBQsVAoCN3zNJTWo2FZhsHBGUbjJ1OlhH6iSAWsTo?= =?us-ascii?Q?shibJFbzWqgzRtn+Y0kEsFneFYRQib0XpJTA1p6Axc3zULigzsl1TdG/TZM1?= =?us-ascii?Q?kcMZCGaTv3c/1XzQfRgfEYYTScVdUhzSAF3OkYP4VssVSFehZ4jv0xJerTsW?= =?us-ascii?Q?jiPO50fki/vLyQ9B91jP5EbqMqT/xwQA0Ew6Y6+VQPp/FW8oNE+W6Z9C1Afe?= =?us-ascii?Q?KqU/TkpuoV6W2EpJBf4Spe+PfCgTOoCZc1Jo8C3qTIhpLOwg0f9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5Et6iv3aZYD+SSNo59OVH1x1N8V7A=3D=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 255a0ef9-4fc8-4c6f-c206-08d8dcb26d1b X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4715.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 13:03:36.7174 (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: 26Fsl6/lIgB/72/IS0s0C+T7nJQZeKxUlgbMvuAKmJYPlAm7adl802WkbgLiHQZoFb8TS0ySfsWcYxyY9qiZqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4731 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9909 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=738 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103010107 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9909 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 impostorscore=0 clxscore=1011 suspectscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103010107 X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2021 13:03:44 -0000 On 26 Feb 2021, Mike Frysinger via Binutils told this: > On 26 Feb 2021 17:03, Nick Clifton via Binutils wrote: >> PR 27309 got me thinking about readelf's output, and whilst it is >> true that we do not make any guarantees about the format or contents >> of the output it appears that other packages are becoming reliant >> upon its currently established behaviour. >> >> So I was wondering whether it would be a good idea to introduce >> some kind of fixed format output option, and what exactly this >> format might look like. Do you have any opinions on the matter ? > > having an official machine readable output format would be nice. it's def > true that a number of scripts out there have already grown dependencies on > various output modes of readelf for lack of alternatives. The JSON output mode in iproute2's tools is really useful for simple automated realtime response stuff, fwiw. > the --format mode only works well though when there's not repeated fields, > and the data is simple (e.g. just printable ASCII). unfortunately ELFs > are the opposite of this :). for example, if the user wanted to dump all > DT_NEEDED or DT_RPATH tags, how would those be shown in a way that is > reliable and parseable ? > > JSON would handle both of these issues. but i think in the low-level tool > space that we occupy, there's a general aversion towards things like JSON, I don't know why. The JSON format spec is a horror, but that's only if you have to parse all its quirks. Simply generating valid JSON (when you can decide not to emit any of the badly-specified quirks) is easy enough. (FWIW, though it is only a very minor part of things, I would be happy to add a JSON output mode to ctf_dump(), which both objdump and readelf use.) > so i'm not confident how well it'd be adopted, which would kind of defeat > the purpose of doing this in the first place. i think the biggest reason > for JSON dislike is that there is no standard tool for parsing the format, > so people have to use something higher level (like python) or something a > bit non-standard (like jq), or something terrible (like sed/awk + regex). I find it surprising that nobody thinks jq *is* a standard tool by now. (My only complaint about jq is that its syntax for doing complicated stuff is *also* incredibly confusing...) Another interesting thing for exploring JSON and related formats is nushell. It's completely bizarre if you think of it as a shell, but if you think of it as a structured data explorer... it's still not as good as a hurd translator from/to JSON would be, but it's better than any alternative I can remember seeing.