Date: Friday, February 24, 2012 @ 19:42:27
  Author: tomegun
Revision: 151117

archrelease: copy trunk to testing-i686, testing-x86_64

Added:
  util-linux/repos/testing-i686/PKGBUILD
    (from rev 151116, util-linux/trunk/PKGBUILD)
  
util-linux/repos/testing-i686/lib-canonicalize-always-remove-tailing-slash.patch
    (from rev 151116, 
util-linux/trunk/lib-canonicalize-always-remove-tailing-slash.patch)
  
util-linux/repos/testing-i686/libmount-canonicalize-all-paths-from-fs-tab.patch
    (from rev 151116, 
util-linux/trunk/libmount-canonicalize-all-paths-from-fs-tab.patch)
  
util-linux/repos/testing-i686/libmount-canonicalize-targets-from-fstab-on-mount-a.patch
    (from rev 151116, 
util-linux/trunk/libmount-canonicalize-targets-from-fstab-on-mount-a.patch)
  util-linux/repos/testing-i686/mount-new-cleanup-mount-a-return-codes.patch
    (from rev 151116, 
util-linux/trunk/mount-new-cleanup-mount-a-return-codes.patch)
  util-linux/repos/testing-x86_64/PKGBUILD
    (from rev 151116, util-linux/trunk/PKGBUILD)
  
util-linux/repos/testing-x86_64/lib-canonicalize-always-remove-tailing-slash.patch
    (from rev 151116, 
util-linux/trunk/lib-canonicalize-always-remove-tailing-slash.patch)
  
util-linux/repos/testing-x86_64/libmount-canonicalize-all-paths-from-fs-tab.patch
    (from rev 151116, 
util-linux/trunk/libmount-canonicalize-all-paths-from-fs-tab.patch)
  
util-linux/repos/testing-x86_64/libmount-canonicalize-targets-from-fstab-on-mount-a.patch
    (from rev 151116, 
util-linux/trunk/libmount-canonicalize-targets-from-fstab-on-mount-a.patch)
  util-linux/repos/testing-x86_64/mount-new-cleanup-mount-a-return-codes.patch
    (from rev 151116, 
util-linux/trunk/mount-new-cleanup-mount-a-return-codes.patch)
Deleted:
  util-linux/repos/testing-i686/PKGBUILD
  util-linux/repos/testing-x86_64/PKGBUILD

--------------------------------------------------------------------------+
 testing-i686/PKGBUILD                                                    |  
109 +++++-----
 testing-i686/lib-canonicalize-always-remove-tailing-slash.patch          |   
37 +++
 testing-i686/libmount-canonicalize-all-paths-from-fs-tab.patch           |   
27 ++
 testing-i686/libmount-canonicalize-targets-from-fstab-on-mount-a.patch   |   
55 +++++
 testing-i686/mount-new-cleanup-mount-a-return-codes.patch                |  
101 +++++++++
 testing-x86_64/PKGBUILD                                                  |  
109 +++++-----
 testing-x86_64/lib-canonicalize-always-remove-tailing-slash.patch        |   
37 +++
 testing-x86_64/libmount-canonicalize-all-paths-from-fs-tab.patch         |   
27 ++
 testing-x86_64/libmount-canonicalize-targets-from-fstab-on-mount-a.patch |   
55 +++++
 testing-x86_64/mount-new-cleanup-mount-a-return-codes.patch              |  
101 +++++++++
 10 files changed, 562 insertions(+), 96 deletions(-)

Deleted: testing-i686/PKGBUILD
===================================================================
--- testing-i686/PKGBUILD       2012-02-25 00:41:44 UTC (rev 151116)
+++ testing-i686/PKGBUILD       2012-02-25 00:42:27 UTC (rev 151117)
@@ -1,48 +0,0 @@
-# $Id$
-# Maintainer: Tom Gundersen <[email protected]>
-# Contributor: judd <[email protected]>
-
-pkgname=util-linux
-pkgver=2.21
-pkgrel=1
-pkgdesc="Miscellaneous system utilities for Linux"
-url="http://www.kernel.org/pub/linux/utils/util-linux/";
-arch=('i686' 'x86_64')
-groups=('base')
-depends=('udev')
-conflicts=('util-linux-ng')
-provides=("util-linux-ng=${pkgver}")
-license=('GPL2')
-options=('!libtool')
-source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.xz)
-optdepends=('perl: for chkdupexe support')
-
-build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-
-  # hardware clock
-  sed -e 's%etc/adjtime%var/lib/hwclock/adjtime%' -i include/pathnames.h
-
-  ./configure --prefix=/usr \
-              --libdir=/usr/lib \
-              --enable-write \
-              --enable-raw \
-              --disable-wall \
-              --enable-new-mount
-
-  make
-}
-
-package() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-
-  make DESTDIR="${pkgdir}" install
-
-  cd "${pkgdir}"
-
-  install -dm755 var/lib/hwclock
-
-  # an empty stray dir
-  rm -r usr/share/man/ru
-}
-md5sums=('208aa058f4117759d2939d1be7d662fc')

