On Mon May 27, 2024 at 2:33 PM CEST, Martin Mareš wrote: > Hello! > > > On a musl-based system (Alpine-linux) the basename(3) function is not defined > > by including string.h with _GNU_SOURCE defined. However basename(3) could be > > defined by including libgen.h. > > > > On musl this is a problem than can lead to a segmentation fault, as I have > > experienced. This issue is caused by basename(3) function being implicitly > > declared and thus having, implicitly, a return type of int. Which in my case > > caused an erroneous sign extension of a pointer leading to a segmentation > > fault. > > > > Adding an include for libgen.h sound to me like a proper solution. > > Also by doing so the `_GNU_SOURCE` defined is no longer needed. > > It should be fixed by commit 89cb2ae87236604b0e8ededd0fd7d9425c2d8cb6. > > Could you please check if it works for you? Yes, it does work.