On 19/07/2023 19:27, Saulius Krasuckas wrote:
Hello,

I am trying to build Coreutils-9.3 from source. [1]

If I run ./configure && make, it builds.

But I noticed that it calculates some things wrong.  So I decided to
enable some debugging.  Any suggestions?
Since I found none, I looked up at the source and noticed the DU_DEBUG
define: [2]

Now if I clean the dir and run make CFLAGS="-DDU_DEBUG", it fails:

--- snip ---
    CC       src/dircolors.o
    CCLD     src/dircolors
    CC       src/dirname.o
    CCLD     src/dirname
    CC       src/du.o
In file included from src/du.c:26:
src/du.c: In function 'du_files':
./lib/config.h:4385:25: warning: implicit declaration of function
'rpl_fts_cross_check'; did you mean 'fts_cross_check'?
[-Wimplicit-function-declaration]
   4385 | #define fts_cross_check rpl_fts_cross_check
        |                         ^~~~~~~~~~~~~~~~~~~
src/du.c:60:31: note: in expansion of macro 'fts_cross_check'
     60 | # define FTS_CROSS_CHECK(Fts) fts_cross_check (Fts)
        |                               ^~~~~~~~~~~~~~~
src/du.c:707:11: note: in expansion of macro 'FTS_CROSS_CHECK'
    707 |           FTS_CROSS_CHECK (fts);
        |           ^~~~~~~~~~~~~~~
    CCLD     src/du
/usr/bin/ld: src/du.o: in function `du_files':
du.c:(.text+0x14b5): undefined reference to `rpl_fts_cross_check'
/usr/bin/ld: src/du.o: in function `main':
du.c:(.text+0x16fa): undefined reference to `fts_debug'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:10638: src/du] Error 1
make[2]: Leaving directory '/home/sskras/debug/src/coreutils-9.3'
make[1]: *** [Makefile:21297: all-recursive] Error 1
make[1]: Leaving directory '/home/sskras/debug/src/coreutils-9.3'
make: *** [Makefile:8434: all] Error 2
--- snip ---

Is this a bug and/how should I report it?

It looks like an issue with gnulib.
With the attached gnulib patch applied you should be able to build with:

  make CFLAGS="-DDU_DEBUG -DGNULIB_FTS_DEBUG=1 -O2"

Note -O2 is specified to avoid compiler warnings at default optimization levels.

It would be useful to know if fts_cross_check() is useful to you.

cheers,
Pádraig


diff --git a/lib/fts.c b/lib/fts.c
index 884b84a5a1..875fe05793 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1736,11 +1736,11 @@ fd_ring_print (FTS const *sp, FILE *stream, char const *msg)
     {
       int fd = fd_ring->ir_data[i];
       if (fd < 0)
-        fprintf (stream, "%d: %d:\n", i, fd);
+        fprintf (stream, "%u: %d:\n", i, fd);
       else
         {
           struct devino wd = getdevino (fd);
-          fprintf (stream, "%d: %d: "PRINT_DEVINO"\n", i, fd, wd.dev, wd.ino);
+          fprintf (stream, "%u: %d: "PRINT_DEVINO"\n", i, fd, wd.dev, wd.ino);
         }
       if (i == fd_ring->ir_back)
         break;
diff --git a/lib/fts_.h b/lib/fts_.h
index fa3d4146e2..82da038a53 100644
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -271,6 +271,10 @@ _GL_ATTRIBUTE_NODISCARD
 FTSENT  *fts_read (FTS *) __THROW;
 
 int      fts_set (FTS *, FTSENT *, int) __THROW;
+
+#if GNULIB_FTS_DEBUG
+void fts_cross_check (FTS const *sp);
+#endif
 __END_DECLS
 
 #endif /* fts.h */

Reply via email to