Copied: util-linux/repos/testing-i686/PKGBUILD (from rev 151116, 
util-linux/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD                               (rev 0)
+++ testing-i686/PKGBUILD       2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,61 @@
+# $Id$
+# Maintainer: Tom Gundersen <[email protected]>
+# Contributor: judd <[email protected]>
+
+pkgname=util-linux
+pkgver=2.21
+pkgrel=2
+pkgdesc="Miscellaneous system utilities for Linux"
+url="http://www.kernel.org/pub/linux/utils/util-linux/";
+arch=('i686' 'x86_64')
+groups=('base')
+depends=('udev')
+conflicts=('util-linux-ng')
+provides=("util-linux-ng=${pkgver}")
+license=('GPL2')
+options=('!libtool')
+source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.xz
+       libmount-canonicalize-all-paths-from-fs-tab.patch
+       lib-canonicalize-always-remove-tailing-slash.patch
+       libmount-canonicalize-targets-from-fstab-on-mount-a.patch
+       mount-new-cleanup-mount-a-return-codes.patch)
+optdepends=('perl: for chkdupexe support')
+
+build() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+
+  # hardware clock
+  sed -e 's%etc/adjtime%var/lib/hwclock/adjtime%' -i include/pathnames.h
+
+  patch -p1 -i ../libmount-canonicalize-all-paths-from-fs-tab.patch
+  patch -p1 -i ../lib-canonicalize-always-remove-tailing-slash.patch
+  patch -p1 -i ../libmount-canonicalize-targets-from-fstab-on-mount-a.patch
+  patch -p1 -i ../mount-new-cleanup-mount-a-return-codes.patch 
+
+  ./configure --prefix=/usr \
+              --libdir=/usr/lib \
+              --enable-write \
+              --enable-raw \
+              --disable-wall \
+              --enable-new-mount
+
+  make
+}
+
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+
+  make DESTDIR="${pkgdir}" install
+
+  cd "${pkgdir}"
+
+  install -dm755 var/lib/hwclock
+
+  # delete stray empty dir, fixed upstream
+  rm -r usr/share/man/ru
+}
+md5sums=('208aa058f4117759d2939d1be7d662fc'
+         'c4011222a19b020d9b8465c3c7e443f6'
+         '8c1bf7b10e22e2b835441e6ae2d804d6'
+         '7b92423c588ed35229a9a166349c29a9'
+         'c483ab2d52609b5857d096b256a5075c')

Copied: 
util-linux/repos/testing-i686/lib-canonicalize-always-remove-tailing-slash.patch
 (from rev 151116, 
util-linux/trunk/lib-canonicalize-always-remove-tailing-slash.patch)
===================================================================
--- testing-i686/lib-canonicalize-always-remove-tailing-slash.patch             
                (rev 0)
