Merge pull request #310 from marineam/e2fsck

bump(sys-fs/e2fsprogs): sync w/ upstream, add UUID fix.
This commit is contained in:
Michael Marineau 2014-01-20 11:18:08 -08:00
commit 67a8bafebe
10 changed files with 2329 additions and 0 deletions

View File

@ -72,3 +72,7 @@
# Fixes ruby dependency
=sys-block/thin-provisioning-tools-0.2.8-r1 ~amd64
# Assorted bugfixes, avoids corrupting filesystems by updating UUID
=sys-fs/e2fsprogs-1.42.9 ~amd64
=sys-libs/e2fsprogs-libs-1.42.9 ~amd64

View File

@ -0,0 +1 @@
DIST e2fsprogs-1.42.9.tar.gz 6069173 SHA256 2f92ac06e92fa00f2ada3ee67dad012d74d685537527ad1241d82f2d041f2802 SHA512 31041c45bc4e4a37fc4a1026424e15d4fc8fbf990c968fc9fba92861d9bec15f192dee8d5341cc2215af30a86b0bdb12d8a01f3c113b79a66c65f4a737136bb7 WHIRLPOOL 8fd7fb0ac22c41e9169902aba4cf0f3990897619f4709dd43c3a7153b710f6a869a123854fc9154b21b7088896737ae2e5283e56a8e15f8abd27f5f740e579f9

View File

