diff -Nru samba-4.9.5+dfsg/debian/changelog samba-4.9.5+dfsg/debian/changelog
--- samba-4.9.5+dfsg/debian/changelog	2019-09-02 13:39:42.000000000 +0000
+++ samba-4.9.5+dfsg/debian/changelog	2019-09-04 18:28:48.000000000 +0000
@@ -1,3 +1,9 @@
+samba (2:4.9.5+dfsg-5+deb10u1+rpi1) buster-staging; urgency=medium
+
+  * Fix version ordering for libparse-pidl-perl
+
+ -- Peter Michael Green <plugwash@raspbian.org>  Wed, 04 Sep 2019 18:28:48 +0000
+
 samba (2:4.9.5+dfsg-5+deb10u1) buster-security; urgency=high
 
   * Non-maintainer upload by the Security Team.
diff -Nru samba-4.9.5+dfsg/debian/rules samba-4.9.5+dfsg/debian/rules
--- samba-4.9.5+dfsg/debian/rules	2019-09-02 13:39:42.000000000 +0000
+++ samba-4.9.5+dfsg/debian/rules	2019-09-04 18:28:48.000000000 +0000
@@ -261,9 +261,17 @@
 	    -e debian/samba-vfs-modules/usr/lib/*/samba/vfs/snapper.so
 endif
 
+ifeq (,$(findstring +deb,$(DEB_VERSION)))
+  PIDL_PERL_VERSION := $(DEB_VERSION)+really0.02
+else
+  VERSIONPRE := $(firstword $(subst +deb, ,$(DEB_VERSION)))
+  VERSIONPOST := $(word 2,$(subst +deb, ,$(DEB_VERSION)))
+  PIDL_PERL_VERSION := $(VERSIONPRE)+really0.02+deb$(VERSIONPOST)
+endif
+
 override_dh_gencontrol:
 ifneq (,$(filter libparse-pidl-perl, $(shell dh_listpackages)))
-	dh_gencontrol --package=libparse-pidl-perl -- -v$(DEB_VERSION)+really0.02
+	dh_gencontrol --package=libparse-pidl-perl -- -v$(PIDL_PERL_VERSION)
 endif
 	dh_gencontrol --remaining-packages -- -Vldb:Depends=$(LDB_DEPENDS)