+++ testing-i686/lib-canonicalize-always-remove-tailing-slash.patch     
2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,37 @@
+From 28074a0952469aebf021821d95238cfb964d13ff Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 21:26:11 +0100
+Subject: [PATCH 09/12] lib/canonicalize: always remove tailing slash
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ lib/canonicalize.c |   13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/lib/canonicalize.c b/lib/canonicalize.c
+index ab32c10..fd18af4 100644
+--- a/lib/canonicalize.c
++++ b/lib/canonicalize.c
+@@ -174,9 +174,16 @@ canonicalize_path(const char *path)
+       if (path == NULL)
+               return NULL;
+ 
+-      if (!myrealpath(path, canonical, PATH_MAX+1))
+-              return strdup(path);
+-
++      if (!myrealpath(path, canonical, PATH_MAX+1)) {
++              char *res = strdup(path);
++              if (res) {
++                      p = strrchr(res, '/');
++                      /* delete trailing slash */
++                      if (p && p > res && *(p + 1) == '\0')
++                              *p = '\0';
++              }
++              return res;
++      }
+ 
+       p = strrchr(canonical, '/');
+       if (p && strncmp(p, "/dm-", 4) == 0 && isdigit(*(p + 4))) {
+-- 
+1.7.9.2
+

Copied: 
util-linux/repos/testing-i686/libmount-canonicalize-all-paths-from-fs-tab.patch 
(from rev 151116, 
util-linux/trunk/libmount-canonicalize-all-paths-from-fs-tab.patch)
===================================================================
--- testing-i686/libmount-canonicalize-all-paths-from-fs-tab.patch              
                (rev 0)
+++ testing-i686/libmount-canonicalize-all-paths-from-fs-tab.patch      
2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,27 @@
+From 59e32a1f240c5f6a1d64d5e71a4a357245c34eaf Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 20:25:43 +0100
+Subject: [PATCH 07/12] libmount: canonicalize all paths from (fs)tab
+
+Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797216
+Signed-off-by: Karel Zak <[email protected]>
+---
+ libmount/src/tab.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libmount/src/tab.c b/libmount/src/tab.c
+index 37f47bd..f10c1de 100644
+--- a/libmount/src/tab.c
++++ b/libmount/src/tab.c
+@@ -456,7 +456,7 @@ struct libmnt_fs *mnt_table_find_target(struct 
libmnt_table *tb, const char *pat
+       while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
+               char *p;
+ 
+-              if (!fs->target || !mnt_fs_is_swaparea(fs) ||
++              if (!fs->target || mnt_fs_is_swaparea(fs) ||
+                   (*fs->target == '/' && *(fs->target + 1) == '\0'))
+                      continue;
+ 
+-- 
+1.7.9.2
+

Copied: 
util-linux/repos/testing-i686/libmount-canonicalize-targets-from-fstab-on-mount-a.patch
 (from rev 151116, 
util-linux/trunk/libmount-canonicalize-targets-from-fstab-on-mount-a.patch)
===================================================================
--- testing-i686/libmount-canonicalize-targets-from-fstab-on-mount-a.patch      
                        (rev 0)
+++ testing-i686/libmount-canonicalize-targets-from-fstab-on-mount-a.patch      
2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,55 @@
+From 6eba938376c2c870d9258ef9d7b6a3690cfa78dd Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 22:52:45 +0100
+Subject: [PATCH 11/12] libmount: canonicalize targets from fstab on mount -a
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ libmount/src/tab.c |   10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/libmount/src/tab.c b/libmount/src/tab.c
+index 66a9e4d..21b05c7 100644
+--- a/libmount/src/tab.c
++++ b/libmount/src/tab.c
+@@ -830,8 +830,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+ {
+       char *root = NULL;
+       struct libmnt_fs *src_fs;
+-      const char *src, *tgt;
+-      char *xsrc = NULL;
++      const char *src;
++      char *xsrc = NULL, *tgt;
+       int flags = 0, rc = 0;
+ 
+       assert(tb);
+@@ -852,7 +852,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+               src = xsrc = mnt_resolve_spec(mnt_fs_get_source(fstab_fs),
+                                             tb->cache);
+ 
+-      tgt = mnt_fs_get_target(fstab_fs);
++      tgt = mnt_resolve_path(mnt_fs_get_target(fstab_fs), tb->cache);
+ 
+       if (tgt && src && root) {
+               struct libmnt_iter itr;
+@@ -870,7 +870,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+                        * network filesystem source paths.
+                        */
+                       if (t && s && r &&
+-                          strcmp(t, tgt) == 0 &&
++                          streq_except_trailing_slash(t, tgt) &&
+                           streq_except_trailing_slash(s, src) &&
+                           strcmp(r, root) == 0)
+                               break;
+@@ -881,6 +881,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+ 
+       if (xsrc && !tb->cache)
+               free(xsrc);
++      if (!tb->cache)
++              free(tgt);
+ 
+       free(root);
+       return rc;
+-- 
+1.7.9.2
+

Copied: 
util-linux/repos/testing-i686/mount-new-cleanup-mount-a-return-codes.patch 
(from rev 151116, util-linux/trunk/mount-new-cleanup-mount-a-return-codes.patch)
===================================================================
--- testing-i686/mount-new-cleanup-mount-a-return-codes.patch                   
        (rev 0)
+++ testing-i686/mount-new-cleanup-mount-a-return-codes.patch   2012-02-25 
00:42:27 UTC (rev 151117)
@@ -0,0 +1,101 @@
+From 16b73aae8cb73df2974fd75c2a42ec3b92535851 Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 23:03:22 +0100
+Subject: [PATCH 12/12] mount: (new) cleanup mount -a return codes
+
+New return codes:
+
+  0 : all mounted (or all ignored)
+ 64 : some mounted, some failed
+ 32 : all failed
+
+Note that already mounted or ignored (filtered out by -t or -O)
+filesystems don't affect the final return code.
+
+The original mount(8) returns 0 instead of 64, so the situation
+"some mounted, some failed" cannot be detected.
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ sys-utils/mount.8 |    4 ++++
+ sys-utils/mount.c |   23 +++++++++++++++++------
+ 2 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
+index f1cff74..d18881b 100644
+--- a/sys-utils/mount.8
++++ b/sys-utils/mount.8
+@@ -2759,6 +2759,10 @@ mount failure
+ .TP
+ .BR 64
+ some mount succeeded
++.RE
++
++The command mount -a returns 0 (all success), 32 (all failed) or 64 (some
++failed, some success).
+ 
+ .SH NOTES
+ The syntax of external mount helpers is:
+diff --git a/sys-utils/mount.c b/sys-utils/mount.c
+index 17991b0..3fbac04 100644
+--- a/sys-utils/mount.c
++++ b/sys-utils/mount.c
+@@ -182,6 +182,8 @@ static int mount_all(struct libmnt_context *cxt)
+       struct libmnt_fs *fs;
+       int mntrc, ignored, rc = MOUNT_EX_SUCCESS;
+ 
++      int nsucc = 0, nerrs = 0;
++
+       itr = mnt_new_iter(MNT_ITER_FORWARD);
+       if (!itr) {
+               warn(_("failed to initialize libmount iterator"));
+@@ -197,31 +199,40 @@ static int mount_all(struct libmnt_context *cxt)
+                               printf(ignored == 1 ? _("%-25s: ignored\n") :
+                                                     _("%-25s: already 
mounted\n"),
+                                               tgt);
+-
+               } else if (mnt_context_is_fork(cxt)) {
+                       if (mnt_context_is_verbose(cxt))
+                               printf("%-25s: mount successfully forked\n", 
tgt);
+               } else {
+-                      rc |= mk_exit_code(cxt, mntrc);
++                      mk_exit_code(cxt, mntrc);       /* to print warnings */
+ 
+                       if (mnt_context_get_status(cxt)) {
+-                              rc |= MOUNT_EX_SOMEOK;
++                              nsucc++;
+ 
+                               if (mnt_context_is_verbose(cxt))
+                                       printf("%-25s: successfully mounted\n", 
tgt);
+-                      }
++                      } else
++                              nerrs++;
+               }
+       }
+ 
+       if (mnt_context_is_parent(cxt)) {
+               /* wait for mount --fork children */
+-              int nerrs = 0, nchildren = 0;
++              int nchildren = 0;
++
++              nerrs = 0, nsucc = 0;
+ 
+               rc = mnt_context_wait_for_children(cxt, &nchildren, &nerrs);
+               if (!rc && nchildren)
+-                      rc = nchildren == nerrs ? MOUNT_EX_FAIL : 
MOUNT_EX_SOMEOK;
++                      nsucc = nchildren - nerrs;
+       }
+ 
++      if (nerrs == 0)
++              rc = MOUNT_EX_SUCCESS;          /* all success */
++      else if (nsucc == 0)
++              rc = MOUNT_EX_FAIL;             /* all failed */
++      else
++              rc = MOUNT_EX_SOMEOK;           /* some success, some failed */
++
+       mnt_free_iter(itr);
+       return rc;
+ }
+-- 
+1.7.9.2
+

Deleted: testing-x86_64/PKGBUILD
===================================================================
--- testing-x86_64/PKGBUILD     2012-02-25 00:41:44 UTC (rev 151116)
+++ testing-x86_64/PKGBUILD     2012-02-25 00:42:27 UTC (rev 151117)
@@ -1,48 +0,0 @@
-# $Id$
-# Maintainer: Tom Gundersen <[email protected]>
-# Contributor: judd <[email protected]>
-
-pkgname=util-linux
-pkgver=2.21
-pkgrel=1
-pkgdesc="Miscellaneous system utilities for Linux"
-url="http://www.kernel.org/pub/linux/utils/util-linux/";
-arch=('i686' 'x86_64')
-groups=('base')
-depends=('udev')
-conflicts=('util-linux-ng')
-provides=("util-linux-ng=${pkgver}")
-license=('GPL2')
-options=('!libtool')
-source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.xz)
-optdepends=('perl: for chkdupexe support')
-
-build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-
-  # hardware clock
-  sed -e 's%etc/adjtime%var/lib/hwclock/adjtime%' -i include/pathnames.h
-
-  ./configure --prefix=/usr \
-              --libdir=/usr/lib \
-              --enable-write \
-              --enable-raw \
-              --disable-wall \
-              --enable-new-mount
-
-  make
-}
-
-package() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-
-  make DESTDIR="${pkgdir}" install
-
-  cd "${pkgdir}"
-
-  install -dm755 var/lib/hwclock
-
-  # an empty stray dir
-  rm -r usr/share/man/ru
-}
-md5sums=('208aa058f4117759d2939d1be7d662fc')

