gdraheim / zziplib

The ZZIPlib provides read access on ZIP-archives and unpacked data. It features an additional simplified API following the standard Posix API for file access
Other
60 stars 50 forks source link

0.13.72: zziplib is not gcc 14.x ready #152

Closed kloczek closed 5 months ago

kloczek commented 6 months ago

Looks like last zziplib 0.13.72 build fails with latest gcc 14.x which is now used in fedora rawhise

Build fails with ```console [ 17%] Building C object zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o cd /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/x86_64-redhat-linux-gnu/zzip && /usr/bin/gcc -DHAVE_CONFIG_H -Dlibzzipmmapped_EXPORTS -I/home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72 -I/home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/x86_64-redhat-linux-gnu -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -DNDEBUG -fPIC -Wpointer-arith -Wsign-compare -Wmissing-declarations -Werror-implicit-function-declaration -Wstrict-aliasing -Warray-bounds -MD -MT zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o -MF CMakeFiles/libzzipmmapped.dir/mmapped.c.o.d -o CMakeFiles/libzzipmmapped.dir/mmapped.c.o -c /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c In file included from /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c:32: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c: In function ‘zzip_disk_entry_fopen’: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/fetch.h:232:41: error: initialization of ‘off_t’ {aka ‘long int’} from ‘zzip_byte_t *’ {aka ‘unsigned char *’} makes integer from pointer without a cast [-Wint-conversion] 232 | #define zzip_file_header_to_data(__p) ((zzip_byte_t*) \ | ^ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c:664:20: note: in expansion of macro ‘zzip_file_header_to_data’ 664 | off_t offset = zzip_file_header_to_data(header); | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/fetch.h:230:43: error: initialization of ‘struct zzip_extra_zip64 *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types] 230 | #define zzip_file_header_to_extras(__p) ((char*) \ | ^ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c:667:12: note: in expansion of macro ‘zzip_file_header_to_extras’ 667 | zzip_file_header_to_extras(header); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/fetch.h:230:43: error: initialization of ‘struct zzip_extra_zip64 *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types] 230 | #define zzip_file_header_to_extras(__p) ((char*) \ | ^ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c:674:12: note: in expansion of macro ‘zzip_file_header_to_extras’ 674 | zzip_file_header_to_extras(header); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c:685:24: error: assignment to ‘unsigned char *’ from ‘off_t’ {aka ‘long int’} makes pointer from integer without a cast [-Wint-conversion] 685 | file->zlib.next_in = offset; | ^ In file included from /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/mmapped.c:35: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/__string.h: At top level: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.72/zzip/__string.h:23:1: warning: ‘_zzip_strnlen’ defined but not used [-Wunused-function] 23 | _zzip_strnlen(const char *p, size_t maxlen) | ^~~~~~~~~~~~~ make[2]: *** [zzip/CMakeFiles/libzzipmmapped.dir/build.make:79: zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o] Error 1 ```
noloader commented 5 months ago

Fedora Rawhide issue at https://bugzilla.redhat.com/show_bug.cgi?id=2261820.

In particular, from build.log:

ro ‘zzip_file_header_to_data’
  664 |     off_t offset = zzip_file_header_to_data(header);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/zziplib-0.13.72/zzip/fetch.h:230:43: error: initialization of ‘struct zzip_extra_zip64 *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
  230 | #define zzip_file_header_to_extras(__p)   ((char*) \
      |                                           ^
/builddir/build/BUILD/zziplib-0.13.72/zzip/mmapped.c:667:12: note: in expansion of macro ‘zzip_file_header_to_extras’
  667 |            zzip_file_header_to_extras(header);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/zziplib-0.13.72/zzip/fetch.h:230:43: error: initialization of ‘struct zzip_extra_zip64 *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
  230 | #define zzip_file_header_to_extras(__p)   ((char*) \
      |                                           ^
/builddir/build/BUILD/zziplib-0.13.72/zzip/mmapped.c:674:12: note: in expansion of macro ‘zzip_file_header_to_extras’
  674 |            zzip_file_header_to_extras(header);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/zziplib-0.13.72/zzip/mmapped.c:685:24: error: assignment to ‘unsigned char *’ from ‘off_t’ {aka ‘long int’} makes pointer from integer without a cast [-Wint-conversion]
  685 |     file->zlib.next_in = offset;
      |                        ^
