From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by sourceware.org (Postfix) with ESMTPS id B6D223858D20 for ; Thu, 14 Dec 2023 18:15:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6D223858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B6D223858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702577729; cv=none; b=bd9+qtYZlSLC4+IS0xd8wUO8Xh8gsNtQFLgbmQ415UlFUXoZH+GTjwi8pDloKCYsD5Af6jFiIjIj/fYWH1xJs9TfseOus+9IhkJcs1uvpzA1vWw6lJOWPyV8lcbprEr+sUFPB0RoMDzsJ+hc7Dxv8AIsgyrWaU7h4ka8qcwtnLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702577729; c=relaxed/simple; bh=NdEecNH+T0Q1Bg5sPMSmV2WHTW+3g2hm6YJQdqUcqY0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=sL4L2BBdCo806J6o9YuLkk2N0tE0vv7zlfUVk/hnPIIg6BhudZzFR35TUv9gpsim1J7UBOC7LKQ7C77JPRYRC+KLJ6zTKZ/IaeW5iMS4NdmaLkS16Y77YOmWreld5wQtk5ybCwhWdWLuPDX753WiHwhfrZT/Y0GFsHFwGrMdnio= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-20315d10afaso1817085fac.0 for ; Thu, 14 Dec 2023 10:15:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702577727; x=1703182527; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NdEecNH+T0Q1Bg5sPMSmV2WHTW+3g2hm6YJQdqUcqY0=; b=aCoiFqW1l6dlcjXUth0mGxBHOvVMHgpFfnvFR2zWxg1FP0pk3lzaT9VGo4uExzJ78v C0DYSK0Eib2iNrvqzWCUORjkzLMf9tc2kWwJzlH0/J+8WZSyxkHcHdGIDzD+sEsSCizn InyAYq87eWAEUarksmKRKTznJ72VJ7gRq/0n8SoVzce1r3bm9HWRM9eWi1/4xvVUefGi woGnCSHSopVsWuw/sFeNJzOyt3Nc8E3F1WU3bbK0iiiO3eiU/qt3W7R9HXSCgolT+TDQ XFeu6tSFwdQWb2lXzwVy4+fTjAGYz4n9xBY9+sIlMuB3VszjICl7LzF9LXKHppI0qW+R weIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702577727; x=1703182527; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NdEecNH+T0Q1Bg5sPMSmV2WHTW+3g2hm6YJQdqUcqY0=; b=MDXdLvuQYL+wGoAqxgZT2yCQglHcRe7FovsoWkmSPox9rMQaXXQisrT5jeevnqBIlX AFp6jdpr23OkY4jYXGkc1R0LfKtH1nj1/11va1ebmwti1krKh/a2hp2NINe/4b154Mk3 eAiQ6B93c1P9jIO4UFMp9tOBv0XKHuoRgIzJhv2+3b2Hz6pPfnyRR7tgGu9xEqJs0jGa aDtsSy69hRL7THkdPtADPPV2p1mx7IDbifXM9nDSq09OMFpNdd+vrogc9M5FzsWy5/6R gsPolIR+nlEZweF1B0SLp9BZLIJ6Ph8UzyMKfpRElp/KCthGhg5kozZkzxrrnwhnCKFu nuYg== X-Gm-Message-State: AOJu0YxfTcjUX4dKI/jXgOhfPg2RqekCXqGwpbOzn6VdSJt+i9sBZpUb iy02RXfPMcIcLbzCNLaIq7aejnt151p4+p55SATR0Hku X-Google-Smtp-Source: AGHT+IFy5/5bBGfHB5RJQQ8u9Q8XA580cQuebz4clRz2q5bV2IpBiVtSTEMEws22PGnsEbrGw83x7GtAQAO0vccZnuk= X-Received: by 2002:a05:6870:2393:b0:203:55e6:7678 with SMTP id e19-20020a056870239300b0020355e67678mr845973oap.40.1702577726688; Thu, 14 Dec 2023 10:15:26 -0800 (PST) MIME-Version: 1.0 References: <20231210202033.151578-1-raj.khem@gmail.com> In-Reply-To: From: Khem Raj Date: Thu, 14 Dec 2023 10:15:00 -0800 Message-ID: Subject: Re: [PATCH] Add helper function for basename To: Mark Wielaard Cc: elfutils-devel@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 Thu, Dec 14, 2023 at 10:07=E2=80=AFAM Mark Wielaard wro= te: > > Hi Khem, > > On Sun, 2023-12-10 at 12:20 -0800, Khem Raj wrote: > > musl does not provide GNU version of basename and lately have removed > > the definiton from string.h [1] which exposes this problem. It can be > > made to work by providing a local implementation of basename which > > implements the GNU basename behavior, this makes it work across C > > libraries which have POSIX implementation only. > > > > Upstream-Status: Pending > > [1] https://git.musl-libc.org/cgit/musl/commit/?id=3D725e17ed6dff4d0cd2= 2487bb64470881e86a92e7 > > Signed-off-by: Khem Raj > > Our discussion showed we really need this if we want to support musl > (or any other alternative libc without the string.h basename variant). > I would have liked a configure check, but old musl makes that kind of > impossible. So I agree we should use our own implementation. > > I did structure it slightly differently though. Instead of adding it to > libeu I added it to system.h as static inline function. And I poisoned > the basename symbol. That found two other places where basename was > used (and now replaced by xbasename). Sadly it means we have to rename > a variable in debuginfod.cxx from basename to filename, but I think > that is acceptable. > > I don't like the const cast away in ar.c, but that seems necessary > because we are using search.h and that interface just takes non-cast > char pointers (even though they really are const). > > What do you think of the attached variant of your patch? Overall, this looks a good improvement on top of my patch so good to go. I will also try it in my local distro builds and see how it goes. > > Thanks, > > Mark