dbcheck failures on Fedora

Garming Sam garming at catalyst.net.nz
Wed Feb 28 00:19:56 UTC 2018


Hi,

The test just hasn't been running on the autobuild machine for a while
clearly (as well as anyone running on Ubuntu). All the other spots that
failed because of running a newer schema were already fixed, but
obviously this one wasn't because it was skipped. I've fixed the test
and tested it alongside the remainder of Timur's patch.

I've tried the attached patches on CentOS and it also seems to work and
pass all the tests mentioned. However I did notice that unlike a default
Ubuntu install, 'patch' needed to be installed -- which is probably what
is additionally causing Andreas' failures. It's an unfortunate
dependency, in an odd spot, but it seemed the most sensible way of
applying a diff here. I've added some more info to the schemaupgrade
command in the case that 'patch' does not exist.

Apologies for not being able to look at this any earlier. Please review
and push.


Cheers,

Garming


On 29/01/18 09:37, Uri Simchoni via samba-technical wrote:
> On 01/28/2018 10:12 PM, Andrew Bartlett via samba-technical wrote:
>> This one Andreas raised just before the release because this overall
>> test now fails for him on Fedora, but not Ubuntu. 
>>
> What I'm trying to say is that those tests also fail on the autobuild
> machine (which is Ubuntu. Perhaps there's an instance of Ubuntu on which
> they pass, I don't want to make general claims). The reason they *seem*
> to pass is the bashism, which cause the test not to run at all on the
> autobuild machine, but once the bashism is fixed, the test fails and the
> patch can't land.
>
> Thanks,
> Uri.
>

-------------- next part --------------
From ed3d86181c3d95466a428156a5d55e33c3bf82df Mon Sep 17 00:00:00 2001
From: Garming Sam <garming at catalyst.net.nz>
Date: Wed, 28 Feb 2018 12:17:46 +1300
Subject: [PATCH 1/3] tests/dbcheck: Provision using the old schema and ignore
 displayName

These tests are currently not run on Ubuntu due to bashisms in the test.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
---
 testprogs/blackbox/dbcheck-oldrelease.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh
index 9802486..febf0ee 100755
--- a/testprogs/blackbox/dbcheck-oldrelease.sh
+++ b/testprogs/blackbox/dbcheck-oldrelease.sh
@@ -367,13 +367,16 @@ check_expected_after_deleted_objects() {
 
 referenceprovision() {
     if [ x$RELEASE == x"release-4-0-0" ]; then
-        $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 --function-level=2003
+        $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 --function-level=2003 --base-schema=2008_R2_old
+
+        # on top of this, also apply 2008R2 changes we accidentally missed in the past
+        $PYTHON $BINDIR/samba-tool domain schemaupgrade -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --ldf-file=samba-4.7-missing-for-schema45.ldif,fix-forest-rev.ldf
     fi
 }
 
 ldapcmp() {
     if [ x$RELEASE == x"release-4-0-0" ]; then
-         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord
+         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord,displayName
     fi
 }
 
-- 
1.9.1


From 5131ce1f9a9d4836449fb654fb9f6f01420f2023 Mon Sep 17 00:00:00 2001
From: "Timur I. Bakeyev" <timur at iXsystems.com>
Date: Mon, 11 Dec 2017 02:47:21 +0100
Subject: [PATCH 2/3] Remove some bashisms from the test scripts

Signed-off-by: Timur I. Bakeyev <timur at iXsystems.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
---
 testprogs/blackbox/dbcheck-oldrelease.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh
index febf0ee..700f4fb 100755
--- a/testprogs/blackbox/dbcheck-oldrelease.sh
+++ b/testprogs/blackbox/dbcheck-oldrelease.sh
@@ -366,7 +366,7 @@ check_expected_after_deleted_objects() {
 }
 
 referenceprovision() {
-    if [ x$RELEASE == x"release-4-0-0" ]; then
+    if [ x$RELEASE = x"release-4-0-0" ]; then
         $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 --function-level=2003 --base-schema=2008_R2_old
 
         # on top of this, also apply 2008R2 changes we accidentally missed in the past
@@ -375,13 +375,13 @@ referenceprovision() {
 }
 
 ldapcmp() {
-    if [ x$RELEASE == x"release-4-0-0" ]; then
+    if [ x$RELEASE = x"release-4-0-0" ]; then
          $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord,displayName
     fi
 }
 
 ldapcmp_sd() {
-    if [ x$RELEASE == x"release-4-0-0" ]; then
+    if [ x$RELEASE = x"release-4-0-0" ]; then
         $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --two --sd --skip-missing-dn
     fi
 }
-- 
1.9.1


From 088c33bc09933e09d86607f321d881e731c64cb2 Mon Sep 17 00:00:00 2001
From: Garming Sam <garming at catalyst.net.nz>
Date: Wed, 28 Feb 2018 12:38:12 +1300
Subject: [PATCH 3/3] domain.py: Give some advice if the schema upgrade command
 fails

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
---
 python/samba/netcmd/domain.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 936b669..da1b226 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -4153,9 +4153,14 @@ class cmd_domain_schema_upgrade(Command):
                 # Apply patches if we parsed the Schema-Updates.md file
                 diff = os.path.abspath(os.path.join(diff_dir, update + '.diff'))
                 if temp_folder and os.path.exists(diff):
-                    p = subprocess.Popen(['patch', update, '-i', diff],
-                                         stdout=subprocess.PIPE,
-                                         stderr=subprocess.PIPE, cwd=temp_folder)
+                    try:
+                        p = subprocess.Popen(['patch', update, '-i', diff],
+                                             stdout=subprocess.PIPE,
+                                             stderr=subprocess.PIPE, cwd=temp_folder)
+                    except (OSError, IOError):
+                        shutil.rmtree(temp_folder)
+                        raise CommandError("Failed to upgrade schema. Check if 'patch' is installed.")
+
                     stdout, stderr = p.communicate()
 
                     if p.returncode:
-- 
1.9.1



More information about the samba-technical mailing list