* [PATCH] rdma.c: Add <libgen.h> include for basename on musl
@ 2024-08-04 16:10 Andreas K. Hüttel
2024-08-05 11:05 ` Leon Romanovsky
2024-11-26 19:21 ` Alyssa Ross
0 siblings, 2 replies; 3+ messages in thread
From: Andreas K. Hüttel @ 2024-08-04 16:10 UTC (permalink / raw)
To: netdev; +Cc: stephen, base-system, Andreas K. Hüttel
This include file is required on musl for availability of basename.
Note that for glibc adding the include can have the side effect of
switching from the GNU implementation of basename (which does not touch
its argument) to the POSIX implementation (which under certain
circumstances modifies the string passed to it, e.g. removing trailing
slashes).
This is safe however since the C99 and C11 standard says:
> The parameters argc and argv and the strings pointed to by the argv
> array shall be modifiable by the program, and retain their last-stored
> values between program startup and program termination.
(multiple google results, unfortunately no official reference link)
Bug: https://bugs.gentoo.org/926341
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
Only build-tested so far, but should be straightforward enough...
---
rdma/rdma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 131c6b2a..f835bf3f 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -4,6 +4,7 @@
* Authors: Leon Romanovsky <leonro@mellanox.com>
*/
+#include <libgen.h>
#include "rdma.h"
#include "version.h"
#include "color.h"
--
2.44.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rdma.c: Add <libgen.h> include for basename on musl
2024-08-04 16:10 [PATCH] rdma.c: Add <libgen.h> include for basename on musl Andreas K. Hüttel
@ 2024-08-05 11:05 ` Leon Romanovsky
2024-11-26 19:21 ` Alyssa Ross
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2024-08-05 11:05 UTC (permalink / raw)
To: Andreas K. Hüttel; +Cc: netdev, stephen, base-system
On Sun, Aug 04, 2024 at 06:10:20PM +0200, Andreas K. Hüttel wrote:
> This include file is required on musl for availability of basename.
>
> Note that for glibc adding the include can have the side effect of
> switching from the GNU implementation of basename (which does not touch
> its argument) to the POSIX implementation (which under certain
> circumstances modifies the string passed to it, e.g. removing trailing
> slashes).
>
> This is safe however since the C99 and C11 standard says:
> > The parameters argc and argv and the strings pointed to by the argv
> > array shall be modifiable by the program, and retain their last-stored
> > values between program startup and program termination.
> (multiple google results, unfortunately no official reference link)
>
> Bug: https://bugs.gentoo.org/926341
> Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
> ---
> Only build-tested so far, but should be straightforward enough...
> ---
> rdma/rdma.c | 1 +
> 1 file changed, 1 insertion(+)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rdma.c: Add <libgen.h> include for basename on musl
2024-08-04 16:10 [PATCH] rdma.c: Add <libgen.h> include for basename on musl Andreas K. Hüttel
2024-08-05 11:05 ` Leon Romanovsky
@ 2024-11-26 19:21 ` Alyssa Ross
1 sibling, 0 replies; 3+ messages in thread
From: Alyssa Ross @ 2024-11-26 19:21 UTC (permalink / raw)
To: Andreas K. Hüttel; +Cc: netdev, stephen, base-system
[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]
On Sun, Aug 04, 2024 at 06:10:20PM +0200, Andreas K. Hüttel wrote:
> This include file is required on musl for availability of basename.
>
> Note that for glibc adding the include can have the side effect of
> switching from the GNU implementation of basename (which does not touch
> its argument) to the POSIX implementation (which under certain
> circumstances modifies the string passed to it, e.g. removing trailing
> slashes).
>
> This is safe however since the C99 and C11 standard says:
> > The parameters argc and argv and the strings pointed to by the argv
> > array shall be modifiable by the program, and retain their last-stored
> > values between program startup and program termination.
> (multiple google results, unfortunately no official reference link)
>
> Bug: https://bugs.gentoo.org/926341
> Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
> ---
> Only build-tested so far, but should be straightforward enough...
> ---
> rdma/rdma.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Alyssa Ross <hi@alyssa.is>
> diff --git a/rdma/rdma.c b/rdma/rdma.c
> index 131c6b2a..f835bf3f 100644
> --- a/rdma/rdma.c
> +++ b/rdma/rdma.c
> @@ -4,6 +4,7 @@
> * Authors: Leon Romanovsky <leonro@mellanox.com>
> */
>
> +#include <libgen.h>
> #include "rdma.h"
> #include "version.h"
> #include "color.h"
> --
> 2.44.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-26 19:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-04 16:10 [PATCH] rdma.c: Add <libgen.h> include for basename on musl Andreas K. Hüttel
2024-08-05 11:05 ` Leon Romanovsky
2024-11-26 19:21 ` Alyssa Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).