From 31aec4684f0f3601772fce24664453aab18d2e5b Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Thu, 14 Sep 2017 17:30:09 -0700 Subject: [PATCH] Create staged and delta directories with 700 permissions These directories were previously created with 750 permissions, which caused a new check in swupd-client to remove them in order to correct the permissions to 700. Create them the right way in the first place. Signed-off-by: Matthew Johnson --- src/pack.c | 6 +++--- test/functional/full-run/test.bats | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pack.c b/src/pack.c index 1d61b71..29c7758 100644 --- a/src/pack.c +++ b/src/pack.c @@ -58,11 +58,11 @@ static void empty_pack_stage(int full, int from_version, int to_version, char *m // (re)create module/version/{delta,staged} string_or_die(&path, "%s/%s/%i_to_%i/delta", packstage_dir, module, from_version, to_version); - g_mkdir_with_parents(path, S_IRWXU | S_IRWXG); + g_mkdir_with_parents(path, S_IRWXU); free(path); string_or_die(&path, "%s/%s/%i_to_%i/staged", packstage_dir, module, from_version, to_version); - g_mkdir_with_parents(path, S_IRWXU | S_IRWXG); + g_mkdir_with_parents(path, S_IRWXU); free(path); } } @@ -79,7 +79,7 @@ static void explode_pack_stage(int from_version, int to_version, char *module) string_or_die(&path, "%s/%s/%i_to_%i/staged", packstage_dir, module, from_version, to_version); - g_mkdir_with_parents(path, S_IRWXU | S_IRWXG); + g_mkdir_with_parents(path, S_IRWXU); dir = opendir(path); if (!dir) { fprintf(stderr, "There are problems accessing %s, exiting\n", path); diff --git a/test/functional/full-run/test.bats b/test/functional/full-run/test.bats index b2e4b96..17270e4 100755 --- a/test/functional/full-run/test.bats +++ b/test/functional/full-run/test.bats @@ -40,6 +40,12 @@ setup() { [[ 1 -eq $(grep '/usr/share/clear/bundles$' $DIR/www/10/Manifest.os-core | wc -l) ]] [[ 4 -eq $(tar -tf $DIR/www/10/pack-test-bundle-from-0.tar | wc -l) ]] [[ 5 -eq $(tar -tf $DIR/www/10/pack-os-core-from-0.tar | wc -l) ]] + + # extract test-bundle pack to make sure staged and delta are created with the + # correct permissions + sudo tar -xf $DIR/www/10/pack-test-bundle-from-0.tar --directory $DIR/www/10/ + [[ $(stat -c %a $DIR/www/10/staged) -eq 700 ]] + [[ $(stat -c %a $DIR/www/10/delta) -eq 700 ]] } # vi: ft=sh ts=8 sw=2 sts=2 et tw=80