commit 9101c36c653cf90ccd133d6e85eca6b264de4b81
Author: David Kalnischkies <email address hidden>
Date: Fri Aug 12 19:11:01 2016 +0200
drop "incorrect" const attribute from DirectoryExists
Since its existence in 2010 DirectoryExists was always marked with this
attribute, but for no real reason. Arguably a check for the existence of
the file is not modifying global state, so theoretically this shouldn't
be a problem. It is wrong from a logical point of view through as
between two calls the directory could be created so the promise we made
to the compiler that it could remove the second call would be wrong, so
API wise it is wrong.
The problem for the compiler is a lot more likely through in the
underlying implementation of stat() and co, so for both reasons lets
drop this attribute here and be (hopefully) done with it forever.
It's a bit mysterious that this is only observeable on ppc64el and can be
fixed by reordering code ever so slightly, but in the end its more our
fault for adding this attribute than the compilers fault for doing
something silly based on the attribute.
commit 9101c36c653cf90 ccd133d6e85eca6 b264de4b81
Author: David Kalnischkies <email address hidden>
Date: Fri Aug 12 19:11:01 2016 +0200
drop "incorrect" const attribute from DirectoryExists
Since its existence in 2010 DirectoryExists was always marked with this
attribute, but for no real reason. Arguably a check for the existence of
the file is not modifying global state, so theoretically this shouldn't
be a problem. It is wrong from a logical point of view through as
between two calls the directory could be created so the promise we made
to the compiler that it could remove the second call would be wrong, so
API wise it is wrong.
The problem for the compiler is a lot more likely through in the
underlying implementation of stat() and co, so for both reasons lets
drop this attribute here and be (hopefully) done with it forever.
It's a bit mysterious that this is only observeable on ppc64el and can be
fixed by reordering code ever so slightly, but in the end its more our
fault for adding this attribute than the compilers fault for doing
something silly based on the attribute.
LP: 1473674
diff --git a/apt-pkg/ contrib/ fileutl. h b/apt-pkg/ contrib/ fileutl. h contrib/ fileutl. h contrib/ fileutl. h std::string File); std::string File); (std::string const &Path) APT_CONST; (std::string const &Path); (std::string const &Parent, std::string const &Path); Time(std: :string const &Path);
index 4a1676d..15665f8 100644
--- a/apt-pkg/
+++ b/apt-pkg/
@@ -164,7 +164,7 @@ bool RemoveFile(char const * const Function, std::string const &FileName);
int GetLock(std::string File,bool Errors = true);
bool FileExists(
bool RealFileExists(
-bool DirectoryExists
+bool DirectoryExists
bool CreateDirectory
time_t GetModification
bool Rename(std::string From, std::string To);