Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Merge remote-tracking branch 'origin/fix/token-length' into batch/0.11.13

islandmed4bd1e9e111e5
diff --cc tests/test_self_update.cpp
index a7e230a2,b74b8571..a2b2fada
--- a/tests/test_self_update.cpp
+++ b/tests/test_self_update.cpp
@@@ -693,38 -693,17 +751,48 @@@ TEST(self_update_keychain_windows)
CHECK(keychain::load(account, got) && got == "{\"access\":\"ghu_test\"}");
CHECK(keychain::store(account, "second"));
CHECK(keychain::load(account, got) && got == "second");
- CHECK(keychain::erase(account) && !keychain::load(account, got));
+ member::Tokens t;
+ t.access = "ghu_" + std::string(4092, 'a');
+ t.refresh = "ghr_" + std::string(4092, 'b');
+ CHECK(keychain::store(account, member::tokensToSecret(t)));
+ member::Tokens back;
+ CHECK(keychain::load(account, got) && member::tokensFromSecret(got, back) && back.access == t.access && back.refresh == t.refresh);
+ CHECK(keychain::store(account, "short again") && keychain::load(account, got) && got == "short again");
+ CHECK(!keychain::load(account + "#1", got));
+ CHECK(keychain::store(account, member::tokensToSecret(t)));
+ CHECK(keychain::erase(account) && !keychain::load(account, got) && !keychain::load(account + "#1", got));
CHECK(keychain::erase(account)); // (nothing there: still fine)
+ keychain::useMemoryForTests(true);
}
#endif
+
+#if defined(__linux__)
+// After Restart to update, the new version ends the old one only when it's that old SculptForge from the same AppImage
+// file (0.11.10 and earlier stayed hidden and kept running: @ebarranco). A fake /proc/<pid> entry.
+TEST(self_update_old_appimage_check) {
+ const fs::path dir = fs::temp_directory_path() / ("sf-oldappimage-" + std::to_string(::getpid()));
+ fs::remove_all(dir);
+ fs::create_directories(dir / "mount" / "usr" / "bin");
+ std::ofstream(dir / "mount" / "usr" / "bin" / "sculptforge") << "x";
+ std::ofstream(dir / "mount" / "usr" / "bin" / "dolphin") << "x";
+ const std::string appImage = "/home/someone/SculptForge/SculptForge-0.11.1-x86_64.AppImage";
+ const auto proc = [&](const std::string& name, const std::string& program, const std::string& environ) {
+ const fs::path p = dir / name;
+ fs::create_directories(p);
+ fs::create_symlink(dir / "mount" / "usr" / "bin" / program, p / "exe");
+ std::ofstream(p / "environ", std::ios::binary) << environ;
+ return p.string();
+ };
+ const std::string env = std::string("HOME=/home/someone") + '\0' + "APPIMAGE=" + appImage + '\0' + "OWD=/home/someone" + '\0';
+ CHECK(isOldAppImage(proc("old", "sculptforge", env), appImage));
+ CHECK(!isOldAppImage(proc("other-file", "sculptforge", env), appImage + ".old")); // another copy
+ CHECK(!isOldAppImage(proc("prefix", "sculptforge", env), "/home/someone/SculptForge/SculptForge")); // whole value only
+ CHECK(!isOldAppImage(proc("filemanager", "dolphin", env), appImage)); // the file manager
+ CHECK(!isOldAppImage(proc("no-appimage", "sculptforge", std::string("HOME=/x") + '\0'), appImage));
+ CHECK(!isOldAppImage(proc("old2", "sculptforge", env), ""));
+ CHECK(!isOldAppImage((dir / "missing").string(), appImage));
+ CHECK(!isOldAppImage("/proc/1", appImage)); // init: not ours
+ CHECK(!isOldAppImage("/proc/self", appImage)); // the tests: not sculptforge
+ fs::remove_all(dir);
+}
+#endif