@ -0,0 +1,150 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/e2fsprogs/e2fsprogs-1.42.9.ebuild,v 1.2 2014/01/18 05:15:33 vapier Exp $
EAPI=3
case ${PV} in
*_pre*) UP_PV="${PV%_pre*}-WIP-${PV#*_pre}" ;;
*) UP_PV=${PV} ;;
esac
inherit eutils flag-o-matic multilib toolchain-funcs
DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
HOMEPAGE="http://e2fsprogs.sourceforge.net/"
SRC_URI="mirror://sourceforge/e2fsprogs/${PN}-${UP_PV}.tar.gz"
LICENSE="GPL-2 BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 -x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
IUSE="nls static-libs elibc_FreeBSD"
RDEPEND="~sys-libs/${PN}-libs-${PV}
>=sys-apps/util-linux-2.16
nls? ( virtual/libintl )"
DEPEND="${RDEPEND}
nls? ( sys-devel/gettext )
virtual/pkgconfig
sys-apps/texinfo"
S=${WORKDIR}/${P%_pre*}
pkg_setup() {
if [[ ! -e ${EROOT}/etc/mtab ]] ; then
# add some crap to deal with missing /etc/mtab #217719
ewarn "No /etc/mtab file, creating one temporarily"
echo "${PN} crap for src_test" > "${EROOT}"/etc/mtab
fi
}
src_prepare() {
epatch "${FILESDIR}"/0001-e2fsck-skip-fixing-UUID.patch
epatch "${FILESDIR}"/${PN}-1.41.8-makefile.patch
epatch "${FILESDIR}"/${PN}-1.40-fbsd.patch
epatch "${FILESDIR}"/${PN}-1.41.12-darwin-makefile.patch
if [[ ${CHOST} == *-mint* ]] ; then
epatch "${FILESDIR}"/${PN}-1.41-mint.patch
epatch "${FILESDIR}"/${PN}-1.41.12-mint-blkid.patch
fi
# blargh ... trick e2fsprogs into using e2fsprogs-libs
rm -rf doc
sed -i -r \
-e 's:@LIBINTL@:@LTLIBINTL@:' \
-e '/^LIB(COM_ERR|SS)/s:[$][(]LIB[)]/lib([^@]*)@LIB_EXT@:-l\1:' \
-e '/^DEPLIB(COM_ERR|SS)/s:=.*:=:' \
MCONFIG.in || die "muck libs" #122368
sed -i -r \
-e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
Makefile.in || die "remove subdirs"
# Avoid rebuild
touch lib/ss/ss_err.h
}
src_configure() {
# Keep the package from doing silly things #261411
export VARTEXFONTS=${T}/fonts
# needs open64() prototypes and friends
append-cppflags -D_GNU_SOURCE
# We want to use the "bsd" libraries while building on Darwin, but while
# building on other Gentoo/*BSD we prefer elf-naming scheme.
local libtype
case ${CHOST} in
*-darwin*) libtype=--enable-bsd-shlibs ;;
*-mint*) libtype= ;;
*) libtype=--enable-elf-shlibs ;;
esac
ac_cv_path_LDCONFIG=: \
econf \
--with-root-prefix="${EPREFIX}/" \
--enable-symlink-install \
${libtype} \
$(tc-has-tls || echo --disable-tls) \
--without-included-gettext \
$(use_enable nls) \
--disable-libblkid \
--disable-libuuid \
--disable-quota \
--disable-fsck \
--disable-uuidd
if [[ ${CHOST} != *-uclibc ]] && grep -qs 'USE_INCLUDED_LIBINTL.*yes' config.{log,status} ; then
eerror "INTL sanity check failed, aborting build."
eerror "Please post your ${S}/config.log file as an"
eerror "attachment to http://bugs.gentoo.org/show_bug.cgi?id=81096"
die "Preventing included intl cruft from building"
fi
}
src_compile() {
emake COMPILE_ET=compile_et MK_CMDS=mk_cmds || die
# Build the FreeBSD helper
if use elibc_FreeBSD ; then
cp "${FILESDIR}"/fsck_ext2fs.c .
emake fsck_ext2fs || die
fi
}
pkg_preinst() {
if [[ -r ${EROOT}/etc/mtab ]] ; then
if [[ $(<"${EROOT}"/etc/mtab) == "${PN} crap for src_test" ]] ; then
rm -f "${EROOT}"/etc/mtab
fi
fi
}
src_install() {
# need to set root_libdir= manually as any --libdir options in the
# econf above (i.e. multilib) will screw up the default #276465
emake \
STRIP=: \
root_libdir="${EPREFIX}/usr/$(get_libdir)" \
DESTDIR="${D}" \
install install-libs || die
dodoc README RELEASE-NOTES
insinto /etc
doins "${FILESDIR}"/e2fsck.conf || die
# Move shared libraries to /lib/, install static libraries to
# /usr/lib/, and install linker scripts to /usr/lib/.
gen_usr_ldscript -a e2p ext2fs
# configure doesn't have an option to disable static libs :/
use static-libs || find "${D}" -name '*.a' -delete
if use elibc_FreeBSD ; then
# Install helpers for us
into /
dosbin "${S}"/fsck_ext2fs || die
doman "${FILESDIR}"/fsck_ext2fs.8 || die
# filefrag is linux only
rm \
"${ED}"/usr/sbin/filefrag \
"${ED}"/usr/share/man/man8/filefrag.8 || die
fi
}

View File

