Um 14:42 Uhr am 24.09.20 schrieb Kern Sibbald:

> Unless there is some new major bug found, this will be the last of the 
> 9.6.x releases. The next release major release (a really big one) is 
> currently scheduled for December.

During compilation on 32bit Debian Sid with gcc (Debian 10.2.0-9) 10.2.0
the following happened:

fstype.c: In function 'bool fstype(FF_PKT*, char*, int)':
fstype.c:207:12: error: narrowing conversion of '4283649346' from 'unsigned 
int' to 'int' [-Wnarrowing]
  207 |       case 0xFF534D42:     fstype = "cifs"; break;          /* 
CIFS_MAGIC_NUMBER */
      |            ^~~~~~~~~~
fstype.c:216:12: error: narrowing conversion of '4187351113' from 'unsigned 
int' to 'int' [-Wnarrowing]
  216 |       case 0xf995e849:     fstype = "hpfs"; break;          /* 
HPFS_SUPER_MAGIC */
      |            ^~~~~~~~~~
fstype.c:217:12: error: narrowing conversion of '2508478710' from 'unsigned 
int' to 'int' [-Wnarrowing]
  217 |       case 0x958458f6:     fstype = "hugetlbfs"; break;     /* 
HUGETLBFS_MAGIC */
      |            ^~~~~~~~~~
fstype.c:234:12: error: narrowing conversion of '2768370933' from 'unsigned 
int' to 'int' [-Wnarrowing]
  234 |       case 0xa501FCF5:     fstype = "vxfs"; break;
      |            ^~~~~~~~~~
fstype.c:237:12: error: narrowing conversion of '2435016766' from 'unsigned 
int' to 'int' [-Wnarrowing]
  237 |       case 0x9123683e:     fstype = "btrfs"; break;
      |            ^~~~~~~~~~
make[3]: *** [Makefile:150: fstype.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/build/bacula-9.6.6/src/findlib'

The full build log is available at 
https://salsa.debian.org/bacula-team/bacula/-/jobs/1023910

Applying the following change fixes this problem:

--- a/src/findlib/fstype.c
+++ b/src/findlib/fstype.c
@@ -188,7 +188,7 @@
        *
        *    $ grep -r SUPER_MAGIC /usr/include/linux
        */
-      switch (st.f_type) {
+      switch ((unsigned int)st.f_type) {
       /* Known good values */
       /* ext2, ext3, and ext4 have the same code */
       case 0xef53:         fstype = "ext2"; break;          /* 
EXT2_SUPER_MAGIC */

The documentation of statfs(2) says:

,----
| The __fsword_t type used for various fields in the statfs structure
| definition is a glibc internal type, not intended for public use.  This
| leaves the programmer in a  bit  of  a conundrum when trying to copy or
| compare these fields to local variables in a program.  Using unsigned int
| for such variables suffices on most systems.
`----

Which explains why st.f_type is architecture dependent and fails on the
stricter GCC10.

Grüße,
Sven.


_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to