On Thu, 14 Mar 2024 21:16:51 +0200, Niko Tyni wrote:

> > Not going to upload as-is, as I hardly speak any C and don't really
> > know what I'm doing and this is more than adding a missing #include
> > or prototype and I don't understand the code.
> I assume you mean the '#define _mkdir mkdir' part? The rest
> seems straightforward.

Right, this _mkdir was the part I was mostly unsure about.
 
> AFAICS the code used to call mkdir(2) without the mode argument.
> A simple test [1] indicates that will just put random garbage there,
> so the resulting directory will have a different mode every time. Surely
> that was always buggy.

That was my assumption as well that this is all a bit, hm, broken.
 
> I'm not convinced that affected functions in test/test_defects.c
> or test/test_background.c ever get executed for us though?

I think they don't get executed but they lead to compile errors.

> In any case, your change
> 
>   +int _mkdir(const char *pathname)
>   +{
>   +    mkdir(*pathname, 0775);
>   +}
> 
> is not quite correct: I think it should read something like
> 
>   int _mkdir(const char *pathname)
>   {
>       return mkdir(pathname, 0775)
>   }
> 
> to work properly.

Ha! Thanks, that's what I meant by "I don't really speak C", and
indeed I was wondering how exactly to express this :)
 
> But I think it would be easier to stick with the preprocessor and do
> 
> -#define _mkdir mkdir
> +#include <sys/stat.h>
> +#define _mkdir(x) mkdir((x), 0755)
> 
> instead.

Great.
 
> Hope this helps :)

It does, thank you!


Patch updated, package uploaded.


Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   

Attachment: signature.asc
Description: Digital Signature

Reply via email to