In file included from /builddir/build/BUILD/zziplib-0.13.72/zzip/mmapped.c:35:
/builddir/build/BUILD/zziplib-0.13.72/zzip/__string.h: At top level:
/builddir/build/BUILD/zziplib-0.13.72/zzip/__string.h:23:1: warning: ‘_zzip_strnlen’ defined but not used [-Wunused-function]
   23 | _zzip_strnlen(const char *p, size_t maxlen)
      | ^~~~~~~~~~~~~
make[2]: *** [zzip/CMakeFiles/libzzipmmapped.dir/build.make:79: zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o] Error 1
kloczek commented 5 months ago

To be honest it is not matter of use gcc 14.x but use in $CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS with latest glibc which turns some warnings into errors 😋

gdraheim commented 5 months ago

This whole "offset = zzip_file_header_to_data(header" was completely wrong upon having a second look. I have removed the older warning so that it should not come up as an error. That will be in the release next month.

gdraheim commented 5 months ago

I have also added to make fortify and I dont see it coming up anymore.

kloczek commented 5 months ago

looking for the fix possibly committed into the repo just found that new release has been added and I had no notyfication about that 😞

Is it possible to start making github releases?🤔 On create github release entry is created email notification to those whom have set in your repo the web UI Watch->Releases. gh release can contain additional comments (li changelog) or additional assets like release tar balls (by default it contains only assets from git tag) however all those part are not obligatory. In simplest variant gh release can be empty because subiekt of the sent email contains git tag name.

I'm asking because my automation process uses those email notifications by trying to make preliminary automated upgrades of building packages, which allows saving some time on maintaining packaging procedures. Probably other people may be interested to be instantly informed about release new version as well.

Documentation and examples of generate gh releases: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository https://cli.github.com/manual/gh_release_upload/ https://github.com/jbms/sphinx-immaterial/pull/282 https://github.com/marketplace/actions/github-release https://pgjones.dev/blog/trusted-plublishing-2023/ https://github.com/jbms/sphinx-immaterial/issues/281#issuecomment-1700933026 tox target to publish on pypi and make gh release https://github.com/jaraco/skeleton/blob/928e9a86d61d3a660948bcba7689f90216cc8243/tox.ini#L42-L58

kloczek commented 5 months ago

Just tested new release and looks like issue still has not been fully resolved

Build fails with ```console [ 18%] Building C object zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o cd /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/x86_64-redhat-linux-gnu/zzip && /usr/bin/gcc -DHAVE_CONFIG_H -Dlibzzipmmapped_EXPORTS -I/home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73 -I/home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/x86_64-redhat-linux-gnu -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -DNDEBUG -fPIC -Wpointer-arith -Wsign-compare -Wmissing-declarations -Werror-implicit-function-declaration -Wstrict-aliasing -MD -MT zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o -MF CMakeFiles/libzzipmmapped.dir/mmapped.c.o.d -o CMakeFiles/libzzipmmapped.dir/mmapped.c.o -c /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c: In function ‘zzip_disk_entry_to_file_header’: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c:280:58: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types] 280 | if (disk->buffer > ptr || end >= disk->endbuf || end <= NULL) | ^~ In file included from /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c:32: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c: In function ‘zzip_disk_entry_fopen’: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/fetch.h:232:41: error: initialization of ‘off_t’ {aka ‘long int’} from ‘zzip_byte_t *’ {aka ‘unsigned char *’} makes integer from pointer without a cast [-Wint-conversion] 232 | #define zzip_file_header_to_data(__p) ((zzip_byte_t*) \ | ^ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c:665:20: note: in expansion of macro ‘zzip_file_header_to_data’ 665 | off_t offset = zzip_file_header_to_data(header); | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c:686:24: error: assignment to ‘unsigned char *’ from ‘off_t’ {aka ‘long int’} makes pointer from integer without a cast [-Wint-conversion] 686 | file->zlib.next_in = offset; | ^ In file included from /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/mmapped.c:35: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/__string.h: At top level: /home/tkloczko/rpmbuild/BUILD/zziplib-0.13.73/zzip/__string.h:23:1: warning: ‘_zzip_strnlen’ defined but not used [-Wunused-function] 23 | _zzip_strnlen(const char *p, size_t maxlen) | ^~~~~~~~~~~~~ make[2]: *** [zzip/CMakeFiles/libzzipmmapped.dir/build.make:79: zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o] Error 1 make[2]: Target 'zzip/CMakeFiles/libzzipmmapped.dir/build' not remade because of errors. ```