Copied: util-linux/repos/testing-x86_64/PKGBUILD (from rev 151116, 
util-linux/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD                             (rev 0)
+++ testing-x86_64/PKGBUILD     2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,61 @@
+# $Id$
+# Maintainer: Tom Gundersen <[email protected]>
+# Contributor: judd <[email protected]>
+
+pkgname=util-linux
+pkgver=2.21
+pkgrel=2
+pkgdesc="Miscellaneous system utilities for Linux"
+url="http://www.kernel.org/pub/linux/utils/util-linux/";
+arch=('i686' 'x86_64')
+groups=('base')
+depends=('udev')
+conflicts=('util-linux-ng')
+provides=("util-linux-ng=${pkgver}")
+license=('GPL2')
+options=('!libtool')
+source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.xz
+       libmount-canonicalize-all-paths-from-fs-tab.patch
+       lib-canonicalize-always-remove-tailing-slash.patch
+       libmount-canonicalize-targets-from-fstab-on-mount-a.patch
+       mount-new-cleanup-mount-a-return-codes.patch)
+optdepends=('perl: for chkdupexe support')
+
+build() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+
+  # hardware clock
+  sed -e 's%etc/adjtime%var/lib/hwclock/adjtime%' -i include/pathnames.h
+
+  patch -p1 -i ../libmount-canonicalize-all-paths-from-fs-tab.patch
+  patch -p1 -i ../lib-canonicalize-always-remove-tailing-slash.patch
+  patch -p1 -i ../libmount-canonicalize-targets-from-fstab-on-mount-a.patch
+  patch -p1 -i ../mount-new-cleanup-mount-a-return-codes.patch 
+
+  ./configure --prefix=/usr \
+              --libdir=/usr/lib \
+              --enable-write \
+              --enable-raw \
+              --disable-wall \
+              --enable-new-mount
+
+  make
+}
+
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+
+  make DESTDIR="${pkgdir}" install
+
+  cd "${pkgdir}"
+
+  install -dm755 var/lib/hwclock
+
+  # delete stray empty dir, fixed upstream
+  rm -r usr/share/man/ru
+}
+md5sums=('208aa058f4117759d2939d1be7d662fc'
+         'c4011222a19b020d9b8465c3c7e443f6'
+         '8c1bf7b10e22e2b835441e6ae2d804d6'
+         '7b92423c588ed35229a9a166349c29a9'
+         'c483ab2d52609b5857d096b256a5075c')

