diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bc9cc9f5..9cf84424 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,35 @@ +E2fsprogs 1.41.9-WIP (July 20, 2009) commit 8b5ed492de +==================================== + +Fix regression in ext2fs_extent_set_bmap() caused e2fsck -fD to fail +and corrupt large directories if the directory needs to shrink by more +than one block. (Addresses Debian Bug: #537510) + +Fix e2fsck's buggy_init_scritps=1 so that the if the last write and/or +last mount times are in the future, they are corrected even if +buggy_init_scripts is set. This is needed because otherwise resize2fs +will refuse to resize the filesystem, even after running "e2fsck -f". +(Addresses Launchpad bug: #373409) + +Fixed filefrag for non-extent based files. + +Fixed various Debian packaging issues --- see debian/changelog for +details. + +Programmer's Notes +------------------ + +Fixed miscellaneous gcc -Wall warnings. + +Fixed memory leak in error path in ext2fs_block_iterate2() + +Fixed non-Linux build of the intl directory by adding support for the +E/Q/V macros. + +Improve ext2fs_extent_set_bmap() to avoid creating new extents which +get inserted into the extent tree when they are not needed. + + E2fsprogs 1.41.8 (July 11, 2009) ================================ diff --git a/configure b/configure index 769dc099..f2729e51 100755 --- a/configure +++ b/configure @@ -16592,7 +16592,8 @@ for i in MCONFIG Makefile e2fsprogs.spec \ lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \ misc/Makefile ext2ed/Makefile e2fsck/Makefile \ debugfs/Makefile tests/Makefile tests/progs/Makefile \ - resize/Makefile doc/Makefile intl/Makefile po/Makefile.in ; do + resize/Makefile doc/Makefile intl/Makefile \ + intl/libgnuintl.h po/Makefile.in ; do if test -d `dirname ${srcdir}/$i` ; then outlist="$outlist $i" fi diff --git a/configure.in b/configure.in index d11faecd..acbcec62 100644 --- a/configure.in +++ b/configure.in @@ -1062,7 +1062,8 @@ for i in MCONFIG Makefile e2fsprogs.spec \ lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \ misc/Makefile ext2ed/Makefile e2fsck/Makefile \ debugfs/Makefile tests/Makefile tests/progs/Makefile \ - resize/Makefile doc/Makefile intl/Makefile po/Makefile.in ; do + resize/Makefile doc/Makefile intl/Makefile \ + intl/libgnuintl.h po/Makefile.in ; do if test -d `dirname ${srcdir}/$i` ; then outlist="$outlist $i" fi diff --git a/debian/changelog b/debian/changelog index 556cd1ef..12edfebe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +e2fsprogs (1.41.8-2) unstable; urgency=low + + * Fix regression in ext2fs_extent_set_bmap() which caused e2fsck -fD + to fail on ext4 filesystems if the directory needs to shrink by more + than a block (Closes: #537510) + * Fixed filefrag for non-extent based files + * Fix use of apostrohe's in package descriptions + * Don't use dietlibc when building for mips and mipsel architectures + + -- Theodore Y. Ts'o Mon, 20 Jul 2009 09:38:21 -0400 + e2fsprogs (1.41.8-1) unstable; urgency=low * New upstream release diff --git a/debian/control b/debian/control.in similarity index 93% rename from debian/control rename to debian/control.in index dc8df21a..f0f364f6 100644 --- a/debian/control +++ b/debian/control.in @@ -2,7 +2,11 @@ Source: e2fsprogs Section: admin Priority: required Maintainer: Theodore Y. Ts'o -Build-Depends: texi2html (>= 1.76), gettext, texinfo, dc, pkg-config, dietlibc-dev (>> 0.30) [alpha amd64 arm hppa i386 ia64 powerpc ppc64 s390 sparc], debhelper (>= 7.0) +ifdef(`UTIL_LINUX_NG', +``Build-Depends: texi2html (>= 1.76), gettext, texinfo, dc, pkg-config, dietlibc-dev (>> 0.30) [alpha amd64 arm hppa i386 ia64 powerpc ppc64 s390 sparc], debhelper (>= 7.0), m4, libblkid-dev (>= 2.16), uuid-dev (>= 2.16) +'', +``Build-Depends: texi2html (>= 1.76), gettext, texinfo, dc, pkg-config, dietlibc-dev (>> 0.30) [alpha amd64 arm hppa i386 ia64 powerpc ppc64 s390 sparc], debhelper (>= 7.0), m4 +'')dnl Standards-Version: 3.8.2 Homepage: http://e2fsprogs.sourceforge.net @@ -70,7 +74,7 @@ Description: command-line interface parsing library - headers and static librari It was originally inspired by the Multics SubSystem library. . This package contains the development environment for the ss library. - +ifdef(`UTIL_LINUX_NG',,`` Package: libuuid1 Section: libs Depends: passwd, ${shlibs:Depends} @@ -79,7 +83,7 @@ Replaces: e2fsprogs (<< 1.34-1) Architecture: any Description: Universally Unique ID library The libuuid library generates and parses 128-bit universally unique - id's (UUID's). A UUID is an identifier that is unique across both + ids (UUIDs). A UUID is an identifier that is unique across both space and time, with respect to the space of all UUIDs. A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects @@ -95,7 +99,7 @@ Replaces: e2fsprogs (<= 1.40.3-1ubuntu1) Architecture: any Description: runtime components for the Universally Unique ID library The libuuid library generates and parses 128-bit universally unique - id's (UUID's). A UUID is an identifier that is unique across both + ids (UUIDs). A UUID is an identifier that is unique across both space and time, with respect to the space of all UUIDs. A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects @@ -118,7 +122,7 @@ Priority: optional Depends: ${shlibs:Depends} Architecture: any Description: stripped down universally unique id library, for debian-installer - libuuid generates and parses 128-bit universally unique id's (UUID's). + libuuid generates and parses 128-bit universally unique ids (UUIDs). See RFC 4122 for more information. . This is a minimal package for debian-installer. @@ -130,7 +134,7 @@ Depends: libc6-dev | libc-dev, libuuid1 (= ${mainBinary}) Replaces: e2fslibs-dev (<< 1.15) Architecture: any Description: universally unique id library - headers and static libraries - libuuid generates and parses 128-bit universally unique id's (UUID's). + libuuid generates and parses 128-bit universally unique ids (UUIDs). See RFC 4122 for more information. . This package contains the development environment for the uuid library. @@ -174,6 +178,7 @@ Description: block device id library - headers and static libraries system instead. . This package contains the development environment for the blkid library. +'')dnl Package: e2fsprogs-udeb XC-Package-Type: udeb @@ -245,7 +250,7 @@ Description: debugging information for e2fsprogs and its libraries, contained in the e2fsprogs and e2fsck-static packages. The debug information is used for execution tracing and core dump analysis. - +ifdef(`UTIL_LINUX_NG',,`` Package: uuid-runtime-dbg Section: debug Priority: extra @@ -256,6 +261,7 @@ Description: debugging information for uuid-runtime uuid runtime programs, contained in the uuid-runtime package. The debugging information is used for execution tracing and core dump analysis. +'')dnl Package: e2fslibs-dbg Section: debug @@ -286,7 +292,7 @@ Description: debugging information for libss2 This package includes the debug information useful for debugging the ss library, contained in the libss2 package. The debug information is used for execution tracing and core dump analysis. - +ifdef(`UTIL_LINUX_NG',,`` Package: libblkid1-dbg Section: debug Priority: extra @@ -306,3 +312,4 @@ Description: debugging information for libuuid1 This package includes the debug information useful for debugging the UUID library, contained in the libuuid1 package. The debug information is used for execution tracing and core dump analysis. +'')dnl diff --git a/debian/rules b/debian/rules index 9520b024..1ba79ff2 100755 --- a/debian/rules +++ b/debian/rules @@ -10,6 +10,13 @@ # be paranoid export LC_ALL=C +# Allow distro-specific behaviour +DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release || echo Debian) +SYS_BLKID_VER :=$(shell dpkg-query -W -f '${version}\n' libblkid1 | cut -b 1) +ifeq ($(SYS_BLKID_VER),2) +UTIL_LINUX_NG ?= yes +endif + # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) @@ -26,10 +33,15 @@ COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3) SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3) + +ifneq ($(UTIL_LINUX_NG),yes) UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) + BLKID_VERSION = $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3) BLKID_SOVERSION = $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3) +endif + EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3) E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3) @@ -39,14 +51,17 @@ topdir=$(shell pwd) debdir=${topdir}/debian tmpdir=${debdir}/tmp udebdir=${debdir}/e2fsprogs-udeb +ifneq ($(UTIL_LINUX_NG),yes) blkidudebdir=${debdir}/libblkid1-udeb uuidudebdir=${debdir}/libuuid1-udeb +endif libcomerrdir=${debdir}/libcomerr${COMERR_SOVERSION} comerrdevdir=${debdir}/comerr-dev libcomerrdbgdir=${debdir}/libcomerr2-dbg libssdir=${debdir}/libss${SS_SOVERSION} ssdevdir=${debdir}/ss-dev libssdbgdir=${debdir}/libss2-dbg +ifneq ($(UTIL_LINUX_NG),yes) libblkiddir=${debdir}/libblkid${BLKID_SOVERSION} libblkiddevdir=${debdir}/libblkid-dev libblkiddbgdir=${debdir}/libblkid1-dbg @@ -55,6 +70,7 @@ uuiddevdir=${debdir}/uuid-dev libuuiddbgdir=${debdir}/libuuid1-dbg uuidruntimedir=${debdir}/uuid-runtime uuidruntimedbgdir=${debdir}/uuid-runtime-dbg +endif libext2dir=${debdir}/e2fslibs libext2devdir=${debdir}/e2fslibs-dev libext2dbgdir=${debdir}/e2fslibs-dbg @@ -71,13 +87,15 @@ MANDIR=/usr/share/man mandir=${tmpdir}${MANDIR} UDEB_NAME = $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb -UDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2) +UDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2) +ifneq ($(UTIL_LINUX_NG),yes) BLKID_UDEB_NAME = libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb -BLKID_UDEB_PRIORITY = $(shell grep '^Package: libblkid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2) +BLKID_UDEB_PRIORITY = $(shell grep '^Package: libblkid1-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2) UUID_UDEB_NAME = libuuid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb -UUID_UDEB_PRIORITY = $(shell grep '^Package: libuuid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2) +UUID_UDEB_PRIORITY = $(shell grep '^Package: libuuid1-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2) +endif STAMPSDIR=debian/stampdir CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp @@ -115,7 +133,13 @@ endif BF_CCOPTS = -Os -fomit-frame-pointer COMMON_CONF_FLAGS = \ - --enable-elf-shlibs --infodir=/usr/share/info --enable-fsck + --enable-elf-shlibs --infodir=/usr/share/info +ifeq ($(UTIL_LINUX_NG),yes) +COMMON_CONF_FLAGS += --disable-fsck --disable-libblkid \ + --disable-libuuid --disable-uuidd +else +COMMON_CONF_FLAGS += --enable-fsck +endif STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression @@ -145,6 +169,16 @@ ismips=ismips endif endif +M4_ARGS= +ifeq ($(UTIL_LINUX_NG),yes) +M4_ARGS+=-DUTIL_LINUX_NG +else +M4_ARGS+=-UUTIL_LINUX_NG +endif + +debian/control: debian/control.in debian/rules + m4 $(M4_ARGS) < debian/control.in > $@ + ${CFGSTDSTAMP}: dh_testdir @@ -325,11 +359,13 @@ install-udeb: build ln -s e2fsck fsck.ext3 ; ln -s mke2fs mkfs.ext2 ; \ ln -s mke2fs mkfs.ext3 ; ln -s mke2fs mkfs.ext4) +ifneq ($(UTIL_LINUX_NG),yes) mkdir -p ${blkidudebdir}/lib mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib mkdir -p ${uuidudebdir}/lib mv ${udebdir}/lib/libuuid.* ${uuidudebdir}/lib +endif binary-indep: # no arch-independant debs. @@ -358,9 +394,11 @@ binary-arch: install install-udeb # symlinks to prepare dh_installdocs run +ifneq ($(UTIL_LINUX_NG),yes) mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION} mkdir -p ${debdir}/libblkid-dev/usr/share/doc ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev +endif mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION} mkdir -p ${debdir}/ss-dev/usr/share/doc @@ -370,16 +408,20 @@ binary-arch: install install-udeb mkdir -p ${debdir}/comerr-dev/usr/share/doc ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev +ifneq ($(UTIL_LINUX_NG),yes) mkdir -p ${debdir}/libuuid${UUID_SOVERSION}/usr/share/doc/libuuid${UUID_SOVERSION} mkdir -p ${debdir}/uuid-dev/usr/share/doc # ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev +endif mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev +ifneq ($(UTIL_LINUX_NG),yes) $(INSTALL) -p -m 0644 debian/libblkid.copyright \ ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright +endif dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb @@ -416,11 +458,15 @@ binary-arch: install install-udeb dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info DH_OPTIONS= dh_installchangelogs -pe2fsprogs \ - -plibblkid${BLKID_SOVERSION} -plibcomerr${COMERR_SOVERSION} \ - -plibss${SS_SOVERSION} -plibuuid${UUID_SOVERSION} \ - -pe2fslibs -puuid-dev -puuid-runtime -pe2fsck-static \ - -pe2fsprogs-dbg -puuid-runtime-dbg -pe2fslibs-dbg \ - -plibcomerr2-dbg -plibss2-dbg -plibblkid1-dbg -plibuuid1-dbg + -plibcomerr${COMERR_SOVERSION} \ + -plibss${SS_SOVERSION} \ + -pe2fslibs -pe2fsck-static \ + -pe2fsprogs-dbg -pe2fslibs-dbg \ + -plibcomerr2-dbg -plibss2-dbg +ifneq ($(UTIL_LINUX_NG),yes) + DH_OPTIONS= dh_installchangelogs -plibuuid${UUID_SOVERSION} \ + -puuid-dev -puuid-runtime -puuid-runtime-dbg -plibuuid1-dbg +endif dh_fixperms ifneq ($(ismips),) @@ -431,8 +477,10 @@ endif # debug package stuff rm -rf ${udebdir}/usr +ifneq ($(UTIL_LINUX_NG),yes) rm -rf ${blkidudebdir}/usr rm -rf ${uuidudebdir}/usr +endif mkdir -p ${debugdir}/usr/lib mv ${maindir}/usr/lib/debug ${debugdir}/usr/lib @@ -441,9 +489,11 @@ endif ${debugdir}/usr/lib/debug rm -rf ${e2fsckstaticdir}/usr/lib +ifneq ($(UTIL_LINUX_NG),yes) mkdir -p ${uuidruntimedbgdir}/usr/lib mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/usr/lib rmdir ${uuidruntimedir}/usr/lib +endif mkdir -p ${libext2dbgdir}/usr/lib mv ${libext2dir}/usr/lib/debug ${libext2dbgdir}/usr/lib @@ -457,6 +507,7 @@ endif mv ${libssdir}/usr/lib/debug ${libssdbgdir}/usr/lib rmdir ${libssdir}/usr/lib +ifneq ($(UTIL_LINUX_NG),yes) mkdir -p ${libuuiddbgdir}/usr/lib mv ${libuuiddir}/usr/lib/debug ${libuuiddbgdir}/usr/lib rmdir ${libuuiddir}/usr/lib @@ -464,10 +515,15 @@ endif mkdir -p ${libblkiddbgdir}/usr/lib mv ${libblkiddir}/usr/lib/debug ${libblkiddbgdir}/usr/lib rmdir ${libblkiddir}/usr/lib +endif # dpkg symbol handling ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS))) - for i in e2fslibs libcomerr2 libss2 libblkid1 libuuid1; \ +SYMBOL_LIBS := e2fslibs libcomerr2 libss2 +ifneq ($(UTIL_LINUX_NG),yes) +SYMBOL_LIBS += libblkid1 libuuid1 +endif + for i in $(SYMBOL_LIBS); \ do \ echo "Generating symbols for $$i..."; \ dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \ @@ -480,8 +536,10 @@ endif $(INSTALL) -p -m 0644 debian/e2fsprogs.copyright \ ${debugdir}/usr/share/doc/e2fsprogs-dbg/copyright +ifneq ($(UTIL_LINUX_NG),yes) $(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \ ${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright +endif $(INSTALL) -p -m 0644 debian/e2fslibs.copyright \ ${libext2dbgdir}/usr/share/doc/e2fslibs-dbg/copyright @@ -492,21 +550,25 @@ endif $(INSTALL) -p -m 0644 debian/libss2.copyright \ ${libssdbgdir}/usr/share/doc/libss2-dbg/copyright +ifneq ($(UTIL_LINUX_NG),yes) $(INSTALL) -p -m 0644 debian/libblkid.copyright \ ${libblkiddbgdir}/usr/share/doc/libblkid1-dbg/copyright $(INSTALL) -p -m 0644 debian/libuuid1.copyright \ ${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright +endif dh_compress dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb dh_makeshlibs -plibcomerr${COMERR_SOVERSION} \ -V 'libcomerr2 (>= 1.33-3)' +ifneq ($(UTIL_LINUX_NG),yes) dh_makeshlibs -plibblkid${BLKID_SOVERSION} -V 'libblkid1 (>= 1.39-1)' echo "udeb: libblkid 1 libblkid1-udeb" >> \ debian/libblkid1/DEBIAN/shlibs echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs +endif dh_installdeb dh_shlibdeps -l${stdbuilddir}/lib @@ -521,20 +583,28 @@ endif -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' DH_OPTIONS= dh_gencontrol -pss-dev \ -u '-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' +ifneq ($(UTIL_LINUX_NG),yes) DH_OPTIONS= dh_gencontrol -puuid-dev \ -u '-v${UUID_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' +endif dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~ +ifneq ($(UTIL_LINUX_NG),yes) dh_gencontrol -plibblkid1-udeb -- -fdebian/files~ dh_gencontrol -plibuuid1-udeb -- -fdebian/files~ +endif dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY) +ifneq ($(UTIL_LINUX_NG),yes) dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY) dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY) +endif dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME) +ifneq ($(UTIL_LINUX_NG),yes) dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME) dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME) +endif binary: binary-indep binary-arch diff --git a/e2fsck/problem.c b/e2fsck/problem.c index 43a0aa64..d6b345cf 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -335,12 +335,12 @@ static struct e2fsck_problem problem_table[] = { /* Last mount time is in the future */ { PR_0_FUTURE_SB_LAST_MOUNT, N_("@S last mount time is in the future. "), - PROMPT_FIX, PR_PREEN_OK | PR_NO_OK }, + PROMPT_FIX, PR_NO_OK }, /* Last write time is in the future */ { PR_0_FUTURE_SB_LAST_WRITE, N_("@S last write time is in the future. "), - PROMPT_FIX, PR_PREEN_OK | PR_NO_OK }, + PROMPT_FIX, PR_NO_OK }, { PR_0_EXTERNAL_JOURNAL_HINT, N_("@S hint for external superblock @s %X. "), @@ -385,6 +385,18 @@ static struct e2fsck_problem problem_table[] = { N_("The test_fs flag is set (and ext4 is available). "), PROMPT_CLEAR, PR_PREEN_OK }, + /* Last mount time is in the future (fudged) */ + { PR_0_FUTURE_SB_LAST_MOUNT_FUDGED, + N_("@S last mount time is in the future.\n\t(by less than a day, " + "probably due to buggy init scripts) "), + PROMPT_FIX, PR_PREEN_OK | PR_NO_OK }, + + /* Last write time is in the future (fudged) */ + { PR_0_FUTURE_SB_LAST_WRITE_FUDGED, + N_("@S last write time is in the future.\n\t(by less than a day, " + "probably due to buggy init scripts). "), + PROMPT_FIX, PR_PREEN_OK | PR_NO_OK }, + /* Pass 1 errors */ /* Pass 1: Checking inodes, blocks, and sizes */ diff --git a/e2fsck/problem.h b/e2fsck/problem.h index 1d2c2334..69dcfba7 100644 --- a/e2fsck/problem.h +++ b/e2fsck/problem.h @@ -217,6 +217,13 @@ struct problem_context { /* The test_fs filesystem flag is set and ext4 is available */ #define PR_0_CLEAR_TESTFS_FLAG 0x00003B +/* Last mount time is in the future (fudged) */ +#define PR_0_FUTURE_SB_LAST_MOUNT_FUDGED 0x00003C + +/* Last write time is in the future (fudged) */ +#define PR_0_FUTURE_SB_LAST_WRITE_FUDGED 0x00003D + + /* * Pass 1 errors */ diff --git a/e2fsck/super.c b/e2fsck/super.c index 344777d4..ef29aa52 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -457,6 +457,7 @@ void check_super_block(e2fsck_t ctx) blk_t first_block, last_block; struct ext2_super_block *sb = fs->super; struct ext2_group_desc *gd; + problem_t problem; blk_t blocks_per_group = fs->super->s_blocks_per_group; blk_t bpg_max; int inodes_per_block; @@ -818,16 +819,22 @@ void check_super_block(e2fsck_t ctx) * Check to see if the superblock last mount time or last * write time is in the future. */ - if (fs->super->s_mtime > (__u32) ctx->now + ctx->time_fudge) { + if (fs->super->s_mtime > (__u32) ctx->now) { pctx.num = fs->super->s_mtime; - if (fix_problem(ctx, PR_0_FUTURE_SB_LAST_MOUNT, &pctx)) { + problem = PR_0_FUTURE_SB_LAST_MOUNT; + if (fs->super->s_mtime <= (__u32) ctx->now + ctx->time_fudge) + problem = PR_0_FUTURE_SB_LAST_MOUNT_FUDGED; + if (fix_problem(ctx, problem, &pctx)) { fs->super->s_mtime = ctx->now; ext2fs_mark_super_dirty(fs); } } - if (fs->super->s_wtime > (__u32) ctx->now + ctx->time_fudge) { + if (fs->super->s_wtime > (__u32) ctx->now) { pctx.num = fs->super->s_wtime; - if (fix_problem(ctx, PR_0_FUTURE_SB_LAST_WRITE, &pctx)) { + problem = PR_0_FUTURE_SB_LAST_MOUNT; + if (fs->super->s_wtime <= (__u32) ctx->now + ctx->time_fudge) + problem = PR_0_FUTURE_SB_LAST_MOUNT_FUDGED; + if (fix_problem(ctx, problem, &pctx)) { fs->super->s_wtime = ctx->now; ext2fs_mark_super_dirty(fs); } diff --git a/intl/Makefile.in b/intl/Makefile.in index 36592c1b..47f6f629 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -43,6 +43,22 @@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = @MKINSTALLDIRS@ mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) +@SET_MAKE@ + +@ifGNUmake@ V = +@ifGNUmake@ ifeq ($(strip $(V)),) +@ifGNUmake@ # E = @echo +@ifGNUmake@ # Q = @ +@ifGNUmake@ E = @E@ +@ifGNUmake@ Q = @Q@ +@ifGNUmake@ else +@ifGNUmake@ E = @\# +@ifGNUmake@ Q = +@ifGNUmake@ endif + +@ifNotGNUmake@ E = @E@ +@ifNotGNUmake@ Q = @Q@ + l = @INTL_LIBTOOL_SUFFIX_PREFIX@ AR = ar diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c index de5342df..490116d5 100644 --- a/lib/ext2fs/block.c +++ b/lib/ext2fs/block.c @@ -488,8 +488,10 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, abort_exit: if (ret & BLOCK_CHANGED) { retval = ext2fs_write_inode(fs, ino, &inode); - if (retval) - return retval; + if (retval) { + ret |= BLOCK_ERROR; + ctx.errcode = retval; + } } errout: if (!block_buf) diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index 7fcc2cf9..1505447d 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -104,7 +104,7 @@ static void dbg_print_extent(char *desc, struct ext2fs_extent *extent) { if (desc) printf("%s: ", desc); - printf("extent: lblk %llu--%llu, len %lu, pblk %llu, flags: ", + printf("extent: lblk %llu--%llu, len %u, pblk %llu, flags: ", extent->e_lblk, extent->e_lblk + extent->e_len - 1, extent->e_len, extent->e_pblk); if (extent->e_flags & EXT2_EXTENT_FLAGS_LEAF) @@ -321,7 +321,7 @@ retry: return EXT2_ET_EXTENT_NO_NEXT; } if (op != EXT2_EXTENT_NEXT_SIB) { -#ifdef DEBUG +#ifdef DEBUG_GET_EXTENT printf("<<<< OP = %s\n", (op == EXT2_EXTENT_DOWN) ? "down" : ((op == EXT2_EXTENT_UP) ? "up" : "unknown")); @@ -352,7 +352,7 @@ retry: return EXT2_ET_EXTENT_NO_PREV; } if (op != EXT2_EXTENT_PREV_SIB) { -#ifdef DEBUG +#ifdef DEBUG_GET_EXTENT printf("<<<< OP = %s\n", (op == EXT2_EXTENT_DOWN_AND_LAST) ? "down/last" : ((op == EXT2_EXTENT_UP) ? "up" : "unknown")); @@ -366,7 +366,7 @@ retry: op = EXT2_EXTENT_DOWN; else op = EXT2_EXTENT_LAST_SIB; -#ifdef DEBUG +#ifdef DEBUG_GET_EXTENT printf("<<<< OP = %s\n", (op == EXT2_EXTENT_DOWN) ? "down" : "last_sib"); #endif @@ -481,7 +481,7 @@ retry: if (handle->level < handle->max_depth) path->visit_num = 1; } -#ifdef DEBUG +#ifdef DEBUG_GET_EXTENT printf("Down to level %d/%d, end_blk=%llu\n", handle->level, handle->max_depth, path->end_blk); @@ -495,7 +495,7 @@ retry: return EXT2_ET_NO_CURRENT_NODE; extent->e_flags = 0; -#ifdef DEBUG +#ifdef DEBUG_GET_EXTENT printf("(Left %d)\n", path->left); #endif @@ -628,7 +628,14 @@ static errcode_t extent_goto(ext2_extent_handle_t handle, return EXT2_ET_OP_NOT_SUPPORTED; } +#ifdef DEBUG + printf("goto extent ino %u, level %d, %llu\n", handle->ino, + leaf_level, blk); +#endif + +#ifdef DEBUG_GOTO_EXTENTS dbg_print_extent("root", &extent); +#endif while (1) { if (handle->max_depth - handle->level == leaf_level) { /* block is in this &extent */ @@ -658,7 +665,9 @@ static errcode_t extent_goto(ext2_extent_handle_t handle, if (retval) return retval; +#ifdef DEBUG_GOTO_EXTENTS dbg_print_extent("next", &extent); +#endif if (blk == extent.e_lblk) goto go_down; if (blk > extent.e_lblk) @@ -669,7 +678,9 @@ static errcode_t extent_goto(ext2_extent_handle_t handle, if (retval) return retval; +#ifdef DEBUG_GOTO_EXTENTS dbg_print_extent("prev", &extent); +#endif go_down: retval = ext2fs_extent_get(handle, EXT2_EXTENT_DOWN, @@ -677,7 +688,9 @@ static errcode_t extent_goto(ext2_extent_handle_t handle, if (retval) return retval; +#ifdef DEBUG_GOTO_EXTENTS dbg_print_extent("down", &extent); +#endif } } @@ -765,6 +778,11 @@ errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, if (!path->curr) return EXT2_ET_NO_CURRENT_NODE; +#ifdef DEBUG + printf("extent replace: %u ", handle->ino); + dbg_print_extent(0, extent); +#endif + if (handle->level == handle->max_depth) { ex = path->curr; @@ -922,7 +940,8 @@ static errcode_t extent_node_split(ext2_extent_handle_t handle) goto done; #ifdef DEBUG - printf("will copy to new node at block %lu\n", new_node_pblk); + printf("will copy to new node at block %lu\n", + (unsigned long) new_node_pblk); #endif /* Copy data into new block buffer */ @@ -1040,6 +1059,11 @@ errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags, if (!handle->path) return EXT2_ET_NO_CURRENT_NODE; +#ifdef DEBUG + printf("extent insert: %u ", handle->ino); + dbg_print_extent(0, extent); +#endif + path = handle->path + handle->level; if (path->entries >= path->max_entries) { @@ -1122,16 +1146,24 @@ errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, int mapped = 1; /* logical is mapped? */ int orig_height; int extent_uninit = 0; + int prev_uninit = 0; + int next_uninit = 0; int new_uninit = 0; int max_len = EXT_INIT_MAX_LEN; + int has_prev, has_next; blk64_t orig_lblk; struct extent_path *path; - struct ext2fs_extent extent; + struct ext2fs_extent extent, next_extent, prev_extent; struct ext2fs_extent newextent; struct ext2_extent_info info; EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EXTENT_HANDLE); +#ifdef DEBUG + printf("set_bmap ino %u log %lld phys %lld flags %d\n", + handle->ino, logical, physical, flags); +#endif + if (!(handle->fs->flags & EXT2_FLAG_RW)) return EXT2_ET_RO_FILSYS; @@ -1193,12 +1225,44 @@ errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, /* * This may be the extent *before* the requested logical, * if it's currently unmapped. + * + * Get the previous and next leaf extents, if they are present. */ retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent); if (retval) goto done; if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) extent_uninit = 1; + retval = ext2fs_extent_get(handle, EXT2_EXTENT_NEXT_LEAF, &next_extent); + if (retval) { + has_next = 0; + if (retval != EXT2_ET_EXTENT_NO_NEXT) + goto done; + } else { + dbg_print_extent("set_bmap: next_extent", + &next_extent); + has_next = 1; + if (next_extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) + next_uninit = 1; + } + retval = ext2fs_extent_goto(handle, logical); + if (retval && retval != EXT2_ET_EXTENT_NOT_FOUND) + goto done; + retval = ext2fs_extent_get(handle, EXT2_EXTENT_PREV_LEAF, &prev_extent); + if (retval) { + has_prev = 0; + if (retval != EXT2_ET_EXTENT_NO_PREV) + goto done; + } else { + has_prev = 1; + dbg_print_extent("set_bmap: prev_extent", + &prev_extent); + if (prev_extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) + prev_uninit = 1; + } + retval = ext2fs_extent_goto(handle, logical); + if (retval && retval != EXT2_ET_EXTENT_NOT_FOUND) + goto done; /* check if already pointing to the requested physical */ if (mapped && (new_uninit == extent_uninit) && @@ -1219,6 +1283,28 @@ errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, ((int) extent.e_len < max_len-1)) { extent.e_len++; retval = ext2fs_extent_replace(handle, 0, &extent); + } else if ((logical == extent.e_lblk - 1) && + (physical == extent.e_pblk - 1) && + (new_uninit == extent_uninit) && + ((int) extent.e_len < max_len - 1)) { + extent.e_len++; + extent.e_lblk--; + extent.e_pblk--; + retval = ext2fs_extent_replace(handle, 0, &extent); + } else if (has_next && + (logical == next_extent.e_lblk - 1) && + (physical == next_extent.e_pblk - 1) && + (new_uninit == next_uninit) && + ((int) next_extent.e_len < max_len - 1)) { + retval = ext2fs_extent_get(handle, + EXT2_EXTENT_NEXT_LEAF, + &next_extent); + if (retval) + goto done; + next_extent.e_len++; + next_extent.e_lblk--; + next_extent.e_pblk--; + retval = ext2fs_extent_replace(handle, 0, &next_extent); } else if (logical < extent.e_lblk) retval = ext2fs_extent_insert(handle, 0, &newextent); else @@ -1250,14 +1336,32 @@ errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, #ifdef DEBUG printf("(re/un)mapping last block in extent\n"); #endif - /* Make sure insert works before replacing old extent */ if (physical) { - retval = ext2fs_extent_insert(handle, - EXT2_EXTENT_INSERT_AFTER, &newextent); + if (has_next && + (logical == (next_extent.e_lblk - 1)) && + (physical == (next_extent.e_pblk - 1)) && + (new_uninit == next_uninit) && + ((int) next_extent.e_len < max_len - 1)) { + retval = ext2fs_extent_get(handle, + EXT2_EXTENT_NEXT_LEAF, &next_extent); + if (retval) + goto done; + next_extent.e_len++; + next_extent.e_lblk--; + next_extent.e_pblk--; + retval = ext2fs_extent_replace(handle, 0, + &next_extent); + if (retval) + goto done; + } else + retval = ext2fs_extent_insert(handle, + EXT2_EXTENT_INSERT_AFTER, &newextent); if (retval) goto done; /* Now pointing at inserted extent; move back to prev */ - retval = ext2fs_extent_goto(handle, logical - 1); + retval = ext2fs_extent_get(handle, + EXT2_EXTENT_PREV_LEAF, + &extent); if (retval) goto done; } @@ -1270,37 +1374,31 @@ errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, printf("(re/un)mapping first block in extent\n"); #endif if (physical) { - retval = ext2fs_extent_get(handle, - EXT2_EXTENT_PREV_LEAF, - &extent); - if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) - extent_uninit = 1; - if (retval == EXT2_ET_EXTENT_NO_PREV) { - retval = ext2fs_extent_goto(handle, logical); + if (has_prev && + (logical == (prev_extent.e_lblk + + prev_extent.e_len)) && + (physical == (prev_extent.e_pblk + + prev_extent.e_len)) && + (new_uninit == prev_uninit) && + ((int) prev_extent.e_len < max_len-1)) { + retval = ext2fs_extent_get(handle, + EXT2_EXTENT_PREV_LEAF, &prev_extent); if (retval) goto done; + prev_extent.e_len++; + retval = ext2fs_extent_replace(handle, 0, + &prev_extent); + } else retval = ext2fs_extent_insert(handle, 0, &newextent); - } else if (retval) + if (retval) goto done; - else if ((logical == extent.e_lblk + extent.e_len) && - (physical == extent.e_pblk + extent.e_len) && - (new_uninit == extent_uninit) && - ((int) extent.e_len < max_len-1)) { - extent.e_len++; - retval = ext2fs_extent_replace(handle, 0, - &extent); - } else { - retval = ext2fs_extent_insert(handle, - EXT2_EXTENT_INSERT_AFTER, &newextent); - } + retval = ext2fs_extent_get(handle, + EXT2_EXTENT_NEXT_LEAF, + &extent); if (retval) goto done; } - retval = ext2fs_extent_get(handle, EXT2_EXTENT_NEXT_LEAF, - &extent); - if (retval) - goto done; extent.e_pblk++; extent.e_lblk++; extent.e_len--; @@ -1363,6 +1461,19 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags) if (!handle->path) return EXT2_ET_NO_CURRENT_NODE; +#ifdef DEBUG + { + struct ext2fs_extent extent; + + retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, + &extent); + if (retval == 0) { + printf("extent delete %u ", handle->ino); + dbg_print_extent(0, &extent); + } + } +#endif + path = handle->path + handle->level; if (!path->curr) return EXT2_ET_NO_CURRENT_NODE; @@ -1885,7 +1996,8 @@ void do_goto_block(int argc, char **argv) retval = extent_goto(current_handle, level, (blk64_t) blk); if (retval) { - com_err(argv[0], retval, "while trying to go to block %lu, level %d", + com_err(argv[0], retval, + "while trying to go to block %u, level %d", blk, level); return; } diff --git a/misc/filefrag.c b/misc/filefrag.c index 46e9f566..eed2b869 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -95,8 +95,6 @@ static int get_bmap(int fd, unsigned long block, unsigned long *phy_blk) int ret; unsigned int b; - printf("Calling get_bmap for block %lu\n", block); - abort(); b = block; ret = ioctl(fd, FIBMAP, &b); /* FIBMAP takes pointer to integer */ if (ret < 0) { diff --git a/misc/mke2fs.c b/misc/mke2fs.c index a9b01cbd..e10fd352 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/version.h b/version.h index 648d684b..b0bc0572 100644 --- a/version.h +++ b/version.h @@ -8,4 +8,4 @@ */ #define E2FSPROGS_VERSION "1.41.8" -#define E2FSPROGS_DATE "11-July-2009" +#define E2FSPROGS_DATE "20-Jul-2009"