Add a fallback routine to swapon -a that checks symlinks #69162.
authorMike Frysinger <vapier@gentoo.org>
Sat, 30 Oct 2004 21:42:11 +0000 (21:42 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sat, 30 Oct 2004 21:42:11 +0000 (21:42 +0000)
sys-apps/util-linux/ChangeLog
sys-apps/util-linux/files/digest-util-linux-2.12b-r1 [new file with mode: 0644]
sys-apps/util-linux/files/util-linux-swapon-check-symlinks.patch [new file with mode: 0644]
sys-apps/util-linux/util-linux-2.12b-r1.ebuild [new file with mode: 0644]

index b20b3491be2e4026f35d0ff3da94a89488a27bab..daa43768483aec3ea90779b957e37b6114731703 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for sys-apps/util-linux
 # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.88 2004/09/15 19:15:41 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.89 2004/10/30 21:42:11 vapier Exp $
+
+*util-linux-2.12b-r1 (30 Oct 2004)
+
+  30 Oct 2004; Mike Frysinger <vapier@gentoo.org>
+  +files/util-linux-swapon-check-symlinks.patch,
+  +util-linux-2.12b-r1.ebuild:
+  Add a fallback routine to swapon -a that checks symlinks #69162.
 
   15 Sep 2004; Martin Schlemmer <azarah@gentoo.org> util-linux-2.12b.ebuild:
   Add >=sys-fs/e2fsprogs-1.34 dependency (blkid_known_fstype in
diff --git a/sys-apps/util-linux/files/digest-util-linux-2.12b-r1 b/sys-apps/util-linux/files/digest-util-linux-2.12b-r1
new file mode 100644 (file)
index 0000000..2af541c
--- /dev/null
@@ -0,0 +1,2 @@
+MD5 2e96fd7efa1ff477502e91c31572d51b util-linux-2.12b.tar.gz 1967337
+MD5 a87c737b80c52fbd8f515c40f403737c util-linux-2.12b-cryptoapi-losetup.patch.bz2 4868
diff --git a/sys-apps/util-linux/files/util-linux-swapon-check-symlinks.patch b/sys-apps/util-linux/files/util-linux-swapon-check-symlinks.patch
new file mode 100644 (file)
index 0000000..9b14886
--- /dev/null
@@ -0,0 +1,37 @@
+--- util-linux-2.12b/mount/swapon.c.orig       2004-10-28 10:02:44.320023600 -0400
++++ util-linux-2.12b/mount/swapon.c    2004-10-28 10:02:14.384574000 -0400
+@@ -22,6 +22,7 @@
+ #include <errno.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <sys/param.h>
+ #include "swap_constants.h"
+ #include "swapargs.h"
+ #include "nls.h"
+@@ -143,10 +144,26 @@
+ static int
+ is_in_proc_swaps(char *fname) {
+       int i;
++      struct stat fstatbuf;
+ 
+       for (i = 0; i < numSwaps; i++)
+               if (!strcmp(fname, swapFiles[i]))
+                       return 1;
++
++      /* fallback:
++       * if the device in /etc/fstab is a symlink, the entry
++       * in /proc/swaps won't match because the kernel stores
++       * absolute pathnames.  Here we compare dev_t's.
++       */
++      if (!lstat(fname, &fstatbuf))
++              if (S_ISLNK(fstatbuf.st_mode)) {
++                      struct stat swapstatbuf;
++                      for (i = 0; i < numSwaps; i++)
++                              if (!stat(swapFiles[i], &swapstatbuf) && \
++                                  swapstatbuf.st_dev == fstatbuf.st_dev)
++                                      return 1;
++              }
++
+       return 0;
+ }
+ 
diff --git a/sys-apps/util-linux/util-linux-2.12b-r1.ebuild b/sys-apps/util-linux/util-linux-2.12b-r1.ebuild
new file mode 100644 (file)
index 0000000..bfd5028
--- /dev/null
@@ -0,0 +1,162 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/util-linux-2.12b-r1.ebuild,v 1.1 2004/10/30 21:42:11 vapier Exp $
+
+inherit eutils flag-o-matic
+
+CRYPT_PATCH_P="${PN}-2.12b-cryptoapi-losetup"
+DESCRIPTION="Various useful Linux utilities"
+HOMEPAGE="http://www.kernel.org/pub/linux/utils/util-linux/"
+SRC_URI="mirror://kernel/linux/utils/${PN}/${P}.tar.gz
+       ftp://ftp.cwi.nl/pub/aeb/${PN}/${P}.tar.gz
+       crypt? ( mirror://gentoo/${CRYPT_PATCH_P}.patch.bz2 )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
+IUSE="crypt nls static pam selinux uclibc"
+
+DEPEND="virtual/libc
+       >=sys-apps/sed-4.0.5
+       >=sys-libs/ncurses-5.2-r2
+       >=sys-fs/e2fsprogs-1.34
+       selinux? ( sys-libs/libselinux )
+       pam? ( sys-apps/pam-login )
+       crypt? ( app-crypt/hashalot )"
+# We need perl because one script ( chkdupexe ) is
+# written in frickin perl; otherwise we dont need it ...
+RDEPEND="${DEPEND}
+       dev-lang/perl
+       nls? ( sys-devel/gettext )"
+
+src_unpack() {
+       unpack ${A}
+
+       cd ${S}
+
+       # CryptoAPI losetup patch for the cryptoapi sepecific
+       # to the 2.6 linux kernel. Needs hashalot.
+       # Original patch location:
+       # http://www.stwing.org/~sluskyb/util-linux/losetup-combined.patch
+       # Mailing list post with info:
+       # http://www.kerneli.org/pipermail/cryptoapi-devel/2003-September/000634.html
+       # Follow thread for usage.
+       use crypt && epatch ${DISTDIR}/${CRYPT_PATCH_P}.patch.bz2
+
+       # Fix rare failures with -j4 or higher
+       epatch ${FILESDIR}/${PN}-2.11z-parallel-make.patch
+
+       # Fix unreadable df output
+       epatch ${FILESDIR}/no-symlink-resolve.patch
+
+       # access() is a macro which uses R_OK however
+       # R_OK is not defined on sparc during a bootstrap
+       # unless we actually include unistd.h -solar (May 07 2004)
+       epatch ${FILESDIR}/${PN}-2.12-swapon-unistd.patch
+
+       # Add the O option to agetty to display DNS domainname in the issue
+       # file, thanks to Marius Mauch <genone@genone.de>, bug #22275.
+       #
+       # NOTE:  Removing this will break future baselayout, so PLEASE
+       #        consult with me before doing so.
+       #
+       # <azarah@gentoo.og> (17 Jul 2003)
+       epatch ${FILESDIR}/${PN}-2.11z-agetty-domainname-option.patch
+
+       # Add NFS4 support (kernel 2.5/2.6).
+#      use crypt \
+#              && epatch ${FILESDIR}/${PN}-2.11z-01-nfsv4-crypt.dif \
+#              ||
+       epatch ${FILESDIR}/${PN}-2.11z-01-nfsv4.dif
+
+       # <solar@gentoo.org> This patch should allow us to remove -fPIC
+       # out of the filter-flags we need this be able to emit position
+       # independent code so we can link our elf executables as shared
+       # objects. "prelink" should now also be able to take advantage
+       epatch ${FILESDIR}/${P}-pic.patch
+
+       ## see below for details on pic.patch
+       case ${ARCH} in
+               "x86"|"hppa"|"sparc"|"ppc"|"amd64")
+                       ;;
+               *)
+                       filter-flags -fPIC
+                       ;;
+       esac
+
+       # Add support to read fat/fat32 labels, bug #36722
+       epatch ${FILESDIR}/${P}-fat-LABEL-support.patch
+
+       # Add support for gcloop
+       use crypt || epatch ${FILESDIR}/${P}-gcloop.patch
+       use crypt && epatch ${FILESDIR}/${P}-gcloop-with-crypt.patch
+
+       # Enable pam only if we use it
+       use pam && sed -i "s:HAVE_PAM=no:HAVE_PAM=yes:" MCONFIG
+
+       use selinux && sed -i "s:HAVE_SELINUX=no:HAVE_SELINUX=yes:" MCONFIG
+
+       sed -i \
+               -e "s:-pipe -O2 \$(CPUOPT) -fomit-frame-pointer:${CFLAGS}:" \
+               -e "s:CPU=.*:CPU=${CHOST%%-*}:" \
+               -e "s:HAVE_KILL=no:HAVE_KILL=yes:" \
+               -e "s:HAVE_SLN=no:HAVE_SLN=yes:" \
+               -e "s:HAVE_TSORT=no:HAVE_TSORT=yes:" \
+               -e "s:usr/man:usr/share/man:" \
+               -e "s:usr/info:usr/share/info:" \
+               -e "s:SUIDMODE=.*4755:SUIDMODE=4711:" \
+               MCONFIG || die "MCONFIG sed"
+
+       if ! use nls ; then
+               sed -i -e 's/DISABLE_NLS=no/DISABLE_NLS=yes/' MCONFIG ||
+                       die "MCONFIG nls sed"
+       fi
+
+       # 2.6 kernels have a broken blkpg.h (if included in userspace ...)
+       if [ -n "`grep __user /usr/include/linux/blkpg.h`" ] ; then
+               mkdir ${S}/partx/linux
+               sed -e 's:__user::g' /usr/include/linux/blkpg.h > \
+                       ${S}/partx/linux/blkpg.h
+       fi
+
+       # Install rdev on amd64 platform
+       epatch ${FILESDIR}/${PN}-2.12-amd64_rdev_installation.patch
+
+       # swapon gets confused by symlinks in /dev #69162
+       epatch ${FILESDIR}/${PN}-swapon-check-symlinks.patch
+
+       use uclibc && sed -e 's/sys_siglist\[sig\]/strsignal(sig)/' -i ${S}/mount/fstab.c
+}
+
+src_compile() {
+       # opt to use non-lazy bindings for suids installed by this package.
+       append-ldflags -Wl,-z,now
+       use static && append-ldflags -static
+       econf || die "configure failed"
+       emake || die "emake failed"
+       if [ ! -x "partx/partx" ] ; then
+               cd ${S}/partx
+               CFLAGS="-I." \
+               make || die "make partx failed"
+       else
+               ewarn "Build system now builds partx!"
+       fi
+       cd ${S}/sys-utils && makeinfo *.texi || die "makeinfo failed"
+}
+
+src_install() {
+       make DESTDIR=${D} install || die "install failed"
+
+       if [ ! -x "${D}/sbin/partx" ] ; then
+               into /
+               dosbin partx/{addpart,delpart,partx}
+       else
+               ewarn "Build system now installs partx!"
+       fi
+
+       dodoc HISTORY MAINTAINER README VERSION
+       docinto licenses
+       dodoc licenses/* HISTORY
+       docinto examples
+       dodoc example.files/*
+}