Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Clayton Craft <clayton@craftyguy.net>, iwd@lists.linux.dev
Subject: Re: [PATCH] wiphy: include libgen.h to fix implicit def. with musl libc
Date: Wed, 14 Feb 2024 10:26:37 -0600	[thread overview]
Message-ID: <f9970105-c1c7-484b-8e13-5ca5f5bae901@gmail.com> (raw)
In-Reply-To: <152B8E7F-C6D0-4827-AC38-25454FD6BAF7@holtmann.org>

Hi Marcel,

On 2/14/24 01:03, Marcel Holtmann wrote:
> Hi Denis,
> 
>>> This fixes a runtime segfault with musl libc and GCC13. musl dropped a
>>> basename prototype[1] in string.h, causing GCC to define it implicitly
>>> with the wrong function signature. The correct basename definition based
>>> on how wiphy uses it is in libgen.h.
>>
>> Hmm, why did musl do that?  man 3 basename indicates that the libgen.h version implementation is free to scratch in the input argument, while the string.h one doesn't.
>>
>> In this particular case it doesn't matter since driver_path is never used again.  Still, the string.h version is much more intuitive.
>>
>> Maybe this should be re-implemented in missing.h or ell (say l_file_basename or l_dir_basename) instead?
> 
> we can also just do a l_util_basename that does the right thing and allocates a new string from it.

We have l_path*, so I guess it would be l_path_basename.  That would work as 
well in this case.

I only see two instances of basename() use in ofono / connman, both in 
src/log.c.  Given that the only real user is iwd, I wonder if we should just add 
l_sysctl_get_driver() API instead?

Regards,
-Denis

  reply	other threads:[~2024-02-14 16:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 18:47 [PATCH] wiphy: include libgen.h to fix implicit def. with musl libc Clayton Craft
2024-02-13 23:09 ` Denis Kenzior
2024-02-14  0:13   ` Clayton Craft
2024-02-14  7:03   ` Marcel Holtmann
2024-02-14 16:26     ` Denis Kenzior [this message]
2024-02-14 16:30       ` Marcel Holtmann
2024-02-14 16:35         ` Denis Kenzior
2024-02-14 16:39           ` Marcel Holtmann
2024-02-14 16:46             ` Denis Kenzior
2024-02-14 16:52               ` Marcel Holtmann
2024-03-14 22:30                 ` Clayton Craft
2024-03-15 13:49                   ` Denis Kenzior
2024-03-15 22:09                     ` Clayton Craft

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=f9970105-c1c7-484b-8e13-5ca5f5bae901@gmail.com \
    --to=denkenz@gmail.com \
    --cc=clayton@craftyguy.net \
    --cc=iwd@lists.linux.dev \
    --cc=marcel@holtmann.org \
    /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