Merge "support negative zstd compression levels" into main
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index 526e2ca..3e650c4 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -1874,8 +1874,8 @@
StartProcess([&recoverable]() {
const char* env[] = {"GWP_ASAN_SAMPLE_RATE=1", "GWP_ASAN_PROCESS_SAMPLING=1",
"GWP_ASAN_MAX_ALLOCS=40000", nullptr, nullptr};
- if (recoverable) {
- env[3] = "GWP_ASAN_RECOVERABLE=true";
+ if (!recoverable) {
+ env[3] = "GWP_ASAN_RECOVERABLE=false";
}
std::string test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name();
test_name = std::regex_replace(test_name, std::regex("run_gwp_asan_test"),
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index de91bd2..7ca53ad 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -24,7 +24,6 @@
#include <filesystem>
#include <optional>
#include <thread>
-#include <unordered_set>
#include <android-base/file.h>
#include <android-base/logging.h>
@@ -46,7 +45,6 @@
#include <android/snapshot/snapshot.pb.h>
#include <libsnapshot/snapshot_stats.h>
#include "device_info.h"
-#include "libsnapshot_cow/parser_v2.h"
#include "partition_cow_creator.h"
#include "snapshot_metadata_updater.h"
#include "utility.h"
@@ -3309,7 +3307,7 @@
compression_algorithm = "gz";
}
LOG(INFO) << "using compression algorithm: " << compression_algorithm
- << ", max compressible block size: " << compression_factor;
+ << ", max compressible block size: " << compression_factor;
}
PartitionCowCreator cow_creator{
diff --git a/init/persistent_properties.cpp b/init/persistent_properties.cpp
index 59e57b9..1d17e3c 100644
--- a/init/persistent_properties.cpp
+++ b/init/persistent_properties.cpp
@@ -236,6 +236,9 @@
persistent_properties->mutable_properties()->end(),
[&name](const auto& record) { return record.name() == name; });
if (it != persistent_properties->mutable_properties()->end()) {
+ if (it->value() == value) {
+ return;
+ }
it->set_name(name);
it->set_value(value);
} else {
diff --git a/init/persistent_properties_test.cpp b/init/persistent_properties_test.cpp
index 5763050..97865d7 100644
--- a/init/persistent_properties_test.cpp
+++ b/init/persistent_properties_test.cpp
@@ -17,6 +17,9 @@
#include "persistent_properties.h"
#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <vector>
@@ -155,6 +158,31 @@
EXPECT_FALSE(it == read_back_properties.properties().end());
}
+TEST(persistent_properties, NopUpdateDoesntWriteFile) {
+ TemporaryFile tf;
+ ASSERT_TRUE(tf.fd != -1);
+ persistent_property_filename = tf.path;
+
+ auto last_modified = [&tf]() -> time_t {
+ struct stat buf;
+ EXPECT_EQ(fstat(tf.fd, &buf), 0);
+ return buf.st_mtime;
+ };
+
+ std::vector<std::pair<std::string, std::string>> persistent_properties = {
+ {"persist.sys.locale", "en-US"},
+ {"persist.sys.timezone", "America/Los_Angeles"},
+ };
+ ASSERT_RESULT_OK(
+ WritePersistentPropertyFile(VectorToPersistentProperties(persistent_properties)));
+
+ time_t t = last_modified();
+ sleep(2);
+ WritePersistentProperty("persist.sys.locale", "en-US");
+ // Ensure that the file was not modified
+ ASSERT_EQ(last_modified(), t);
+}
+
TEST(persistent_properties, RejectNonPersistProperty) {
TemporaryFile tf;
ASSERT_TRUE(tf.fd != -1);