[File] One more set of observations from static analysis
Christos Zoulas
christos at zoulas.com
Mon Jun 8 20:56:17 UTC 2020
Hi Steve,
I have not tried it, but it looks like with your changes we'll get:
#define MAGIC_VERSION "5.38" /* This implementation */
and not:
#define MAGIC_VERSION 538 /* This implementation */
like we used to. The string is not useful as a CPP symbol to compare against.
This is why I wrote before we'll need some m4 in configure.ac to define
a new version substitution symbols.
Best,
christos
> On Jun 8, 2020, at 4:46 PM, Steve Grubb <sgrubb at redhat.com> wrote:
>
> On Monday, June 8, 2020 4:17:22 PM EDT Christos Zoulas wrote:
>> Unfortunately magic.h is handled in Makefile.am in src:
>>
>> 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} > $@
>>
>> Now we could write some m4 that does this during the configure phase
>> so we can add it in AC_CONFIG_FILES()...
>
> I think this is all that's needed is below.
>
>> I am not sure though why magic.h did not get rebuilt in your case or if
>> the problem is that the static analysis tool did not have -I.
>
> I make have done a make clean to recreate the object file by a fake make which
> grabs all the config info for the scanner.
>
> I tested this by
>
> ./autogen.sh
> ./configure
> make
> make clean
> make
> make distclean
> ./configure
> make distcheck
>
> and it seems to do everything OK.
>
> Best Regards,
> -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 16:29:34.496754256 -0400
> @@ -217,5 +217,5 @@ 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])
> +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 16:29:59.468751576 -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 @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 16:39:39.862689294 -0400
> @@ -21,10 +21,5 @@ 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} > $@
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20200608/0247b72e/attachment.asc>
More information about the File
mailing list