Date: Friday, February 24, 2012 @ 19:13:54
  Author: tomegun
Revision: 151113

add patches

Added:
  util-linux/trunk/build-sys-don-t-create-empty-man-ru-directory.patch
  util-linux/trunk/lib-canonicalize-always-remove-tailing-slash.patch
  util-linux/trunk/libmount-canonicalize-all-paths-from-fs-tab.patch
  util-linux/trunk/libmount-canonicalize-targets-from-fstab-on-mount-a.patch
  util-linux/trunk/mount-new-cleanup-mount-a-return-codes.patch
Modified:
  util-linux/trunk/PKGBUILD

-----------------------------------------------------------+
 PKGBUILD                                                  |   23 ++
 build-sys-don-t-create-empty-man-ru-directory.patch       |   29 +++
 lib-canonicalize-always-remove-tailing-slash.patch        |   37 ++++
 libmount-canonicalize-all-paths-from-fs-tab.patch         |   27 +++
 libmount-canonicalize-targets-from-fstab-on-mount-a.patch |   55 ++++++
 mount-new-cleanup-mount-a-return-codes.patch              |  101 ++++++++++++
 6 files changed, 267 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2012-02-24 23:20:45 UTC (rev 151112)
+++ PKGBUILD    2012-02-25 00:13:54 UTC (rev 151113)
@@ -14,7 +14,12 @@
 provides=("util-linux-ng=${pkgver}")
 license=('GPL2')
 options=('!libtool')
-source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.xz)
+source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.xz
+       build-sys-don-t-create-empty-man-ru-directory.patch
+       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() {
@@ -23,6 +28,12 @@
   # hardware clock
   sed -e 's%etc/adjtime%var/lib/hwclock/adjtime%' -i include/pathnames.h
 
+  patch -p1 -i ../build-sys-don-t-create-empty-man-ru-directory.patch
+  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 \
@@ -41,8 +52,10 @@
   cd "${pkgdir}"
 
   install -dm755 var/lib/hwclock
-
-  # an empty stray dir
-  rm -r usr/share/man/ru
 }
-md5sums=('208aa058f4117759d2939d1be7d662fc')
+md5sums=('208aa058f4117759d2939d1be7d662fc'
+         '066a55b04c07a1e0b777e90ab2fe0c6e'
+         'c4011222a19b020d9b8465c3c7e443f6'
+         '8c1bf7b10e22e2b835441e6ae2d804d6'
+         '7b92423c588ed35229a9a166349c29a9'
+         'c483ab2d52609b5857d096b256a5075c')

Added: build-sys-don-t-create-empty-man-ru-directory.patch
===================================================================
--- build-sys-don-t-create-empty-man-ru-directory.patch                         
(rev 0)
+++ build-sys-don-t-create-empty-man-ru-directory.patch 2012-02-25 00:13:54 UTC 
(rev 151113)
@@ -0,0 +1,29 @@
+From 6a0335d6cbdedeacc0afef251a53c945699ddea7 Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+Date: Fri, 24 Feb 2012 14:09:27 +0100
+Subject: [PATCH 01/12] build-sys: don't create empty man/ru directory
+
+Reported-by: Tom Gundersen <t...@jklm.no>
+Signed-off-by: Karel Zak <k...@redhat.com>
+---
+ man/ru/Makefile.am |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/man/ru/Makefile.am b/man/ru/Makefile.am
+index 799feca..31fafb9 100644
+--- a/man/ru/Makefile.am
++++ b/man/ru/Makefile.am
+@@ -1,9 +1,7 @@
+ include $(top_srcdir)/config/include-Makefile.am
+ 
++if BUILD_DDATE
+ mandir = @mandir@/ru
+-
+ dist_man_MANS =
+-
+-if BUILD_DDATE
+ dist_man_MANS += ddate.1
+ endif
+-- 
+1.7.9.2
+

Added: lib-canonicalize-always-remove-tailing-slash.patch
===================================================================
--- lib-canonicalize-always-remove-tailing-slash.patch                          
(rev 0)
+++ lib-canonicalize-always-remove-tailing-slash.patch  2012-02-25 00:13:54 UTC 
(rev 151113)
@@ -0,0 +1,37 @@
+From 28074a0952469aebf021821d95238cfb964d13ff Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+Date: Fri, 24 Feb 2012 21:26:11 +0100
+Subject: [PATCH 09/12] lib/canonicalize: always remove tailing slash
+
+Signed-off-by: Karel Zak <k...@redhat.com>
+---
+ 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
+

Added: libmount-canonicalize-all-paths-from-fs-tab.patch
===================================================================
--- libmount-canonicalize-all-paths-from-fs-tab.patch                           
(rev 0)
+++ libmount-canonicalize-all-paths-from-fs-tab.patch   2012-02-25 00:13:54 UTC 
(rev 151113)
@@ -0,0 +1,27 @@
+From 59e32a1f240c5f6a1d64d5e71a4a357245c34eaf Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+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 <k...@redhat.com>
+---
+ 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
+

Added: libmount-canonicalize-targets-from-fstab-on-mount-a.patch
===================================================================
--- libmount-canonicalize-targets-from-fstab-on-mount-a.patch                   
        (rev 0)
+++ libmount-canonicalize-targets-from-fstab-on-mount-a.patch   2012-02-25 
00:13:54 UTC (rev 151113)
@@ -0,0 +1,55 @@
+From 6eba938376c2c870d9258ef9d7b6a3690cfa78dd Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+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 <k...@redhat.com>
+---
+ 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
+

Added: mount-new-cleanup-mount-a-return-codes.patch
===================================================================
--- mount-new-cleanup-mount-a-return-codes.patch                                
(rev 0)
+++ mount-new-cleanup-mount-a-return-codes.patch        2012-02-25 00:13:54 UTC 
(rev 151113)
@@ -0,0 +1,101 @@
+From 16b73aae8cb73df2974fd75c2a42ec3b92535851 Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+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 <k...@redhat.com>
+---
+ 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