From 6f1a3c4648bf06862dca0b3725cbb3b7ee0284e3 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Mar 2021 22:12:27 +0100 Subject: [PATCH] =?UTF-8?q?gie=5Fself=5Ftests:=20fix=20use=20of=20uninitia?= =?UTF-8?q?lized=20memory=20(fixes=C2=A0#2557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unit/gie_self_tests.cpp | 39 ++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp index 4244766ebf..92f1c758dc 100644 --- a/test/unit/gie_self_tests.cpp +++ b/test/unit/gie_self_tests.cpp @@ -268,8 +268,10 @@ TEST_F(gieTest, proj_create_crs_to_crs) { ASSERT_TRUE(P != nullptr); PJ_COORD a, b; - a.xy.x = 700000.0; - a.xy.y = 6000000.0; + a.xyzt.x = 700000.0; + a.xyzt.y = 6000000.0; + a.xyzt.z = 0; + a.xyzt.t = HUGE_VAL; b.xy.x = 307788.8761171057; b.xy.y = 5999669.3036037628; @@ -306,8 +308,10 @@ TEST_F(gieTest, proj_create_crs_to_crs_EPSG_4326) { PJ_COORD a, b; // Lat, long degrees - a.xy.x = 0.0; - a.xy.y = 3.0; + a.xyzt.x = 0.0; + a.xyzt.y = 3.0; + a.xyzt.z = 0; + a.xyzt.t = HUGE_VAL; b.xy.x = 500000.0; b.xy.y = 0.0; @@ -328,8 +332,10 @@ TEST_F(gieTest, proj_create_crs_to_crs_proj_longlat) { PJ_COORD a, b; // Long, lat degrees - a.xy.x = 3.0; - a.xy.y = 0; + a.xyzt.x = 3.0; + a.xyzt.y = 0; + a.xyzt.z = 0; + a.xyzt.t = HUGE_VAL; b.xy.x = 500000.0; b.xy.y = 0.0; @@ -718,9 +724,10 @@ TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) { proj_destroy(target_crs); // Romania - c.xyz.x = 45; // Lat - c.xyz.y = 25; // Long - c.xyz.z = 0; + c.xyzt.x = 45; // Lat + c.xyzt.y = 25; // Long + c.xyzt.z = 0; + c.xyzt.t = HUGE_VAL; c = proj_trans(P, PJ_FWD, c); EXPECT_NEAR(c.xy.x, 44.999701238, 1e-9); EXPECT_NEAR(c.xy.y, 24.998474948, 1e-9); @@ -740,9 +747,10 @@ TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) { EXPECT_NEAR(c.xy.x, 45, 1e-8); EXPECT_NEAR(c.xy.y, 25, 1e-8); - c.xyz.x = 45; // Lat - c.xyz.y = 25; // Long - c.xyz.z = 0; + c.xyzt.x = 45; // Lat + c.xyzt.y = 25; // Long + c.xyzt.z = 0; + c.xyzt.t = HUGE_VAL; proj_trans_generic(P, PJ_FWD, &(c.xyz.x), sizeof(double), 1, &(c.xyz.y), sizeof(double), 1, &(c.xyz.z), sizeof(double), 1, nullptr, 0, 0); @@ -783,9 +791,10 @@ TEST(gie, proj_create_crs_to_crs_outside_area_of_use) { EXPECT_EQ(P->fwd, nullptr); // Test point outside area of use of both candidate coordinate operations - c.xyz.x = 58; // Lat in deg - c.xyz.y = 5; // Long in deg - c.xyz.z = 0; + c.xyzt.x = 58; // Lat in deg + c.xyzt.y = 5; // Long in deg + c.xyzt.z = 0; + c.xyzt.t = HUGE_VAL; c = proj_trans(P, PJ_FWD, c); EXPECT_NEAR(c.xy.x, 64.44444444444444, 1e-9); // Lat in grad EXPECT_NEAR(c.xy.y, 2.958634259259258, 1e-9); // Long in grad rtès 2023-08-20Revert "gnu: system: Add home-directory-permissions field to <user-account>."...This reverts commit e9a5eebc785cb843034b38c5c5a6dd10904bdf2a, which as far as I can tell breaks system roll-backs thusly: [...] In gnu/build/accounts.scm: 239:27 3 (_ #<<password-entry> name: "root" password: "x" uid: 0 gid: 0 real-name: "System >) In unknown file: 2 (string-join ("root" "x" "0" "0" "System administrator" "/root" #t) ":" #<undefined>) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure string-append: Wrong type (expecting string): #t Tobias Geerinckx-Rice 2023-08-25gnu: system: Add home-directory-permissions field to <user-account>....* gnu/system/accounts.scm (<user-account>)[home-directory-permissions]: New field. (user-account-home-directory-permissions): New accessor. * gnu/build/activation.scm (activate-users+groups): Use home directory permission bits from the user account object. * doc/guix.texi (User Accounts): Document new field. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> David Thompson 2023-07-26system: accounts: Export <user-account>.Maxim Cournoyer 2019-03-25accounts: Add default value for the 'home-directory' field of <user-account>....* gnu/system/accounts.scm (<user-account>)[home-directory]: Mark as thunked and add a default value. (default-home-directory): New procedure. * doc/guix.texi (User Accounts): Remove 'home-directory' from example. * gnu/system/examples/bare-bones.tmpl: Likewise. * gnu/system/examples/beaglebone-black.tmpl: Likewise. * gnu/system/examples/desktop.tmpl: Likewise. * gnu/system/examples/docker-image.tmpl: Likewise. * gnu/system/examples/lightweight-desktop.tmpl: Likewise. * gnu/system/install.scm (installation-os): Likewise. * gnu/tests.scm (%simple-os): Likewise. * gnu/tests/install.scm (%minimal-os, %minimal-os-on-vda): (%separate-home-os, %encrypted-root-os, %btrfs-root-os): Likewise. * tests/accounts.scm ("allocate-passwd") ("allocate-passwd with previous state"): Likewise. Ludovic Courtès 2019-03-07activation: Operate on <user-account> and <user-group> records....* gnu/system/accounts.scm (sexp->user-group, sexp->user-account): New procedures. * gnu/system/shadow.scm (account-activation): Call them in the arguments to 'activate-users+groups'. (account-shepherd-service): Likewise. * gnu/build/activation.scm (activate-users+groups): Expect a list of <user-account> and a list of <user-group>. Replace uses of 'match' on tuples with calls to record accessors. (activate-user-home): Likewise. Ludovic Courtès 2019-03-07system: Add (gnu system accounts)....The (gnu system accounts) module is meant to be used both on the build- and on the host-side. * gnu/system/shadow.scm <top level>: Call 'default-shell'. (<user-account>, <user-group>): Move to... * gnu/system/accounts.scm: ... here. New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add system/accounts.scm. Ludovic Courtès