Bug 46105

Summary: apt: ошибка сборки с GCC 13
Product: Sisyphus Reporter: Alexey Sheplyakov <asheplyakov>
Component: aptAssignee: placeholder <placeholder>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: asheplyakov, boyarsh, glebfm, imz, iv, ldv, nir, placeholder, sin
Version: unstable   
Hardware: all   
OS: Linux   
Bug Depends on:    
Bug Blocks: 45802    
Attachments:
Description Flags
исправление
none
исправление, часть 2 none

Description Alexey Sheplyakov 2023-05-11 04:12:10 MSK
contrib/mmap.cc:80:20: error: 'SIZE_MAX' was not declared in this scope
   80 |    if (EndOfFile > SIZE_MAX)
      |                    ^~~~~~~~
contrib/mmap.cc:38:8: note: 'SIZE_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   37 | #include <cassert>
  +++ |+#include <cstdint>
   38 |                                                                         /*}}}*/
contrib/mmap.cc:82:40: error: 'uintmax_t' does not name a type
   82 |                            static_cast<uintmax_t>(EndOfFile));
      |                                        ^~~~~~~~~
contrib/mmap.cc: In member function 'std::optional<long unsigned int> DynamicMMap::WriteString(const char*, size_t)':
contrib/mmap.cc:363:15: error: 'SIZE_MAX' was not declared in this scope
  363 |    if (Len == SIZE_MAX)
      |               ^~~~~~~~
contrib/mmap.cc:363:15: note: 'SIZE_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
make[1]: *** [Makefile:775: contrib/mmap.lo] Error 1
Comment 1 Alexey Sheplyakov 2023-05-11 04:14:06 MSK
Created attachment 13149 [details]
исправление
Comment 2 Alexey Sheplyakov 2023-05-11 04:37:36 MSK
Created attachment 13151 [details]
исправление, часть 2
Comment 3 Alexey Sheplyakov 2023-05-11 04:38:16 MSK
   http.cc:1014:18: error: ignoring return value of 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>;>
     1014 |    FailFile.c_str();   // Make sure we dont do a malloc in the signal handler
          |    ~~~~~~~~~~~~~~^~
    In file included from /usr/include/c++/13/string:54,
                     from ../include/apt-pkg/fileutl.h:23,
                     from http.cc:29:
    /usr/include/c++/13/bits/basic_string.h:2594:7: note: declared here
     2594 |       c_str() const _GLIBCXX_NOEXCEPT
          |       ^~~~~
    cc1plus: all warnings being treated as errors
    make[1]: *** [Makefile:622: http.o] Error 1
    
    Similarly in ftp.cc and rsh.cc
Comment 4 Ivan Zakharyaschev 2023-05-16 17:48:31 MSK
(Ответ для Alexey Sheplyakov на комментарий #3)
>    http.cc:1014:18: error: ignoring return value of 'const _CharT*
> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with
> _CharT = char; _Traits = std::char_traits<char>;>
>      1014 |    FailFile.c_str();   // Make sure we dont do a malloc in the
> signal handler
>           |    ~~~~~~~~~~~~~~^~
>     In file included from /usr/include/c++/13/string:54,
>                      from ../include/apt-pkg/fileutl.h:23,
>                      from http.cc:29:
>     /usr/include/c++/13/bits/basic_string.h:2594:7: note: declared here
>      2594 |       c_str() const _GLIBCXX_NOEXCEPT
>           |       ^~~~~
>     cc1plus: all warnings being treated as errors
>     make[1]: *** [Makefile:622: http.o] Error 1
>     
>     Similarly in ftp.cc and rsh.cc

Спасибо за патч, включу его в следующий релиз, чтобы адаптироваться к требованиям gcc13. Правда, я там переписал сразу со static_cast:

static_cast<void>(FailFile.c_str());   // Make sure we dont do a malloc in the signal handler
Comment 5 Ivan Zakharyaschev 2023-05-17 04:14:53 MSK
(Ответ для Alexey Sheplyakov на комментарий #0)
> contrib/mmap.cc:80:20: error: 'SIZE_MAX' was not declared in this scope
>    80 |    if (EndOfFile > SIZE_MAX)
>       |                    ^~~~~~~~
> contrib/mmap.cc:38:8: note: 'SIZE_MAX' is defined in header '<cstdint>'; did
> you forget to '#include <cstdint>'?
>    37 | #include <cassert>
>   +++ |+#include <cstdint>
>    38 |                                                                     
> /*}}}*/
> contrib/mmap.cc:82:40: error: 'uintmax_t' does not name a type
>    82 |                            static_cast<uintmax_t>(EndOfFile));
>       |                                        ^~~~~~~~~
> contrib/mmap.cc: In member function 'std::optional<long unsigned int>
> DynamicMMap::WriteString(const char*, size_t)':
> contrib/mmap.cc:363:15: error: 'SIZE_MAX' was not declared in this scope
>   363 |    if (Len == SIZE_MAX)
>       |               ^~~~~~~~
> contrib/mmap.cc:363:15: note: 'SIZE_MAX' is defined in header '<cstdint>';
> did you forget to '#include <cstdint>'?
> make[1]: *** [Makefile:775: contrib/mmap.lo] Error 1

Спасибо, это я тоже учёл приложенным патчем, и в дальнейших изменениях постарался подобные места отследить.

Новый тег, который я собираю -- 0.5.15lorg2-alt84 в задании 320624 -- со всякими новыми изменениями, но я их с gcc13 не проверял, потому что у меня (в Сизифе) нет gcc13. Там может что-то ещё вылезти.
Comment 6 Repository Robot 2023-06-08 01:45:32 MSK
apt-0.5.15lorg2-alt84 -> sisyphus:

 Fri Jun 02 2023 Ivan Zakharyaschev <imz@altlinux> 0.5.15lorg2-alt84
 - Fixed the display of descriptions in aptitude and packagekit (by making
   the format closer to Debian's):
   + Fixed the display of the first line, which was not shown in packagekit.
   + Fixed the regression (from 0.5.15lorg2-alt72) in the display of
     all but the first lines (in aptitude and packagekit). (ALT#40826)
   + This has also made packagekit show translated descriptions. (ALT#46251)
   + As a result, there is a cosmetic regression in synaptic: extra blanks.
 - Increased the buf for reading to 32k for effectiveness in methods:
   gzip (and other compression types), rsh, ftp.
 - Avoid compilation errors with GCC 13 (thx Alexey Sheplyakov). (ALT#46105)