summaryrefslogtreecommitdiff
path: root/tests/test-admin-deploy-etcmerge-cornercases.sh
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-11-18 19:47:46 -0500
committerColin Walters <walters@verbum.org>2013-11-28 23:28:13 -0500
commita24afd68f08c58cc9929d2208497b29e56254375 (patch)
treea535683bc1ab2ca324a5dca27de1bbd0d218b97c /tests/test-admin-deploy-etcmerge-cornercases.sh
parenta897b42a7a34b22322b3fc6ac054942977a203b4 (diff)
downloadostree-a24afd68f08c58cc9929d2208497b29e56254375.tar.gz
Move xattr handling into libgsystem, fix sysroot to handle directory ownership/perms
This large patch moves the core xattr logic down into libgsystem, which allows the gs_shutil_cp_a() API to copy them. In turn, this allows us to just use that API instead of rolling our own recursive copy here. As noted in the new comment though, one case that we are explicitly regressing is where the new /etc removes a parent directory that's needed by a modified file. This seems unlikely for most vendors now, but let's do that as a separate bug. https://bugzilla.gnome.org/show_bug.cgi?id=711058
Diffstat (limited to 'tests/test-admin-deploy-etcmerge-cornercases.sh')
-rw-r--r--tests/test-admin-deploy-etcmerge-cornercases.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/test-admin-deploy-etcmerge-cornercases.sh b/tests/test-admin-deploy-etcmerge-cornercases.sh
new file mode 100644
index 00000000..033e5599
--- /dev/null
+++ b/tests/test-admin-deploy-etcmerge-cornercases.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo "1..1"
+
+setup_os_repository "archive-z2" "syslinux"
+
+echo "ok setup"
+
+echo "1..1"
+
+ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
+rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+export rev
+echo "rev=${rev}"
+# This initial deployment gets kicked off with some kernel arguments
+ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
+assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
+
+# Ok, let's create a long directory chain with custom permissions
+etc=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc
+mkdir -p ${etc}/a/long/dir/chain
+mkdir -p ${etc}/a/long/dir/forking
+chmod 700 ${etc}/a
+chmod 770 ${etc}/a/long
+chmod 777 ${etc}/a/long/dir
+chmod 707 ${etc}/a/long/dir/chain
+chmod 700 ${etc}/a/long/dir/forking
+
+# Now deploy a new commit
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot upgrade --os=testos
+newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+echo "newrev=${newrev}"
+
+newetc=sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc
+assert_file_has_mode() {
+ stat -c '%a' $1 > mode.txt
+ if ! grep -q -e "$2" mode.txt; then
+ echo 1>&2 "file $1 has mode $(cat mode.txt); expected $2";
+ exit 1
+ fi
+ rm -f mode.txt
+}
+assert_file_has_mode ${newetc}/a 700
+assert_file_has_mode ${newetc}/a/long 770
+assert_file_has_mode ${newetc}/a/long/dir 777
+assert_file_has_mode ${newetc}/a/long/dir/chain 707
+assert_file_has_mode ${newetc}/a/long/dir/forking 700
+assert_file_has_mode ${newetc}/a/long/dir 777
+
+echo "ok"