Copied: 
util-linux/repos/testing-x86_64/lib-canonicalize-always-remove-tailing-slash.patch
 (from rev 151116, 
util-linux/trunk/lib-canonicalize-always-remove-tailing-slash.patch)
===================================================================
--- testing-x86_64/lib-canonicalize-always-remove-tailing-slash.patch           
                (rev 0)
+++ testing-x86_64/lib-canonicalize-always-remove-tailing-slash.patch   
2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,37 @@
+From 28074a0952469aebf021821d95238cfb964d13ff Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 21:26:11 +0100
+Subject: [PATCH 09/12] lib/canonicalize: always remove tailing slash
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ lib/canonicalize.c |   13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/lib/canonicalize.c b/lib/canonicalize.c
+index ab32c10..fd18af4 100644
+--- a/lib/canonicalize.c
++++ b/lib/canonicalize.c
+@@ -174,9 +174,16 @@ canonicalize_path(const char *path)
+       if (path == NULL)
+               return NULL;
+ 
+-      if (!myrealpath(path, canonical, PATH_MAX+1))
+-              return strdup(path);
+-
++      if (!myrealpath(path, canonical, PATH_MAX+1)) {
++              char *res = strdup(path);
++              if (res) {
++                      p = strrchr(res, '/');
++                      /* delete trailing slash */
++                      if (p && p > res && *(p + 1) == '\0')
++                              *p = '\0';
++              }
++              return res;
++      }
+ 
+       p = strrchr(canonical, '/');
+       if (p && strncmp(p, "/dm-", 4) == 0 && isdigit(*(p + 4))) {
+-- 
+1.7.9.2
+

Copied: 
util-linux/repos/testing-x86_64/libmount-canonicalize-all-paths-from-fs-tab.patch
 (from rev 151116, 
util-linux/trunk/libmount-canonicalize-all-paths-from-fs-tab.patch)
===================================================================
--- testing-x86_64/libmount-canonicalize-all-paths-from-fs-tab.patch            
                (rev 0)
+++ testing-x86_64/libmount-canonicalize-all-paths-from-fs-tab.patch    
2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,27 @@
+From 59e32a1f240c5f6a1d64d5e71a4a357245c34eaf Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 20:25:43 +0100
+Subject: [PATCH 07/12] libmount: canonicalize all paths from (fs)tab
+
+Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797216
+Signed-off-by: Karel Zak <[email protected]>
+---
+ libmount/src/tab.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libmount/src/tab.c b/libmount/src/tab.c
+index 37f47bd..f10c1de 100644
+--- a/libmount/src/tab.c
++++ b/libmount/src/tab.c
+@@ -456,7 +456,7 @@ struct libmnt_fs *mnt_table_find_target(struct 
libmnt_table *tb, const char *pat
+       while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
+               char *p;
+ 
+-              if (!fs->target || !mnt_fs_is_swaparea(fs) ||
++              if (!fs->target || mnt_fs_is_swaparea(fs) ||
+                   (*fs->target == '/' && *(fs->target + 1) == '\0'))
+                      continue;
+ 
+-- 
+1.7.9.2
+

Copied: 
util-linux/repos/testing-x86_64/libmount-canonicalize-targets-from-fstab-on-mount-a.patch
 (from rev 151116, 
util-linux/trunk/libmount-canonicalize-targets-from-fstab-on-mount-a.patch)
===================================================================
--- testing-x86_64/libmount-canonicalize-targets-from-fstab-on-mount-a.patch    
                        (rev 0)
+++ testing-x86_64/libmount-canonicalize-targets-from-fstab-on-mount-a.patch    
2012-02-25 00:42:27 UTC (rev 151117)
@@ -0,0 +1,55 @@
+From 6eba938376c2c870d9258ef9d7b6a3690cfa78dd Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 22:52:45 +0100
+Subject: [PATCH 11/12] libmount: canonicalize targets from fstab on mount -a
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ libmount/src/tab.c |   10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/libmount/src/tab.c b/libmount/src/tab.c
+index 66a9e4d..21b05c7 100644
+--- a/libmount/src/tab.c
++++ b/libmount/src/tab.c
+@@ -830,8 +830,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+ {
+       char *root = NULL;
+       struct libmnt_fs *src_fs;
+-      const char *src, *tgt;
+-      char *xsrc = NULL;
++      const char *src;
++      char *xsrc = NULL, *tgt;
+       int flags = 0, rc = 0;
+ 
+       assert(tb);
+@@ -852,7 +852,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+               src = xsrc = mnt_resolve_spec(mnt_fs_get_source(fstab_fs),
+                                             tb->cache);
+ 
+-      tgt = mnt_fs_get_target(fstab_fs);
++      tgt = mnt_resolve_path(mnt_fs_get_target(fstab_fs), tb->cache);
+ 
+       if (tgt && src && root) {
+               struct libmnt_iter itr;
+@@ -870,7 +870,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+                        * network filesystem source paths.
+                        */
+                       if (t && s && r &&
+-                          strcmp(t, tgt) == 0 &&
++                          streq_except_trailing_slash(t, tgt) &&
+                           streq_except_trailing_slash(s, src) &&
+                           strcmp(r, root) == 0)
+                               break;
+@@ -881,6 +881,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, 
struct libmnt_fs *fstab_fs)
+ 
+       if (xsrc && !tb->cache)
+               free(xsrc);
++      if (!tb->cache)
++              free(tgt);
+ 
+       free(root);
+       return rc;
+-- 
+1.7.9.2
+

Copied: 
util-linux/repos/testing-x86_64/mount-new-cleanup-mount-a-return-codes.patch 
(from rev 151116, util-linux/trunk/mount-new-cleanup-mount-a-return-codes.patch)
===================================================================
--- testing-x86_64/mount-new-cleanup-mount-a-return-codes.patch                 
        (rev 0)
+++ testing-x86_64/mount-new-cleanup-mount-a-return-codes.patch 2012-02-25 
00:42:27 UTC (rev 151117)
@@ -0,0 +1,101 @@
+From 16b73aae8cb73df2974fd75c2a42ec3b92535851 Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 24 Feb 2012 23:03:22 +0100
+Subject: [PATCH 12/12] mount: (new) cleanup mount -a return codes
+
+New return codes:
+
+  0 : all mounted (or all ignored)
+ 64 : some mounted, some failed
+ 32 : all failed
+
+Note that already mounted or ignored (filtered out by -t or -O)
+filesystems don't affect the final return code.
+
+The original mount(8) returns 0 instead of 64, so the situation
+"some mounted, some failed" cannot be detected.
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ sys-utils/mount.8 |    4 ++++
+ sys-utils/mount.c |   23 +++++++++++++++++------
+ 2 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
+index f1cff74..d18881b 100644
+--- a/sys-utils/mount.8
++++ b/sys-utils/mount.8
+@@ -2759,6 +2759,10 @@ mount failure
+ .TP
+ .BR 64
+ some mount succeeded
++.RE
++
++The command mount -a returns 0 (all success), 32 (all failed) or 64 (some
++failed, some success).
+ 
+ .SH NOTES
+ The syntax of external mount helpers is:
+diff --git a/sys-utils/mount.c b/sys-utils/mount.c
+index 17991b0..3fbac04 100644
+--- a/sys-utils/mount.c
++++ b/sys-utils/mount.c
+@@ -182,6 +182,8 @@ static int mount_all(struct libmnt_context *cxt)
+       struct libmnt_fs *fs;
+       int mntrc, ignored, rc = MOUNT_EX_SUCCESS;
+ 
++      int nsucc = 0, nerrs = 0;
++
+       itr = mnt_new_iter(MNT_ITER_FORWARD);
+       if (!itr) {
+               warn(_("failed to initialize libmount iterator"));
+@@ -197,31 +199,40 @@ static int mount_all(struct libmnt_context *cxt)
+                               printf(ignored == 1 ? _("%-25s: ignored\n") :
+                                                     _("%-25s: already 
mounted\n"),
+                                               tgt);
+-
+               } else if (mnt_context_is_fork(cxt)) {
+                       if (mnt_context_is_verbose(cxt))
+                               printf("%-25s: mount successfully forked\n", 
tgt);
+               } else {
+-                      rc |= mk_exit_code(cxt, mntrc);
++                      mk_exit_code(cxt, mntrc);       /* to print warnings */
+ 
+                       if (mnt_context_get_status(cxt)) {
+-                              rc |= MOUNT_EX_SOMEOK;
++                              nsucc++;
+ 
+                               if (mnt_context_is_verbose(cxt))
+                                       printf("%-25s: successfully mounted\n", 
tgt);
+-                      }
++                      } else
++                              nerrs++;
+               }
+       }
+ 
+       if (mnt_context_is_parent(cxt)) {
+               /* wait for mount --fork children */
+-              int nerrs = 0, nchildren = 0;
++              int nchildren = 0;
++
++              nerrs = 0, nsucc = 0;
+ 
+               rc = mnt_context_wait_for_children(cxt, &nchildren, &nerrs);
+               if (!rc && nchildren)
+-                      rc = nchildren == nerrs ? MOUNT_EX_FAIL : 
MOUNT_EX_SOMEOK;
++                      nsucc = nchildren - nerrs;
+       }
+ 
++      if (nerrs == 0)
++              rc = MOUNT_EX_SUCCESS;          /* all success */
++      else if (nsucc == 0)
++              rc = MOUNT_EX_FAIL;             /* all failed */
++      else
++              rc = MOUNT_EX_SOMEOK;           /* some success, some failed */
++
+       mnt_free_iter(itr);
+       return rc;
+ }
+-- 
+1.7.9.2
+

Reply via email to