From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 22 Oct 2019 02:42:06 +0300 From: "Dmitry V. Levin" To: ALT Devel discussion list Message-ID: <20191021234206.GA22520@altlinux.org> References: <20190917090515.3421584402D0@gitery.altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: <20190917090515.3421584402D0@gitery.altlinux.org> Subject: Re: [devel] [SCM] packages/apt: tags/0.5.15lorg2-alt74 X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 23:42:06 -0000 Archived-At: List-Archive: List-Post: --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 17, 2019 at 09:05:15AM +0000, Aleksei Nikiforov wrote: > Update of /people/darktemplar/packages/apt.git >=20 > Changes statistics since common ancestor `0.5.15lorg2-alt73-1-gd6d78da' f= ollows: > 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(-) >=20 > Changelog since common ancestor `0.5.15lorg2-alt73-1-gd6d78da' follows: > commit 875442eb7b676dd7994415e9becc64d0f5511f59 > Author: Aleksei Nikiforov > Date: Mon Sep 16 15:38:27 2019 +0300 >=20 > 0.5.15lorg2-alt74 > =20 > - Added debugging output for allocation functions. > - Fixed dynamic memory allocation pointer arithmetics issue. >=20 > commit 9e6dc9a082c2e4f1b420ff57734a782b358ce317 > Author: Aleksei Nikiforov > Date: Mon Sep 16 15:37:00 2019 +0300 >=20 > Improve alignment of structures moved on memory reallocation > =20 > This change should fix pointer arithmetic issues for e2k. > Also use special ptrdiff_t type. >=20 > 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 > =20 > Summary: Debian's Advanced Packaging Tool with RPM support > Summary(ru_RU.UTF-8): Debian APT - =F5=D3=CF=D7=C5=D2=DB=C5=CE=D3=D4=D7= =CF=D7=C1=CE=CE=CF=C5 =D3=D2=C5=C4=D3=D4=D7=CF =D5=D0=D2=C1=D7=CC=C5=CE=C9= =D1 =D0=C1=CB=C5=D4=C1=CD=C9 =D3 =D0=CF=C4=C4=C5=D2=D6=CB=CF=CA RPM > @@ -320,6 +320,10 @@ unset RPM_PYTHON > %_libdir/%name/methods/https > =20 > %changelog > +* Mon Sep 16 2019 Aleksei Nikiforov 0.5.15lorg2-a= lt74 > +- Added debugging output for allocation functions. > +- Fixed dynamic memory allocation pointer arithmetics issue. > + > * Thu Sep 05 2019 Aleksei Nikiforov 0.5.15lorg2-a= lt73 > - 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 =3D \ > 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 > #include > #include > +#include > /*}}}*/ > =20 > // MMap::MMap - Constructor /*{{{*/ > @@ -371,7 +372,7 @@ bool DynamicMMap::Grow(unsigned long long size) > Fd->Write(&C,sizeof(C)); > } > =20 > - unsigned long const poolOffset =3D Pools - ((Pool*) Base); > + ptrdiff_t const poolOffset =3D Pools - ((Pool*) Base); > =20 > if (Fd !=3D 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 > =20 > #include > +#include > =20 > using std::string; > =20 > @@ -80,7 +81,7 @@ class DynamicMMap : public MMap > public: > =20 > // 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 > #include > #include > +#include > =20 > using std::string; > =20 > @@ -209,7 +210,7 @@ struct pkgCache::Header > Header(); > }; > =20 > -struct pkgCache::Package > +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 7 + sizeof(un= signed 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; > }; > =20 > -struct pkgCache::PackageFile > +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 10 + sizeof(u= nsigned long long) + sizeof(unsigned long) + sizeof(unsigned short) + sizeo= f(time_t))) pkgCache::PackageFile > { > // Names > map_ptrloc FileName; // Stringtable > @@ -252,7 +253,7 @@ struct pkgCache::PackageFile > time_t mtime; // Modification time for the file > }; > =20 > -struct pkgCache::VerFile > +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 3 + sizeof(un= signed short))) pkgCache::VerFile > { > map_ptrloc File; // PackageFile > map_ptrloc NextFile; // PkgVerFile > @@ -260,7 +261,7 @@ struct pkgCache::VerFile > unsigned short Size; > }; > =20 > -struct pkgCache::Version > +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 8 + sizeof(un= signed 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; > }; > =20 > -struct pkgCache::Dependency > +struct alignas(get_minimal_power_of_2(sizeof(map_ptrloc) * 6 + sizeof(un= signed char) * 2)) pkgCache::Dependency > { > map_ptrloc Version; // Stringtable > map_ptrloc Package; // Package > @@ -298,7 +299,7 @@ struct pkgCache::Dependency > unsigned char CompareOp; > }; > =20 > -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 > }; > =20 > -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 > + > +template > +constexpr size_t get_minimal_power_of_2_helper(size_t size) > +{ > + return (size <=3D N) ? N : get_minimal_power_of_2_helper(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 */ =F6=C1=CC=D8, =DE=D4=CF =D7=D9 =CE=C5 =C4=CF=D6=C4=C1=CC=C9=D3=D8 =D0=C5=D2= =D7=CF=C7=CF =C1=D0=D2=C5=CC=D1, =CE=CF =D7=D3=A3 =D2=C1=D7=CE=CF =D3=D0=C1= =D3=C9=C2=CF, =DB=D5=D4=CB=C1 =D0=CF=CC=D5=DE=C9=CC=C1=D3=D8 =CF=D4=CC=C9=DE=CE=C1=D1. --=20 ldv --lrZ03NoBR/3+SXJZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJdrkJOAAoJEAVFT+BVnCUILnAP/15cJeiy9gAtlMrmkEDIDUyI ndnvTxoLZt353f1g9IzQyMKSivRkn0Ss9Mv1k3vpgc5b7kBXQO7+CFYuvn+jCs2v Se6FHjZkt3JaM1NQ6p57Blvc+BTxEUMUNAUEuCKBr/8CtOkTFpVHt0mHCo7YbaNR EVleYI+X377eWFKAabVNGh/N5kRLddAmhUoSUmE4613P6X23CVTqvnBk6UbVgRBW i2rUJT4sqFNxz5Dv/lviiiORJMXkBvsId9O+iFx/96ZALCh1VkVARVTE1wj9TT4+ dm3hVoIJheBQeQebG+wMDuZXANtEjWJjvz/Hj+RUiZCd/s2Xs8mbCy0Nf9Qjpaj6 OrV+CAd636tUmTkyPh18GrwFhPu8H+DEOwghDco1hp+YJkUJPF+cKO/Pp7ggBEIb ADpvvMTawZ+qOUHHpkMiMogWJ2O0tl0dMXMLOchz9WdDYC3LDiePayHVCIy6ZGa7 gsuqlYaBX+ba5+rplsP8T4Iv/bB82yCkUV+dKl6CkUJyPvEM24b7bspiBGuQ06Ei RnhS/b7bi4HNL/t3iaWSUTJA9rSYrQjDxLr827D/U/K2/6j+Rr3tr15ybTnFIjlU Xl/5ldHlOA2nFpXs9+bSo779GWj7PUUyKYDNzIJeo7S8lfmEPWbXTqHW9EP22j4G wOJXIrROsGOJVbWFpis5 =wYgi -----END PGP SIGNATURE----- --lrZ03NoBR/3+SXJZ--