Package: util-linux Version: 2.26.2-6 Severity: normal Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu wily ubuntu-patch
The Ubuntu kernel team recently discovered a longstanding bug in util-linux's handling of $PATH in mkfs when calling mkfs.$fstype helpers: a stray \n at the end of a sprintf call corrupts the last directory name in the list, causing helpers located in this directory to not be found. This bug has been present upstream since util-linux 2.8, but only recently became apparent by a combination of btrfs-tools moving its helper from /sbin to /bin, and the kernel team using a minimal environment. * debian/patches/no-newline-in-path.patch: mkfs: Don't append newline to $PATH variable. Closes LP: #1474473. Thanks for considering the patch. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ slanga...@ubuntu.com vor...@debian.org
diff -Nru util-linux-2.26.2/debian/patches/no-newline-in-path.patch util-linux-2.26.2/debian/patches/no-newline-in-path.patch --- util-linux-2.26.2/debian/patches/no-newline-in-path.patch 1969-12-31 16:00:00.000000000 -0800 +++ util-linux-2.26.2/debian/patches/no-newline-in-path.patch 2015-07-21 15:07:08.000000000 -0700 @@ -0,0 +1,20 @@ +Author: Steve Langasek <steve.langa...@ubuntu.com> +Description: mkfs: Don't append newline to $PATH variable + A longstanding bug in mkfs causes a \n to be appended to the path used + for finding mkfs.$fstype helpers. This means that if the helper is in the + directory listed last on the path, it will never be found. +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1474473 + +Index: util-linux-2.26.2/disk-utils/mkfs.c +=================================================================== +--- util-linux-2.26.2.orig/disk-utils/mkfs.c ++++ util-linux-2.26.2/disk-utils/mkfs.c +@@ -132,7 +132,7 @@ + oldpath = "/bin"; + + newpath = xmalloc(strlen(oldpath) + sizeof(SEARCH_PATH) + 3); +- sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath); ++ sprintf(newpath, "%s:%s", SEARCH_PATH, oldpath); + putenv(newpath); + + progname = xmalloc(sizeof(PROGNAME) + strlen(fstype) + 1); diff -Nru util-linux-2.26.2/debian/patches/series util-linux-2.26.2/debian/patches/series --- util-linux-2.26.2/debian/patches/series 2015-07-03 07:38:14.000000000 -0700 +++ util-linux-2.26.2/debian/patches/series 2015-07-21 15:05:20.000000000 -0700 @@ -8,3 +8,4 @@ mountall-options.patch sulogin-lockedpwd.patch sulogin-fallback-static-sh.patch +no-newline-in-path.patch