From 358a584d949b9d77da6cd88ac3c316c444032785 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 17 May 2026 20:31:25 +0200 Subject: Fix `noexcept` as pointed out by gcc --- apt-pkg/cacheset.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 02dda7ee6..170105afc 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -63,7 +63,7 @@ public: /*{{{*/ unsigned short ID; const char * const Alias; Position Pos; - PkgModifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {} + PkgModifier (unsigned short const &id, const char * const alias, Position const &pos) noexcept : ID(id), Alias(alias), Pos(pos) {} }; virtual bool PackageFromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci, pkgCacheFile &Cache, const char * cmdline, @@ -739,7 +739,7 @@ public: enum Position { NONE, PREFIX, POSTFIX } const Pos; enum CacheSetHelper::VerSelector const SelectVersion; Modifier (unsigned short const &id, const char * const alias, Position const &pos, - enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos), + enum CacheSetHelper::VerSelector const select) noexcept : ID(id), Alias(alias), Pos(pos), SelectVersion(select) {} }; -- cgit v1.2.3-70-g09d2 From a670da14a1eabb3965f81b0285892b2a39f9b13a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 17 May 2026 20:32:01 +0200 Subject: Fix wrongful std::make_unique conversion We inadvertently changed a CreateDynamicMMap call. Fix that function instead. Regression-of: 23dba65f031954df896bc3c6dfb1a9705574886b --- apt-pkg/pkgcachegen.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 82b88d6b0..cd434bf1a 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1700,7 +1700,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, the cache will be stored there. This is pretty much mandatory if you are using AllowMem. AllowMem lets the function be run as non-root where it builds the cache 'fast' into a memory buffer. */ -static DynamicMMap* CreateDynamicMMap(FileFd * const CacheF, unsigned long Flags) +static std::unique_ptr CreateDynamicMMap(FileFd * const CacheF, unsigned long Flags) { map_filesize_t const MapStart = _config->FindI("APT::Cache-Start", APT_CACHE_START_DEFAULT); map_filesize_t const MapGrow = _config->FindI("APT::Cache-Grow", 1*1024*1024); @@ -1709,9 +1709,9 @@ static DynamicMMap* CreateDynamicMMap(FileFd * const CacheF, unsigned long Flags if (_config->FindB("APT::Cache-Fallback", false) == true) Flags |= MMap::Fallback; if (CacheF != NULL) - return new DynamicMMap(*CacheF, Flags, MapStart, MapGrow, MapLimit); + return std::make_unique(*CacheF, Flags, MapStart, MapGrow, MapLimit); else - return new DynamicMMap(Flags, MapStart, MapGrow, MapLimit); + return std::make_unique(Flags, MapStart, MapGrow, MapLimit); } static bool writeBackMMapToFile(pkgCacheGenerator * const Gen, DynamicMMap * const Map, std::string const &FileName) @@ -1742,7 +1742,7 @@ static bool writeBackMMapToFile(pkgCacheGenerator * const Gen, DynamicMMap * con static bool loadBackMMapFromFile(std::unique_ptr &Gen, std::unique_ptr &Map, OpProgress * const Progress, FileFd &CacheF) { - Map.reset(CreateDynamicMMap(NULL, 0)); + Map = CreateDynamicMMap(nullptr, 0); if (unlikely(Map->validData()) == false) return false; if (CacheF.IsOpen() == false || CacheF.Seek(0) == false || CacheF.Failed()) @@ -1927,7 +1927,7 @@ bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **O return false; ScopedErrorMerge sem; - auto Map = std::make_unique(NULL, 0); + auto Map = CreateDynamicMMap(nullptr, 0); if (unlikely(Map->validData()) == false) return false; map_filesize_t CurrentSize = 0; -- cgit v1.2.3-70-g09d2 From 1e010999520a5b5bac608cb161b90be6edb6b070 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 17 May 2026 20:42:19 +0200 Subject: Fix regression in dirstream We added a close(iFd) after assigning iFd to Fd which is wrong. Regression-Of: e79f9bb22375fd72330b534e17dcd3ceace432e8 Closes: #1136441 --- apt-pkg/dirstream.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/dirstream.cc b/apt-pkg/dirstream.cc index b71a34d3e..ef9f08ebc 100644 --- a/apt-pkg/dirstream.cc +++ b/apt-pkg/dirstream.cc @@ -53,7 +53,6 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd) return _error->Errno("fchown",_("Failed to write file %s"), Itm.Name); } Fd = iFd; - close(iFd); return true; } -- cgit v1.2.3-70-g09d2