[File] One more set of observations from static analysis

Steve Grubb sgrubb at redhat.com
Mon Jun 8 22:48:21 UTC 2020


On Monday, June 8, 2020 4:56:17 PM EDT Christos Zoulas wrote:
>         #define MAGIC_VERSION           538             /* This
> implementation */ like we used to. The string is not useful as a CPP
> symbol to compare against.

On a more careful reading, you are right. It needed a sed line to drop
the decimal.

Best,
-Steve

diff -urp /home/sgrubb/working/BUILD/repos/git-repos/file/configure.ac ./configure.ac
--- /home/sgrubb/working/BUILD/repos/git-repos/file/configure.ac	2020-06-08 15:25:53.125164329 -0400
+++ ./configure.ac	2020-06-08 18:42:03.378901257 -0400
@@ -217,5 +217,8 @@ if  test "$ac_cv_header_lzma_h$ac_cv_lib
   AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support])
 fi
 
-AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile libmagic.pc])
+MAGIC_VERSION=$(echo $VERSION | sed 's/\.//')
+AC_SUBST(MAGIC_VERSION)
+
+AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile src/magic.h libmagic.pc])
 AC_OUTPUT
diff -urp /home/sgrubb/working/BUILD/repos/git-repos/file/src/magic.h.in ./src/magic.h.in
--- /home/sgrubb/working/BUILD/repos/git-repos/file/src/magic.h.in	2020-06-04 10:41:49.329075290 -0400
+++ ./src/magic.h.in	2020-06-08 17:38:33.697310076 -0400
@@ -113,7 +113,7 @@ b\31transp_compression\0\
 #define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
 #define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
 
-#define MAGIC_VERSION		X.YY	/* This implementation */
+#define MAGIC_VERSION		@MAGIC_VERSION@	/* This implementation */
 
 
 #ifdef __cplusplus
diff -urp /home/sgrubb/working/BUILD/repos/git-repos/file/src/Makefile.am ./src/Makefile.am
--- /home/sgrubb/working/BUILD/repos/git-repos/file/src/Makefile.am	2020-06-04 10:41:49.324075291 -0400
+++ ./src/Makefile.am	2020-06-08 18:43:29.375892029 -0400
@@ -21,10 +21,4 @@ libmagic_la_LIBADD = $(LTLIBOBJS) $(MING
 
 file_SOURCES = file.c seccomp.c
 file_LDADD = libmagic.la
-CLEANFILES = magic.h
 EXTRA_DIST = magic.h.in
-HDR= $(top_srcdir)/src/magic.h.in
-BUILT_SOURCES = magic.h
-
-magic.h:	${HDR}
-	sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@





More information about the File mailing list