Package: drbd-utils
Version: 8.9.10-3
Severity: minor
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu cosmic ubuntu-patch

Dear Maintainer,

Newer udev handling of rules that create SYMLINKs causes the way drbd creates 
symlinks
to fail, by creating a single symlink with whitespace inside the symlink, 
instead of
multiple symlinks.

This upstream patch applies cleanly the this version of drbd-utils in debian.

  * Fix creation of drbd symlinks, broken by newer udev

Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers bionic-updates
  APT policy: (500, 'bionic-updates'), (500, 'bionic-security'), (500, 'bionic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-19-generic (SMP w/24 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
drbd-utils-8.9.10/debian/patches/0001-v9-fix-nonsense-symlinks-due-to-udev-change-of-strin.patch
 
drbd-utils-8.9.10/debian/patches/0001-v9-fix-nonsense-symlinks-due-to-udev-change-of-strin.patch
--- 
drbd-utils-8.9.10/debian/patches/0001-v9-fix-nonsense-symlinks-due-to-udev-change-of-strin.patch
    1969-12-31 19:00:00.000000000 -0500
+++ 
drbd-utils-8.9.10/debian/patches/0001-v9-fix-nonsense-symlinks-due-to-udev-change-of-strin.patch
    2018-05-25 11:07:21.000000000 -0400
@@ -0,0 +1,67 @@
+From: Lars Ellenberg <lars.ellenb...@linbit.com>
+Subject: [PATCH] v9: fix nonsense symlinks due to udev change of
+ string_escape=none -> replace
+Bug-Ubuntu: https://launchpad.net/bugs/1673255
+Origin: upstream, 
https://github.com/LINBIT/drbd-utils/commit/05c0797248af6f4e3b5b04545fe068dba41e3d81
+diff --git a/scripts/drbd.rules.in b/scripts/drbd.rules.in
+index cdf4af61..46444bd1 100644
+--- a/scripts/drbd.rules.in
++++ b/scripts/drbd.rules.in
+@@ -6,7 +6,12 @@ KERNEL!="drbd*", GOTO="drbd_end"
+ IMPORT{program}="@sbindir@/drbdadm sh-udev minor-%m"
+ 
+ # Use symlink from the environment if available
+-ENV{SYMLINK}!="", SYMLINK="$env{SYMLINK}", GOTO="have_symlink"
++# some udev version thought it was a good idea to change a long established
++# default of string_escape=none to string_escape=replace :-/
++# therefore, recent enough drbdadm will no longer export space separated 
lists.
++ENV{SYMLINK_BY_DISK}!="", SYMLINK+="$env{SYMLINK_BY_DISK}"
++ENV{SYMLINK_BY_RES}!="", SYMLINK+="$env{SYMLINK_BY_RES}", GOTO="have_symlink"
++ENV{SYMLINK}!="", OPTIONS+="string_escape=none", SYMLINK="$env{SYMLINK}", 
GOTO="have_symlink"
+ 
+ # Legacy rules for older DRBD 8.3 & 8.4 when drbdadm sh-udev did not yet 
export SYMLINK
+ ENV{DISK}!="", SYMLINK+="drbd/by-disk/$env{DISK}"
+diff --git a/user/v9/drbdadm_main.c b/user/v9/drbdadm_main.c
+index 7a705fd8..d6d2f970 100644
+--- a/user/v9/drbdadm_main.c
++++ b/user/v9/drbdadm_main.c
+@@ -840,18 +840,31 @@ static int sh_udev(const struct cfg_ctx *ctx)
+       else
+               printf("DEVICE=drbd%u\n", vol->device_minor);
+ 
++      /* in case older udev rules are still in place,
++       * but do not yet have the work-around for the
++       * udev default change of "string_escape=none" -> "replace",
++       * populate plain "SYMLINK" with just the "by-res" one. */
+       printf("SYMLINK=");
+       if (vol->implicit)
+-              printf("drbd/by-res/%s", res->name);
++              printf("drbd/by-res/%s\n", res->name);
+       else
+-              printf("drbd/by-res/%s/%u", res->name, vol->vnr);
++              printf("drbd/by-res/%s/%u\n", res->name, vol->vnr);
++
++      /* repeat, with _BY_RES */
++      printf("SYMLINK_BY_RES=");
++      if (vol->implicit)
++              printf("drbd/by-res/%s\n", res->name);
++      else
++              printf("drbd/by-res/%s/%u\n", res->name, vol->vnr);
++
++      /* and add the _BY_DISK one explicitly */
+       if (vol->disk) {
++              printf("SYMLINK_BY_DISK=");
+               if (!strncmp(vol->disk, "/dev/", 5))
+-                      printf(" drbd/by-disk/%s", vol->disk + 5);
++                      printf("drbd/by-disk/%s\n", vol->disk + 5);
+               else
+-                      printf(" drbd/by-disk/%s", vol->disk);
++                      printf("drbd/by-disk/%s\n", vol->disk);
+       }
+-      printf("\n");
+ 
+       return 0;
+ }
+-- 
+2.17.0
+
diff -Nru drbd-utils-8.9.10/debian/patches/series 
drbd-utils-8.9.10/debian/patches/series
--- drbd-utils-8.9.10/debian/patches/series     2017-05-12 07:43:00.000000000 
-0400
+++ drbd-utils-8.9.10/debian/patches/series     2018-05-25 11:02:41.000000000 
-0400
@@ -5,3 +5,4 @@
 initscript-remove-path.patch
 reproducible-build
 initscript-add-start-runlevels.patch
+0001-v9-fix-nonsense-symlinks-due-to-udev-change-of-strin.patch

Reply via email to