Bug#1066249: libmediascan: FTBFS: api_test.c:80:3: error: implicit declaration of function ‘gettimeofday’ [-Werror=implicit-function-declaration]

Niko Tyni ntyni at debian.org
Thu Mar 14 19:16:51 GMT 2024


[Paul: copying you for eyeballs as this seems to have been your pet
 package at some point :)]

On Thu, Mar 14, 2024 at 06:21:35PM +0100, gregor herrmann wrote:
> On Wed, 13 Mar 2024 12:41:10 +0100, Lucas Nussbaum wrote:

> > > test_background.c: In function ‘test_background_api’:
> > > test_background.c:12:16: error: implicit declaration of function ‘mkdir’; did you mean ‘_mkdir’? [-Werror=implicit-function-declaration]
> > >    12 | #define _mkdir mkdir

> I've pushed a patch to git which make the package compile without
> errors.
> 
> 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.

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.

I'm not convinced that affected functions in test/test_defects.c
or test/test_background.c ever get executed for us though? They have
unpatched horrific things like

  const char *test_path = "C:\\Siojej3";

  const char start_dir[] = "C:\\logitest";

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.

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.

Hope this helps :)

[1] echo 'int main(void) { mkdir("ttt"); }' | gcc -xc - && strace -e mkdir ./a.out
-- 
Niko



More information about the pkg-perl-maintainers mailing list