@ -0,0 +1,44 @@
From d1dffed0d15c80cfc69f133819d953d0342cf486 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Sat, 18 Jan 2014 20:09:30 -0800
Subject: [PATCH] e2fsck: skip fixing UUID on a mounted filesystem with csums
This fix is similar to 66457fcb for tune2fs. When booting from a root
filesystem with an empty UUID which fsck fixes the following remount
step reliably fails, leaving the filesystem in an inconsistent state.
Like the tune2fs fix this patch resolves the issue by simply refusing to
update the UUID if the filesystem is mounted.
Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
---
This patch is against master but is equally applicable to maint, it
applies to maint with 1 line of fuzz (ext2fs_init_csum_seed).
I've tested it on top of v1.42.9.
It may also be possible to fix this issue with a patch to ext4_remount
in the kernel but I have not investigated that.
e2fsck/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 59c1f97..3c92df2 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -734,8 +734,11 @@ void check_super_block(e2fsck_t ctx)
#ifndef EXT2_SKIP_UUID
/*
* If the UUID field isn't assigned, assign it.
+ * Skip if checksums are enabled and the filesystem is mounted,
+ * if the id changes under the kernel remounting rw may fail.
*/
- if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) {
+ if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid) &&
+ (!csum_flag || !(ctx->mount_flags & EXT2_MF_MOUNTED))) {
if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) {
uuid_generate(sb->s_uuid);
ext2fs_init_csum_seed(fs);
--
1.8.3.2

View File

@ -0,0 +1,6 @@
# See the e2fsck.conf man page for more info
[options]
# allow fsck to run sanely at any point in time #142850
buggy_init_scripts = yes

View File

@ -0,0 +1,11 @@
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -414,7 +414,7 @@
#define i_size_high i_dir_acl
-#if defined(__KERNEL__) || defined(__linux__)
+#if defined(__KERNEL__) || defined(__linux__) || defined(__FreeBSD__)
#define i_reserved1 osd1.linux1.l_i_reserved1
#define i_frag osd2.linux2.l_i_frag
#define i_fsize osd2.linux2.l_i_fsize

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
On Darwin, create dylibs with a versioning scheme like Linux/ELF, not
like BSD/ELF.
This patch uses intentionally ELF_* vars to make it easier to diff
against the ELF Makefile.
http://sourceforge.net/tracker/index.php?func=detail&aid=2555389&group_id=2406&atid=302406
--- lib/Makefile.darwin-lib
+++ lib/Makefile.darwin-lib
@@ -1,14 +1,15 @@
#
-# This is a Makefile stub which handles the creation of Darwin BSD shared
-# libraries.
+# This is a Makefile stub which handles the creation of Darwin shared
+# libraries based on the ELF scheme.
#
# In order to use this stub, the following makefile variables must be defined.
-#
-# BSDLIB_VERSION = 1.0
-# BSDLIB_IMAGE = libce
-# BSDLIB_MYDIR = et
-# BSDLIB_INSTALL_DIR = $(SHLIBDIR)
-#
+#
+# ELF_VERSION = 1.0
+# ELF_SO_VERSION = 1
+# ELF_IMAGE = libce
+# ELF_MYDIR = et
+# ELF_INSTALL_DIR = $(SHLIBDIR)
+# ELF_OTHER_LIBS = -lc
all:: image
@@ -16,36 +17,58 @@
$(E) " MKDIR pic"
$(Q) mkdir -p pic
-BSD_LIB = $(BSDLIB_IMAGE).$(BSDLIB_VERSION).dylib
-BSDLIB_PIC_FLAG = -fPIC
+ELF_LIB = $(ELF_IMAGE).$(ELF_VERSION).dylib
+ELF_SONAME = $(ELF_IMAGE).$(ELF_SO_VERSION).dylib
-image: $(BSD_LIB)
+image: $(ELF_LIB)
-$(BSD_LIB): $(OBJS)
- $(E) " GEN_BSD_SOLIB $(BSD_LIB)"
- $(Q) (cd pic; $(CC) -dynamiclib -compatibility_version 1.0 -current_version $(BSDLIB_VERSION) \
- -flat_namespace -undefined warning -o $(BSD_LIB) $(OBJS))
- $(Q) $(MV) pic/$(BSD_LIB) .
- $(Q) $(RM) -f ../$(BSD_LIB)
+$(ELF_LIB): $(OBJS)
+ $(E) " GEN_ELF_SOLIB $(ELF_LIB)"
+ $(Q) (cd pic; $(CC) -dynamiclib -o $(ELF_LIB) $(LDFLAGS) \
+ -Wl,-install_name,$(libdir)/$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS))
+ $(Q) $(MV) pic/$(ELF_LIB) .
+ $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).dylib ../$(ELF_SONAME)
$(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \
- `echo $(my_dir) | sed -e 's;lib/;;'`/$(BSD_LIB) $(BSD_LIB))
- $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(BSD_LIB) $(BSDLIB_IMAGE).dylib)
-
-install-shlibs install:: $(BSD_LIB)
- $(E) " INSTALL_PROGRAM $(BSDLIB_INSTALL_DIR)/$(BSD_LIB)"
- $(Q) $(INSTALL_PROGRAM) $(BSD_LIB) \
- $(DESTDIR)$(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
- -$(Q) $(LDCONFIG)
+ `echo $(my_dir) | sed -e 's;lib/;;'`/$(ELF_LIB) $(ELF_LIB))
+ $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(ELF_LIB) $(ELF_IMAGE).dylib)
+ $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(ELF_LIB) $(ELF_SONAME))
+
+installdirs-elf-lib::
+ $(E) " MKINSTALLDIRS $(ELF_INSTALL_DIR) $(libdir)"
+ $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(ELF_INSTALL_DIR) \
+ $(DESTDIR)$(libdir)
+
+installdirs:: installdirs-elf-lib
+
+install-shlibs install:: $(ELF_LIB) installdirs-elf-lib
+ $(E) " INSTALL-ELF-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+ $(Q) $(INSTALL_PROGRAM) $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
+ $(E) " SYMLINK $(ELF_INSTALL_DIR)/$(ELF_SONAME)"
+ $(Q) $(LN_S) -f $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME)
+ $(E) " SYMLINK $(libdir)/$(ELF_IMAGE).dylib"
+ $(Q) if test "$(ELF_INSTALL_DIR)" = "$(libdir)"; then \
+ $(LN_S) -f $(ELF_SONAME) $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib ; \
+ else \
+ $(LN_S) -f $(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+ $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib; \
+ fi
install-strip: install
+ $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+ $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \
+ --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
install-shlibs-strip: install-shlibs
+ $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+ $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \
+ --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
uninstall-shlibs uninstall::
- $(RM) -f $(DESTDIR)$(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
+ $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \
+ $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+ $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib
clean::
$(RM) -rf pic
- $(RM) -f $(BSD_LIB)
- $(RM) -f ../$(BSD_LIB)
- $(RM) -f ../$(BSDLIB_IMAGE).dylib
+ $(RM) -f $(ELF_LIB)
+ $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).dylib ../$(ELF_SONAME)

View File

@ -0,0 +1,43 @@
http://bugs.gentoo.org/276055
<alanh@fairlite.co.uk>:
The configure test program links against libblkid to test. This works
fine on shared library systems as libblkid automatically depends on
libuuid. But on static systems it needs explicit linking.
--- configure.in
+++ configure.in
@@ -398,8 +398,8 @@
fi
AC_CHECK_LIB(blkid, blkid_get_cache,
- [LIBBLKID=`$PKG_CONFIG --libs blkid`;
- STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
+ [LIBBLKID=`$PKG_CONFIG --libs blkid --libs uuid`;
+ STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid --libs uuid`],
[AC_MSG_ERROR([external blkid library not found])],
[$LIBBLKID])
BLKID_CMT=#
--- configure.old 2011-01-01 14:20:07.000000000 +0000
+++ configure 2011-01-01 14:22:01.000000000 +0000
@@ -5228,7 +5228,7 @@
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lblkid $LIBBLKID $LIBS"
+LIBS="-lblkid -luuid $LIBBLKID $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -5259,8 +5259,8 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blkid_blkid_get_cache" >&5
$as_echo "$ac_cv_lib_blkid_blkid_get_cache" >&6; }
if test "x$ac_cv_lib_blkid_blkid_get_cache" = x""yes; then :
- LIBBLKID=`$PKG_CONFIG --libs blkid`;
- STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`
+ LIBBLKID=`$PKG_CONFIG --libs blkid --libs uuid`;
+ STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid --libs uuid`
else
as_fn_error "external blkid library not found" "$LINENO" 5
fi

View File

@ -0,0 +1,10 @@
--- e2fsprogs-1.41.5/Makefile.in
+++ e2fsprogs-1.41.5/Makefile.in
@@ -281,6 +66,7 @@
uninstall: uninstall-progs-recursive uninstall-shlibs-libs-recursive uninstall-doc-libs
install-libs: install-libs-recursive
+install-libs-recursive: | install-shlibs-libs-recursive
uninstall-libs: uninstall-libs-recursive