[devel] [SCM] packages/apt: tags/0.5.15lorg2-alt74

Dmitry V. Levin ldv на altlinux.org
Вт Окт 22 02:42:06 MSK 2019


On Tue, Sep 17, 2019 at 09:05:15AM +0000, Aleksei Nikiforov wrote:
> Update of /people/darktemplar/packages/apt.git
> 
> Changes statistics since common ancestor `0.5.15lorg2-alt73-1-gd6d78da' follows:
>  apt.spec                    |  6 +++++-
>  apt/apt-pkg/Makefile.am     |  1 +
>  apt/apt-pkg/contrib/mmap.cc |  3 ++-
>  apt/apt-pkg/contrib/mmap.h  |  3 ++-
>  apt/apt-pkg/pkgcache.h      | 15 ++++++++-------
>  apt/apt-pkg/utils.h         | 17 +++++++++++++++++
>  6 files changed, 35 insertions(+), 10 deletions(-)
> 
> Changelog since common ancestor `0.5.15lorg2-alt73-1-gd6d78da' follows:
> commit 875442eb7b676dd7994415e9becc64d0f5511f59
> Author: Aleksei Nikiforov <darktemplar на altlinux>
> Date:   Mon Sep 16 15:38:27 2019 +0300
> 
>     0.5.15lorg2-alt74
>     
>     - Added debugging output for allocation functions.
>     - Fixed dynamic memory allocation pointer arithmetics issue.
> 
> commit 9e6dc9a082c2e4f1b420ff57734a782b358ce317
> Author: Aleksei Nikiforov <darktemplar на altlinux>
> Date:   Mon Sep 16 15:37:00 2019 +0300
> 
>     Improve alignment of structures moved on memory reallocation
>     
>     This change should fix pointer arithmetic issues for e2k.
>     Also use special ptrdiff_t type.
> 
> Full diff since common ancestor `0.5.15lorg2-alt73-1-gd6d78da' follows:
> diff --git a/apt.spec b/apt.spec
> index 2143ce4..b7a2532 100644
> --- a/apt.spec
> +++ b/apt.spec
> @@ -1,6 +1,6 @@
>  Name: apt
>  Version: 0.5.15lorg2
> -Release: alt73
> +Release: alt74
>  
>  Summary: Debian's Advanced Packaging Tool with RPM support
>  Summary(ru_RU.UTF-8): Debian APT - Усовершенствованное средство управления пакетами с поддержкой RPM
> @@ -320,6 +320,10 @@ unset RPM_PYTHON
>  %_libdir/%name/methods/https
>  
>  %changelog
> +* Mon Sep 16 2019 Aleksei Nikiforov <darktemplar на altlinux> 0.5.15lorg2-alt74
> +- Added debugging output for allocation functions.
> +- Fixed dynamic memory allocation pointer arithmetics issue.
> +
>  * Thu Sep 05 2019 Aleksei Nikiforov <darktemplar на altlinux> 0.5.15lorg2-alt73
>  - Improved handling of ipv6 addresses (Closes: #34000).
>  - Enabled url-decoding http_proxy env variable (thx to snejok@) (Closes: #37186).
> diff --git a/apt/apt-pkg/Makefile.am b/apt/apt-pkg/Makefile.am
> index 4c0d234..4461078 100644
> --- a/apt/apt-pkg/Makefile.am
> +++ b/apt/apt-pkg/Makefile.am
> @@ -105,6 +105,7 @@ libapt_pkg_la_SOURCES = \
>  	tagfile.h \
>  	update.cc \
>  	update.h \
> +	utils.h \
>  	version.cc \
>  	version.h \
>  	versionmatch.cc \
> diff --git a/apt/apt-pkg/contrib/mmap.cc b/apt/apt-pkg/contrib/mmap.cc
> index cf01be9..ea2aded 100644
> --- a/apt/apt-pkg/contrib/mmap.cc
> +++ b/apt/apt-pkg/contrib/mmap.cc
> @@ -38,6 +38,7 @@
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <cstring>
> +#include <stddef.h>
>     									/*}}}*/
>  
>  // MMap::MMap - Constructor						/*{{{*/
> @@ -371,7 +372,7 @@ bool DynamicMMap::Grow(unsigned long long size)
>        Fd->Write(&C,sizeof(C));
>     }
>  
> -   unsigned long const poolOffset = Pools - ((Pool*) Base);
> +   ptrdiff_t const poolOffset = Pools - ((Pool*) Base);
>  
>     if (Fd != 0)
>     {
> diff --git a/apt/apt-pkg/contrib/mmap.h b/apt/apt-pkg/contrib/mmap.h
> index bcbdaa1..439e4fa 100644
> --- a/apt/apt-pkg/contrib/mmap.h
> +++ b/apt/apt-pkg/contrib/mmap.h
> @@ -35,6 +35,7 @@
>  #include <sys/mman.h>
>  
>  #include <apt-pkg/fileutl.h>
> +#include <apt-pkg/utils.h>
>  
>  using std::string;
>  
> @@ -80,7 +81,7 @@ class DynamicMMap : public MMap
>     public:
>     
>     // This is the allocation pool structure
> -   struct Pool
> +   struct alignas(get_minimal_power_of_2(sizeof(unsigned long) * 3)) Pool
>     {
>        unsigned long ItemSize;
>        unsigned long Start;
> diff --git a/apt/apt-pkg/pkgcache.h b/apt/apt-pkg/pkgcache.h
> index 56fc89d..324ece5 100644
> --- a/apt/apt-pkg/pkgcache.h
> +++ b/apt/apt-pkg/pkgcache.h
> @@ -25,6 +25,7 @@
>  #include <string>
>  #include <time.h>
>  #include <apt-pkg/mmap.h>
> +#include <apt-pkg/utils.h>
>  
>  using std::string;
>      
> @@ -209,7 +210,7 @@ struct pkgCache::Header
>     Header();
>  };
>  
> -struct pkgCache::Package
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 7 + sizeof(unsigned char) * 3 + sizeof(unsigned int) + sizeof(unsigned long))) pkgCache::Package
>  {
>     // Pointers
>     map_ptrloc Name;              // Stringtable
> @@ -231,7 +232,7 @@ struct pkgCache::Package
>     unsigned long Flags;
>  };
>  
> -struct pkgCache::PackageFile
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 10 + sizeof(unsigned long long) + sizeof(unsigned long) + sizeof(unsigned short) + sizeof(time_t))) pkgCache::PackageFile
>  {
>     // Names
>     map_ptrloc FileName;        // Stringtable
> @@ -252,7 +253,7 @@ struct pkgCache::PackageFile
>     time_t mtime;                  // Modification time for the file
>  };
>  
> -struct pkgCache::VerFile
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 3 + sizeof(unsigned short))) pkgCache::VerFile
>  {
>     map_ptrloc File;           // PackageFile
>     map_ptrloc NextFile;       // PkgVerFile
> @@ -260,7 +261,7 @@ struct pkgCache::VerFile
>     unsigned short Size;
>  };
>  
> -struct pkgCache::Version
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 8 + sizeof(unsigned long long) * 2 + sizeof(unsigned int) * 2 + sizeof(unsigned char))) pkgCache::Version
>  {
>     map_ptrloc VerStr;            // Stringtable
>     map_ptrloc Section;           // StringTable (StringItem)
> @@ -284,7 +285,7 @@ struct pkgCache::Version
>     unsigned char Priority;
>  };
>  
> -struct pkgCache::Dependency
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 6 + sizeof(unsigned char) * 2)) pkgCache::Dependency
>  {
>     map_ptrloc Version;         // Stringtable
>     map_ptrloc Package;         // Package
> @@ -298,7 +299,7 @@ struct pkgCache::Dependency
>     unsigned char CompareOp;
>  };
>  
> -struct pkgCache::Provides
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 6)) pkgCache::Provides
>  {
>     map_ptrloc ParentPkg;        // Pacakge
>     map_ptrloc Version;          // Version
> @@ -307,7 +308,7 @@ struct pkgCache::Provides
>     map_ptrloc NextPkgProv;      // Provides
>  };
>  
> -struct pkgCache::StringItem
> +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 2)) pkgCache::StringItem
>  {
>     map_ptrloc String;        // Stringtable
>     map_ptrloc NextItem;      // StringItem
> diff --git a/apt/apt-pkg/utils.h b/apt/apt-pkg/utils.h
> new file mode 100644
> index 0000000..08f7f18
> --- /dev/null
> +++ b/apt/apt-pkg/utils.h
> @@ -0,0 +1,17 @@
> +#ifndef APT_EXTRA_UTILS_H
> +#define APT_EXTRA_UTILS_H
> +
> +#include <stddef.h>
> +
> +template <size_t N>
> +constexpr size_t get_minimal_power_of_2_helper(size_t size)
> +{
> +   return (size <= N) ? N : get_minimal_power_of_2_helper<N*2>(size);
> +}
> +
> +constexpr size_t get_minimal_power_of_2(size_t size)
> +{
> +   return get_minimal_power_of_2_helper<1>(size);
> +}
> +
> +#endif /* APT_EXTRA_UTILS_H */

Жаль, что вы не дождались первого апреля, но всё равно спасибо,
шутка получилась отличная.


-- 
ldv
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : signature.asc
Тип     : application/pgp-signature
Размер  : 801 байтов
Описание: отсутствует
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20191022/b5924eeb/attachment-0001.bin>


Подробная информация о списке рассылки Devel