Hello community,

here is the log from the commit of package e2fsprogs.11901 for 
openSUSE:Leap:15.1:Update checked in at 2020-02-04 18:13:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.1:Update/e2fsprogs.11901 (Old)
 and      /work/SRC/openSUSE:Leap:15.1:Update/.e2fsprogs.11901.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "e2fsprogs.11901"

Tue Feb  4 18:13:14 2020 rev:1 rq:768843 version:1.43.8

Changes:
--------
New Changes file:

--- /dev/null   2019-12-19 10:12:34.003146842 +0100
+++ 
/work/SRC/openSUSE:Leap:15.1:Update/.e2fsprogs.11901.new.26092/e2fsprogs.changes
    2020-02-04 18:13:15.513447706 +0100
@@ -0,0 +1,1898 @@
+-------------------------------------------------------------------
+Thu Jan  9 14:25:34 UTC 2020 - Jan Kara <[email protected]>
+
+- e2fsck-abort-if-there-is-a-corrupted-directory-block.patch: e2fsck: abort if
+  there is a corrupted directory block when rehashing (bsc#1160571
+  CVE-2019-5188)
+- e2fsck-don-t-try-to-rehash-a-deleted-directory.patch: 2fsck: don't try to
+  rehash a deleted directory (bsc#1160571 CVE-2019-5188)
+
+-------------------------------------------------------------------
+Mon Nov 11 10:21:14 UTC 2019 - Jan Kara <[email protected]>
+
+- resize2fs-Make-minimum-size-estimates-more-reliable.patch: resize2fs: Make
+  minimum size estimates more reliable for mounted fs (bsc#1154295)
+
+-------------------------------------------------------------------
+Mon Sep 30 15:07:58 UTC 2019 - Jan Kara <[email protected]>
+
+- libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch: add checks to
+  prevent buffer overrun bugs in quota code (bsc#1152101, CVE-2019-5094)
+
+-------------------------------------------------------------------
+Wed Aug 28 16:00:08 UTC 2019 - Jan Kara <[email protected]>
+
+- libext2fs-call-fsync-2-to-clear-stale-errors-for-a-n.patch: libext2fs: call
+  fsync(2) to clear stale errors for a new a unix I/O channel (bsc#1145716)
+
+-------------------------------------------------------------------
+Thu May 16 15:18:23 UTC 2019 - Jan Kara <[email protected]>
+
+- e2fsck-check-and-fix-tails-of-all-bitmaps.patch: e2fsck: check and fix tails
+  of all bitmap blocks (bsc#1128383)
+
+-------------------------------------------------------------------
+Fri Jun  1 16:31:22 UTC 2018 - [email protected]
+
+- libext2fs-Fix-fsync-2-detection.patch: libext2fs: Fix fsync(2) detection
+  (bsc#1038194)
+
+-------------------------------------------------------------------
+Fri Jun  1 15:57:14 UTC 2018 - [email protected]
+
+- Add references from old package:
+  Fix resize2fs-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch
+  in 1.42.12 (bsc#1009532)
+  Fix libext2fs-fix-potential-buffer-overflow-in-closefs.patch
+  in 1.42.13 (bsc#918346 CVE-2015-1572)
+  Fix libext2fs-avoid-buffer-overflow-if-s_first_meta_bg-i.patch
+  in 1.42.12 (bsc#915402 CVE-2015-0247)
+  Got specfile fix through Factory (bsc#960273)
+  Fix libext2fs-don-t-ignore-fsync-errors.patch in 1.43.4 (bsc#1038194)
+
+-------------------------------------------------------------------
+Wed Jan 24 14:41:11 UTC 2018 - [email protected]
+
+- libext2fs-fix-build-failure-in-swapfs.c-on-big-endia.patch:
+  libext2fs: fix build failure in swapfs.c on big-endian systems (bsc#1077420)
+
+-------------------------------------------------------------------
+Tue Jan  9 10:16:04 UTC 2018 - [email protected]
+
+- Update to 1.43.8
+ * add forgotten byteswap of some new superblock fields
+ * fix use-after-free in e2fsck for corrupted root inode
+ * fix floating point exception due to corrupted superblock in e2fsck
+ * fix resize2fs's free block sanity checks
+ * updated translations
+
+-------------------------------------------------------------------
+Tue Nov 14 09:49:57 UTC 2017 - [email protected]
+
+- Added %license tag to specfile
+
+-------------------------------------------------------------------
+Tue Nov  7 09:23:56 UTC 2017 - [email protected]
+
+- Update to 1.43.7
+ * debugfs, tune2fs, fuse2fs fixes of error handling in journal replay
+ * e2fsck and debugfs fixes so that malicious filesystems do not cause
+   buffer overflows
+ * fix corner cases in offline resizing in resize2fs
+ * updated translations
+
+-------------------------------------------------------------------
+Mon Sep 18 14:42:48 CEST 2017 - [email protected]
+
+- ignore errors for install-info calls in post scripts,
+  otherwise installing with "--excludedocs" fails 
+
+-------------------------------------------------------------------
+Tue Sep  5 15:33:16 UTC 2017 - [email protected]
+
+- Update to 1.43.6
+ * fix printing of quota inconsistency messages
+ * fix out of bounds checks in e2fsck
+ * optimize e2fsck CPU usage for large sparse files
+ * increase inode size to 256 bytes if features require it
+ * various UI fixes
+ * updated translations
+
+-------------------------------------------------------------------
+Mon Aug 28 13:42:33 UTC 2017 - [email protected]
+
+- Add missing coreutils dependency for initrd macros (bsc#1055492).
+
+-------------------------------------------------------------------
+Mon Aug 21 13:14:25 UTC 2017 - [email protected]
+
+- Update to 1.43.5
+ * fix e2fsck infinite loop when rebuilding encrypted directories
+ * fix tune2fs support for enabling /disabling project quota
+ * fixes in debugfs, dumpe2fs, e2fsck, tune2fs, and resize2fs for maliciously
+   corrupted filesystems
+ * fix e2fsck to verify invalid quota inode numbers
+ * fix byte-swapping of backup superblocks
+ * fix e2fsck -E bmap2extent to work for sparse files
+ * fix e2fsck to correctly handle quota accounting for multiply claimed blocks
+ * lots of other fixes
+
+-------------------------------------------------------------------
+Fri Mar  3 09:47:06 UTC 2017 - [email protected]
+
+- Update to 1.43.4
+ * fix e2fsck handling of system.data extended attributes for small files
+ * fixes in mke2fs -d
+ * make mke2fs refuse absurdly large devices
+ * make mke2fs properly report IO errors
+ * clarify default in mke2fs questions
+ * re-add uninit_bg to mke2fs.conf
+ * add support for project quota to debugfs
+ * improve xattr support in debugfs
+ * remove mkfs.ext4dev and fsck.ext4dev
+
+-------------------------------------------------------------------
+Mon Oct  3 12:02:04 UTC 2016 - [email protected]
+
+- Remove suse-module-tools dependency as it creates cycle in dependency list
+
+-------------------------------------------------------------------
+Tue Sep 27 12:41:57 UTC 2016 - [email protected]
+
+- Update download URL to poing to ftp.kernel.org which is more reliable
+
+-------------------------------------------------------------------
+Mon Sep 26 12:56:47 UTC 2016 - [email protected]
+
+- Update to 1.43.3
+  * mke2fs will use larger journal for large filesystems by default
+  * e2fsck journal replay bugfixes
+  * debugfs improvements and fixes
+  * fix resize2fs migration of attribute blocks
+- fuse2fs manpage is no longer installed when fuse2fs is not built
+
+-------------------------------------------------------------------
+Mon Sep 12 11:02:14 UTC 2016 - [email protected]
+
+- fix last change
+
+-------------------------------------------------------------------
+Sat Jul 23 18:24:39 UTC 2016 - [email protected]
+
+- Rebuild the initrd if this package changes (and we are not 
+  building the -mini version)
+
+-------------------------------------------------------------------
+Mon Jun 20 14:58:12 UTC 2016 - [email protected]
+
+- Update to 1.43.1
+  * Add support for the ext4 metadata checksum, checksum seed, inline data,
+    encryption, project quota, and read-only features
+  * Support for the very old, experimental, and never-added-to-mainline
+    compression feature has been removed
+  * Mke2fs will now create file systems with the metadata_csum and 64bit
+    features enabled by default
+  * The tune2fs program will ask the user for confirmation before starting
+    dangerous operations if the terminal is available, and it will replay
+    the journal if necessary
+  * Add an ext2/3/4 FUSE server
+  * The resize2fs command can now convert file systems between 64-bit and
+    32-bit mode
+  * We now use a new e2undo file format which is much more efficient and
+    faster than the old tdb-based scheme. Since it so much faster, e2fsck,
+    tune2fs, debugfs, and resize2fs now also can support using creating an
+    undo file.
+  * Multiple e2fsck fixes
+  * Multiple mke2fs improvements
+  * Multiple debugfs improvements
+
+-------------------------------------------------------------------
+Fri Aug  7 00:00:00 CEST 2015 - [email protected]
+
+- spec: add static library dependencies
+
+-------------------------------------------------------------------
+Mon Jul 27 00:00:00 CEST 2015 - [email protected]
+
+- enable static build and package static libraries
++++ 1701 more lines (skipped)
++++ between /dev/null
++++ and 
/work/SRC/openSUSE:Leap:15.1:Update/.e2fsprogs.11901.new.26092/e2fsprogs.changes

New:
----
  README.SUSE
  baselibs.conf
  e2fsck-abort-if-there-is-a-corrupted-directory-block.patch
  e2fsck-check-and-fix-tails-of-all-bitmaps.patch
  e2fsck-don-t-try-to-rehash-a-deleted-directory.patch
  e2fsprogs-1.42-ext2fsh_implicit.patch
  e2fsprogs-1.42-implicit_fortify_decl.patch
  e2fsprogs-1.43.8.tar.gz
  e2fsprogs.changes
  e2fsprogs.spec
  libcom_err-compile_et_permissions.patch
  libext2fs-Fix-fsync-2-detection.patch
  libext2fs-call-fsync-2-to-clear-stale-errors-for-a-n.patch
  libext2fs-fix-build-failure-in-swapfs.c-on-big-endia.patch
  libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch
  pre_checkin.sh
  resize2fs-Make-minimum-size-estimates-more-reliable.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ e2fsprogs.spec ++++++
#
# spec file for package e2fsprogs
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define build_mini 0

Name:           e2fsprogs
%if 0%{?suse_version} >= 1010
# Hint for ZYPP
Supplements:    filesystem(ext2) filesystem(ext3) filesystem(ext4)
%endif
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libblkid-devel
BuildRequires:  libuuid-devel
BuildRequires:  pkg-config
%if ! %{build_mini}
%if 0%{?suse_version} > 1220
BuildRequires:  makeinfo
%endif
# Define info macros if missing (for Fedora builds)
%if 0%{!?%install_info_prereq:1}
%define install_info_prereq info
%define install_info sbin/install-info
%define install_info_delete sbin/install-info --delete
%endif
Requires:       %install_info_prereq
%endif
# bug437293
%ifarch ppc64
Obsoletes:      e2fsprogs-64bit
%endif

%if %{build_mini}
Conflicts:      e2fsprogs
Conflicts:      e2fsprogs-devel
Conflicts:      libext2fs2
Conflicts:      libext2fs-devel
Conflicts:      libcom_err2
Conflicts:      libcom_err-devel
%else
Conflicts:      e2fsprogs-mini
Conflicts:      e2fsprogs-mini-devel
Conflicts:      libext2fs2-mini
Conflicts:      libext2fs-mini-devel
Conflicts:      libcom_err2-mini
Conflicts:      libcom_err-mini-devel
%endif
#
Version:        1.43.8
Release:        0
Summary:        Utilities for the Second Extended File System
License:        GPL-2.0
Group:          System/Filesystems
Url:            http://e2fsprogs.sourceforge.net
Requires(post): coreutils
Requires:       libcom_err2 >= %{version}
Requires:       libext2fs2 >= %{version}
Source:         
http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.gz
Source2:        README.SUSE
Source3:        baselibs.conf
#
# e2fsprogs patches
#
Patch1:         libext2fs-fix-build-failure-in-swapfs.c-on-big-endia.patch
# libcom_err patches
Patch3:         libcom_err-compile_et_permissions.patch
Patch4:         e2fsprogs-1.42-implicit_fortify_decl.patch
Patch5:         e2fsprogs-1.42-ext2fsh_implicit.patch
Patch6:         libext2fs-Fix-fsync-2-detection.patch
Patch7:         e2fsck-check-and-fix-tails-of-all-bitmaps.patch
Patch8:         libext2fs-call-fsync-2-to-clear-stale-errors-for-a-n.patch
Patch9:         libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch
Patch10:        resize2fs-Make-minimum-size-estimates-more-reliable.patch
Patch11:        e2fsck-abort-if-there-is-a-corrupted-directory-block.patch
Patch12:        e2fsck-don-t-try-to-rehash-a-deleted-directory.patch
# Do not suppress make commands
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Utilities needed to create and maintain ext2 and ext3 file systems
under Linux. Included in this package are: chattr, lsattr, mke2fs,
mklost+found, tune2fs, e2fsck, resize2fs, and badblocks.

%package devel
Summary:        Dummy development package
# bug437293
License:        LGPL-2.0
Group:          Development/Libraries/C and C++
%ifarch ppc64
Obsoletes:      e2fsprogs-devel-64bit
%endif
#
Requires:       libblkid-devel
Requires:       libext2fs-devel = %version
Requires:       libuuid-devel

%description devel
Dummy development package for backwards compatibility.

%if %{build_mini}
%package -n libext2fs2-mini
%else
%package -n libext2fs2
%endif
Summary:        Ext2fs library
License:        LGPL-2.0
Group:          System/Filesystems

%if %{build_mini}
%description -n libext2fs2-mini
%else
%description -n libext2fs2
%endif
The basic Ext2fs shared library.

%if %{build_mini}
%package -n libext2fs-mini-devel
%else
%package -n libext2fs-devel
%endif
Summary:        Development files for libext2fs
License:        LGPL-2.0
Group:          Development/Libraries/C and C++
Requires:       libcom_err-devel
Requires:       libext2fs2 = %version

%if %{build_mini}
%description -n libext2fs-mini-devel
%else
%description -n libext2fs-devel
%endif
Development files for libext2fs.

%if ! %{build_mini}
%package -n libext2fs-devel-static
Summary:        Development files for libext2fs
License:        LGPL-2.0
Group:          Development/Libraries/C and C++
Requires:       libext2fs-devel = %{version}
Provides:       libext2fs-devel:%{_libdir}/libe2p.a
Provides:       libext2fs-devel:%{_libdir}/libext2fs.a

%description -n libext2fs-devel-static
Development files for libext2fs. Static libraries.
%endif

%if %{build_mini}
%package -n libcom_err2-mini
%else
%package -n libcom_err2
%endif
Summary:        E2fsprogs error reporting library
# bug437293
License:        MIT
Group:          System/Filesystems
%ifarch ppc64
Obsoletes:      libcom_err-64bit
Obsoletes:      libcom_err2-64bit
%endif
#
Provides:       libcom_err = %{version}
Obsoletes:      libcom_err <= 1.40

%if %{build_mini}
%description -n libcom_err2-mini
%else
%description -n libcom_err2
%endif
com_err is an error message display library.

%if %{build_mini}
%package -n libcom_err-mini-devel
%else
%package -n libcom_err-devel
%endif
Summary:        Development files for libcom_err
# bug437293
License:        MIT
Group:          Development/Libraries/C and C++
%ifarch ppc64
Obsoletes:      libcom_err-devel-64bit
%endif
#
Requires:       glibc-devel
Requires:       libcom_err2 = %version

%if %{build_mini}
%description -n libcom_err-mini-devel
%else
%description -n libcom_err-devel
%endif
Development files for the com_err error message display library.

%if ! %{build_mini}
%package -n libcom_err-devel-static
Summary:        Development files for libcom_err, static libraries
License:        MIT
Group:          Development/Libraries/C and C++
Requires:       libcom_err-devel = %{version}
Provides:       libcom_err-devel:%{_libdir}/libcom_err.a
Provides:       libcom_err-devel:%{_libdir}/libss.a
# bug437293
%ifarch ppc64
Obsoletes:      libcom_err-devel-64bit
%endif
#

%description -n libcom_err-devel-static
Development files for the com_err error message display library. Static 
libraries.
%endif

%prep
%setup -q -n e2fsprogs-%{version}
# e2fsprogs patches
%patch1 -p1
# libcom_err patches
%patch3 -p1
%patch4
%patch5
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
cp %{SOURCE2} .

%build
autoreconf --force --install
%configure \
  --disable-evms \
  --with-root-prefix=''   \
  --enable-elf-shlibs \
  --disable-libblkid \
  --disable-libuuid \
  --disable-uuidd \
  --disable-fsck \
  --enable-static \
  CFLAGS="$RPM_OPT_FLAGS"
%if %{build_mini}
rm -rf doc
%endif
make %{?_smp_mflags} V=1
#Guarantee that tranlations match the source messages
make -C po update-po

%install
make install install-libs DESTDIR=$RPM_BUILD_ROOT ELF_INSTALL_DIR=/%{_libdir}

%{find_lang} e2fsprogs

rm $RPM_BUILD_ROOT%{_libdir}/e2initrd_helper

#UsrMerge
mkdir %{buildroot}/sbin
ln -s %{_sbindir}/badblocks %{buildroot}/sbin/badblocks
ln -s %{_sbindir}/debugfs   %{buildroot}/sbin/debugfs
ln -s %{_sbindir}/dumpe2fs  %{buildroot}/sbin/dumpe2fs
ln -s %{_sbindir}/e2undo    %{buildroot}/sbin/e2undo
ln -s %{_sbindir}/e2fsck    %{buildroot}/sbin/e2fsck
ln -s %{_sbindir}/e2label   %{buildroot}/sbin/e2label
ln -s %{_sbindir}/fsck.ext2 %{buildroot}/sbin/fsck.ext2
ln -s %{_sbindir}/fsck.ext3 %{buildroot}/sbin/fsck.ext3
ln -s %{_sbindir}/fsck.ext4 %{buildroot}/sbin/fsck.ext4
ln -s %{_sbindir}/mke2fs    %{buildroot}/sbin/mke2fs
ln -s %{_sbindir}/mkfs.ext2 %{buildroot}/sbin/mkfs.ext2
ln -s %{_sbindir}/mkfs.ext3 %{buildroot}/sbin/mkfs.ext3
ln -s %{_sbindir}/mkfs.ext4 %{buildroot}/sbin/mkfs.ext4
ln -s %{_sbindir}/resize2fs %{buildroot}/sbin/resize2fs
ln -s %{_sbindir}/tune2fs   %{buildroot}/sbin/tune2fs
ln -s %{_sbindir}/e2image   %{buildroot}/sbin/e2image
ln -s %{_sbindir}/logsave   %{buildroot}/sbin/logsave
mkdir %{buildroot}/%{_lib}
pushd %{buildroot}/%{_libdir}
LIBNAMES=$(ls *.so.*)
popd
for libName in $LIBNAMES;
  do ln -s %{_libdir}/$libName %{buildroot}/%{_lib};
done
#EndUsrMerge
%post
/sbin/ldconfig
%if ! %{build_mini}
%install_info --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz || :
%{?regenerate_initrd_post}
%endif

%postun
/sbin/ldconfig
%if ! %{build_mini}
%install_info_delete --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz || :
%{?regenerate_initrd_post}
%endif

%if ! %{build_mini}
%posttrans
%{?regenerate_initrd_posttrans}
%endif

%if %{build_mini}
%post -n libext2fs2-mini -p /sbin/ldconfig
%else
%post -n libext2fs2 -p /sbin/ldconfig
%endif

%if %{build_mini}
%postun -n libext2fs2-mini -p /sbin/ldconfig
%else
%postun -n libext2fs2 -p /sbin/ldconfig
%endif

%if %{build_mini}
%post -n libcom_err2-mini -p /sbin/ldconfig
%else
%post -n libcom_err2 -p /sbin/ldconfig
%endif

%if %{build_mini}
%postun -n libcom_err2-mini -p /sbin/ldconfig
%else
%postun -n libcom_err2 -p /sbin/ldconfig
%endif

%files -f e2fsprogs.lang
%defattr(-, root, root)
%doc RELEASE-NOTES README
%if 0%{?sle_version} > 120200
%license NOTICE
%endif
%config /etc/mke2fs.conf
#UsrMerge 
/sbin/badblocks
/sbin/debugfs
/sbin/dumpe2fs
/sbin/e2undo
/sbin/e2fsck
/sbin/e2label
/sbin/fsck.ext2
/sbin/fsck.ext3
/sbin/fsck.ext4
/sbin/mke2fs
/sbin/mkfs.ext2
/sbin/mkfs.ext3
/sbin/mkfs.ext4
/sbin/resize2fs
/sbin/tune2fs
/sbin/e2image
/sbin/logsave
#EndUsrMerge
%{_sbindir}/badblocks
%{_sbindir}/debugfs
%{_sbindir}/dumpe2fs
%{_sbindir}/e2undo
%{_sbindir}/e2fsck
%{_sbindir}/e2label
%{_sbindir}/fsck.ext2
%{_sbindir}/fsck.ext3
%{_sbindir}/fsck.ext4
%{_sbindir}/mke2fs
%{_sbindir}/mkfs.ext2
%{_sbindir}/mkfs.ext3
%{_sbindir}/mkfs.ext4
%{_sbindir}/resize2fs
%{_sbindir}/tune2fs
%{_sbindir}/e2image
%{_sbindir}/logsave 
%{_bindir}/chattr
%{_bindir}/lsattr
%{_sbindir}/mklost+found
%{_sbindir}/filefrag
%{_sbindir}/e2freefrag
%{_sbindir}/e4defrag
%{_sbindir}/e4crypt
%if ! %{build_mini}
%{_infodir}/libext2fs.info.gz
%endif
%{_mandir}/man1/chattr.1.gz
%{_mandir}/man1/lsattr.1.gz
%{_mandir}/man5/ext?.5.gz
%{_mandir}/man5/e2fsck.conf.5.gz
%{_mandir}/man5/mke2fs.conf.5.gz
%{_mandir}/man8/*.8.gz

%files devel
%defattr(-,root,root)
%doc README.SUSE

%if %{build_mini}
%files -n libext2fs2-mini
%else
%files -n libext2fs2
%endif
%defattr(-, root, root)
#UsrMerge
/%{_lib}/libext2fs.so.*
/%{_lib}/libe2p.so.*
#EndUsrMerge
%{_libdir}/libext2fs.so.*
%{_libdir}/libe2p.so.*

%if %{build_mini}
%files -n libext2fs-mini-devel
%else
%files -n libext2fs-devel
%endif
%defattr(-, root, root)
%{_libdir}/libext2fs.so
%{_libdir}/libe2p.so
/usr/include/ext2fs
/usr/include/e2p
%_libdir/pkgconfig/e2p.pc
%_libdir/pkgconfig/ext2fs.pc

%if %{build_mini}
%files -n libcom_err2-mini
%else
%files -n libcom_err2
%endif
%defattr(-, root, root)
#UsrMerge
/%{_lib}/libcom_err.so.*
/%{_lib}/libss.so.*
#EndUsrMerge
%{_libdir}/libcom_err.so.*
%{_libdir}/libss.so.*

%if %{build_mini}
%files -n libcom_err-mini-devel
%else
%files -n libcom_err-devel
%endif
%defattr(-, root, root)
%_bindir/compile_et
%_bindir/mk_cmds
%{_libdir}/libcom_err.so
%{_libdir}/libss.so
%_libdir/pkgconfig/com_err.pc
%_libdir/pkgconfig/ss.pc
%_includedir/com_err.h
%_includedir/et
%_includedir/ss
%_datadir/et
%_datadir/ss
%{_mandir}/man1/compile_et.1.gz
%{_mandir}/man1/mk_cmds.1.gz
%{_mandir}/man3/com_err.3.gz

%if ! %{build_mini}
%files -n libcom_err-devel-static
%defattr(-, root, root)
%{_libdir}/libcom_err.a
%{_libdir}/libss.a

%files -n libext2fs-devel-static
%defattr(-, root, root)
%{_libdir}/libext2fs.a
%{_libdir}/libe2p.a
%endif

%changelog
++++++ README.SUSE ++++++
e2fsprogs-devel
---------------
Since the e2fsprogs libraries has been split out into own packages,
each having its own devel package
libext2fs-devel
libblkid-devel
libuuid-devel
libcom_err-devel
the e2fsprogs-devel package is deprecated and is provided for temporary
backwards compatibility only.

++++++ baselibs.conf ++++++
libext2fs2
libcom_err2
  obsoletes "libcom_err-<targettype> <= <version>"
e2fsprogs
e2fsprogs-devel
libext2fs-devel
  requires -libext2fs-<targettype>
  requires "libext2fs2-<targettype> = <version>"
libcom_err-devel
  requires -libcom_err-<targettype>
  requires "libcom_err2-<targettype> = <version>"
++++++ e2fsck-abort-if-there-is-a-corrupted-directory-block.patch ++++++
>From 8dd73c149f418238f19791f9d666089ef9734dff Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Thu, 19 Dec 2019 19:37:34 -0500
Subject: [PATCH] e2fsck: abort if there is a corrupted directory block
 when rehashing
References: bsc#1160571 CVE-2019-5188

In e2fsck pass 3a, when we are rehashing directories, at least in
theory, all of the directories should have had corruptions with
respect to directory entry structure fixed.  However, it's possible
(for example, if the user declined a fix) that we can reach this stage
of processing with a corrupted directory entries.

So check for that case and don't try to process a corrupted directory
block so we don't run into trouble in mutate_name() if there is a
zero-length file name.

Addresses: TALOS-2019-0973
Addresses: CVE-2019-5188
Signed-off-by: Theodore Ts'o <[email protected]>
Acked-by: Jan Kara <[email protected]>
---
 e2fsck/rehash.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index a5fc1be1a210..3dd1e94131c6 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -160,6 +160,10 @@ static int fill_dir_block(ext2_filsys fs,
                dir_offset += rec_len;
                if (dirent->inode == 0)
                        continue;
+               if ((name_len) == 0) {
+                       fd->err = EXT2_ET_DIR_CORRUPTED;
+                       return BLOCK_ABORT;
+               }
                if (!fd->compress && (name_len == 1) &&
                    (dirent->name[0] == '.'))
                        continue;
@@ -401,6 +405,11 @@ static int duplicate_search_and_fix(e2fsck_t ctx, 
ext2_filsys fs,
                        continue;
                }
                new_len = ext2fs_dirent_name_len(ent->dir);
+               if (new_len == 0) {
+                        /* should never happen */
+                       ext2fs_unmark_valid(fs);
+                       continue;
+               }
                memcpy(new_name, ent->dir->name, new_len);
                mutate_name(new_name, &new_len);
                for (j=0; j < fd->num_array; j++) {
-- 
2.16.4

++++++ e2fsck-check-and-fix-tails-of-all-bitmaps.patch ++++++
>From 6d0b48896247dc70b16482a8ff4123d570285a2a Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Sun, 5 May 2019 16:43:33 -0400
Subject: [PATCH] e2fsck: check and fix tails of all bitmap blocks
References: bsc#1128383

Currently, e2fsck effectively checks only tail of the last inode and
block bitmap in the filesystem. Thus if some previous bitmap has unset
bits it goes unnoticed.  Mostly these tail bits in the bitmap are
ignored; however, if blocks_per_group are smaller than 8*blocksize,
the multi-block allocator in the kernel can get confused when the tail
bits are unset and return bogus free extent.

Add support to libext2fs to check these bitmap tails when loading
bitmaps (as that's about the only place which has access to the bitmap
tail bits) and make e2fsck use this functionality to detect buggy bitmap
tails and fix them (by rewriting the bitmaps).

Reported-by: Jan Kara <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
---
 e2fsck/pass5.c                                | 40 ++++++++++++++++---
 lib/ext2fs/ext2fs.h                           |  2 +
 lib/ext2fs/rw_bitmaps.c                       | 26 +++++++++++-
 tests/f_bitmaps/expect.1                      |  2 +
 tests/f_dup/expect.1                          |  2 +
 tests/f_dup2/expect.1                         |  2 +
 tests/f_dup3/expect.1                         |  2 +
 tests/f_end-bitmap/expect.1                   |  2 +
 tests/f_illbbitmap/expect.1                   |  2 +
 tests/f_illibitmap/expect.1                   |  2 +
 tests/f_illitable_flexbg/expect.1             |  2 +
 tests/f_lpf/expect.1                          |  2 +
 tests/f_overfsblks/expect.1                   |  2 +
 tests/f_super_bad_csum/expect.1               |  4 +-
 tests/j_corrupt_ext_jnl_sb_csum/expect        |  2 +
 tests/j_ext_long_trans/expect                 |  2 +
 tests/j_long_trans/expect                     |  2 +
 tests/j_long_trans_mcsum_32bit/expect         |  2 +
 tests/j_long_trans_mcsum_64bit/expect         |  2 +
 tests/j_recover_csum2_32bit/expect.1          |  2 +
 tests/j_recover_csum2_64bit/expect.1          |  2 +
 tests/j_short_trans/expect                    |  2 +
 tests/j_short_trans_64bit/expect              |  2 +
 tests/j_short_trans_mcsum_64bit/expect        |  2 +
 tests/j_short_trans_old_csum/expect           |  2 +
 tests/j_short_trans_open_recover/expect       |  2 +
 tests/j_short_trans_recover/expect            |  2 +
 .../j_short_trans_recover_mcsum_64bit/expect  |  2 +
 tests/t_replay_and_set/expect                 |  2 +
 29 files changed, 113 insertions(+), 9 deletions(-)

Index: e2fsprogs-1.43.8/e2fsck/pass5.c
===================================================================
--- e2fsprogs-1.43.8.orig/e2fsck/pass5.c
+++ e2fsprogs-1.43.8/e2fsck/pass5.c
@@ -840,6 +840,7 @@ static void check_inode_end(e2fsck_t ctx
        ext2_filsys fs = ctx->fs;
        ext2_ino_t      end, save_inodes_count, i;
        struct problem_context  pctx;
+       int asked = 0;
 
        clear_problem_context(&pctx);
 
@@ -853,11 +854,12 @@ static void check_inode_end(e2fsck_t ctx
                return;
        }
        if (save_inodes_count == end)
-               return;
+               goto check_intra_bg_tail;
 
        /* protect loop from wrap-around if end is maxed */
        for (i = save_inodes_count + 1; i <= end && i > save_inodes_count; i++) 
{
                if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) {
+                       asked = 1;
                        if (fix_problem(ctx, PR_5_INODE_BMAP_PADDING, &pctx)) {
                                for (; i <= end; i++)
                                        ext2fs_mark_inode_bitmap(fs->inode_map,
@@ -877,6 +879,20 @@ static void check_inode_end(e2fsck_t ctx
                ctx->flags |= E2F_FLAG_ABORT; /* fatal */
                return;
        }
+       /*
+        * If the number of inodes per block group != blocksize, we
+        * can also have a potential problem with the tail bits in
+        * each individual inode bitmap block.  If there is a problem,
+        * it would have been noticed when the bitmap was loaded.  And
+        * fixing this is easy; all we need to do force the bitmap to
+        * be written back to disk.
+        */
+check_intra_bg_tail:
+       if (!asked && fs->flags & EXT2_FLAG_IBITMAP_TAIL_PROBLEM)
+               if (fix_problem(ctx, PR_5_INODE_BMAP_PADDING, &pctx))
+                       ext2fs_mark_ib_dirty(fs);
+               else
+                       ext2fs_unmark_valid(fs);
 }
 
 static void check_block_end(e2fsck_t ctx)
@@ -884,6 +900,7 @@ static void check_block_end(e2fsck_t ctx
        ext2_filsys fs = ctx->fs;
        blk64_t end, save_blocks_count, i;
        struct problem_context  pctx;
+       int asked = 0;
 
        clear_problem_context(&pctx);
 
@@ -898,12 +915,13 @@ static void check_block_end(e2fsck_t ctx
                return;
        }
        if (save_blocks_count == end)
-               return;
+               goto check_intra_bg_tail;
 
        /* Protect loop from wrap-around if end is maxed */
        for (i = save_blocks_count + 1; i <= end && i > save_blocks_count; i++) 
{
                if (!ext2fs_test_block_bitmap2(fs->block_map,
                                               EXT2FS_C2B(fs, i))) {
+                       asked = 1;
                        if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx)) {
                                for (; i <= end; i++)
                                        ext2fs_mark_block_bitmap2(fs->block_map,
@@ -923,7 +941,19 @@ static void check_block_end(e2fsck_t ctx
                ctx->flags |= E2F_FLAG_ABORT; /* fatal */
                return;
        }
+       /*
+        * If the number of blocks per block group != blocksize, we
+        * can also have a potential problem with the tail bits in
+        * each individual block bitmap block.  If there is a problem,
+        * it would have been noticed when the bitmap was loaded.  And
+        * fixing this is easy; all we need to do force the bitmap to
+        * be written back to disk.
+        */
+check_intra_bg_tail:
+       if (!asked && fs->flags & EXT2_FLAG_BBITMAP_TAIL_PROBLEM) {
+               if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx))
+                       ext2fs_mark_bb_dirty(fs);
+               else
+                       ext2fs_unmark_valid(fs);
+       }
 }
-
-
-
Index: e2fsprogs-1.43.8/lib/ext2fs/ext2fs.h
===================================================================
--- e2fsprogs-1.43.8.orig/lib/ext2fs/ext2fs.h
+++ e2fsprogs-1.43.8/lib/ext2fs/ext2fs.h
@@ -196,6 +196,8 @@ typedef struct ext2_file *ext2_file_t;
 #define EXT2_FLAG_DIRECT_IO            0x80000
 #define EXT2_FLAG_SKIP_MMP             0x100000
 #define EXT2_FLAG_IGNORE_CSUM_ERRORS   0x200000
+#define EXT2_FLAG_BBITMAP_TAIL_PROBLEM 0x1000000
+#define EXT2_FLAG_IBITMAP_TAIL_PROBLEM 0x2000000
 
 /*
  * Special flag in the ext2 inode i_flag field that means that this is
Index: e2fsprogs-1.43.8/lib/ext2fs/rw_bitmaps.c
===================================================================
--- e2fsprogs-1.43.8.orig/lib/ext2fs/rw_bitmaps.c
+++ e2fsprogs-1.43.8/lib/ext2fs/rw_bitmaps.c
@@ -195,6 +195,16 @@ static errcode_t mark_uninit_bg_group_bl
        return 0;
 }
 
+static int bitmap_tail_verify(unsigned char *bitmap, int first, int last)
+{
+       int i;
+
+       for (i = first; i <= last; i++)
+               if (bitmap[i] != 0xff)
+                       return 0;
+       return 1;
+}
+
 static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
 {
        dgrp_t i;
@@ -203,6 +213,7 @@ static errcode_t read_bitmaps(ext2_filsy
        errcode_t retval;
        int block_nbytes = EXT2_CLUSTERS_PER_GROUP(fs->super) / 8;
        int inode_nbytes = EXT2_INODES_PER_GROUP(fs->super) / 8;
+       int tail_flags = 0;
        int csum_flag;
        unsigned int    cnt;
        blk64_t blk;
@@ -317,6 +328,9 @@ static errcode_t read_bitmaps(ext2_filsy
                                        EXT2_ET_BLOCK_BITMAP_CSUM_INVALID;
                                        goto cleanup;
                                }
+                               if (!bitmap_tail_verify(block_bitmap,
+                                                       block_nbytes, 
fs->blocksize - 1))
+                                       tail_flags |= 
EXT2_FLAG_BBITMAP_TAIL_PROBLEM;
                        } else
                                memset(block_bitmap, 0, block_nbytes);
                        cnt = block_nbytes << 3;
@@ -349,6 +363,9 @@ static errcode_t read_bitmaps(ext2_filsy
                                        EXT2_ET_INODE_BITMAP_CSUM_INVALID;
                                        goto cleanup;
                                }
+                               if (!bitmap_tail_verify(inode_bitmap,
+                                                       inode_nbytes, 
fs->blocksize - 1))
+                                       tail_flags |= 
EXT2_FLAG_IBITMAP_TAIL_PROBLEM;
                        } else
                                memset(inode_bitmap, 0, inode_nbytes);
                        cnt = inode_nbytes << 3;
@@ -368,10 +385,15 @@ static errcode_t read_bitmaps(ext2_filsy
        }
 
 success_cleanup:
-       if (inode_bitmap)
+       if (inode_bitmap) {
                ext2fs_free_mem(&inode_bitmap);
-       if (block_bitmap)
+               fs->flags &= ~EXT2_FLAG_IBITMAP_TAIL_PROBLEM;
+       }
+       if (block_bitmap) {
                ext2fs_free_mem(&block_bitmap);
+               fs->flags &= ~EXT2_FLAG_BBITMAP_TAIL_PROBLEM;
+       }
+       fs->flags |= tail_flags;
        return 0;
 
 cleanup:
Index: e2fsprogs-1.43.8/tests/f_bitmaps/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_bitmaps/expect.1
+++ e2fsprogs-1.43.8/tests/f_bitmaps/expect.1
@@ -11,6 +11,8 @@ Fix? yes
 Inode bitmap differences:  +11 -15
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/32 files (9.1% non-contiguous), 22/100 blocks
Index: e2fsprogs-1.43.8/tests/f_dup/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_dup/expect.1
+++ e2fsprogs-1.43.8/tests/f_dup/expect.1
@@ -30,6 +30,8 @@ Fix? yes
 Free blocks count wrong (62, counted=60).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 Padding at end of block bitmap is not set. Fix? yes
 
 
Index: e2fsprogs-1.43.8/tests/f_dup2/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_dup2/expect.1
+++ e2fsprogs-1.43.8/tests/f_dup2/expect.1
@@ -37,6 +37,8 @@ Fix? yes
 Free blocks count wrong (26, counted=22).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 Padding at end of block bitmap is not set. Fix? yes
 
 
Index: e2fsprogs-1.43.8/tests/f_dup3/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_dup3/expect.1
+++ e2fsprogs-1.43.8/tests/f_dup3/expect.1
@@ -39,6 +39,8 @@ Fix? yes
 Free blocks count wrong (20, counted=19).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 16/16 files (25.0% non-contiguous), 81/100 blocks
Index: e2fsprogs-1.43.8/tests/f_end-bitmap/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_end-bitmap/expect.1
+++ e2fsprogs-1.43.8/tests/f_end-bitmap/expect.1
@@ -8,6 +8,8 @@ Pass 5: Checking group summary informati
 Free blocks count wrong for group #0 (44, counted=63).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 Padding at end of block bitmap is not set. Fix? yes
 
 
Index: e2fsprogs-1.43.8/tests/f_illbbitmap/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_illbbitmap/expect.1
+++ e2fsprogs-1.43.8/tests/f_illbbitmap/expect.1
@@ -22,6 +22,8 @@ Fix? yes
 Inode bitmap differences:  -(12--21)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks
Index: e2fsprogs-1.43.8/tests/f_illibitmap/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_illibitmap/expect.1
+++ e2fsprogs-1.43.8/tests/f_illibitmap/expect.1
@@ -19,6 +19,8 @@ Pass 5: Checking group summary informati
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks
Index: e2fsprogs-1.43.8/tests/f_illitable_flexbg/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_illitable_flexbg/expect.1
+++ e2fsprogs-1.43.8/tests/f_illitable_flexbg/expect.1
@@ -18,6 +18,8 @@ Pass 5: Checking group summary informati
 Inode bitmap differences:  -(65--128)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 12/256 files (0.0% non-contiguous), 31163/32768 blocks
Index: e2fsprogs-1.43.8/tests/f_lpf/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_lpf/expect.1
+++ e2fsprogs-1.43.8/tests/f_lpf/expect.1
@@ -42,6 +42,8 @@ Fix? yes
 Free inodes count wrong (1, counted=0).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 16/16 files (12.5% non-contiguous), 67/100 blocks
Index: e2fsprogs-1.43.8/tests/f_overfsblks/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_overfsblks/expect.1
+++ e2fsprogs-1.43.8/tests/f_overfsblks/expect.1
@@ -13,6 +13,8 @@ Pass 5: Checking group summary informati
 Inode bitmap differences:  -(12--21)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks
Index: e2fsprogs-1.43.8/tests/f_super_bad_csum/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/f_super_bad_csum/expect.1
+++ e2fsprogs-1.43.8/tests/f_super_bad_csum/expect.1
@@ -5,8 +5,8 @@ Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
-Inode bitmap differences: Group 1 inode bitmap does not match checksum.
-FIXED.
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/1024 files (0.0% non-contiguous), 1557/16384 blocks
Index: e2fsprogs-1.43.8/tests/j_corrupt_ext_jnl_sb_csum/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_corrupt_ext_jnl_sb_csum/expect
+++ e2fsprogs-1.43.8/tests/j_corrupt_ext_jnl_sb_csum/expect
@@ -12,6 +12,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/128 files (0.0% non-contiguous), 66/2048 blocks
Index: e2fsprogs-1.43.8/tests/j_ext_long_trans/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_ext_long_trans/expect
+++ e2fsprogs-1.43.8/tests/j_ext_long_trans/expect
@@ -98,6 +98,8 @@ Fix? yes
 Free inodes count wrong (16372, counted=16373).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 6228/262144 blocks
Index: e2fsprogs-1.43.8/tests/j_long_trans/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_long_trans/expect
+++ e2fsprogs-1.43.8/tests/j_long_trans/expect
@@ -96,6 +96,8 @@ Fix? yes
 Free inodes count wrong (16372, counted=16373).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 Recreate journal? yes
 
 Creating journal (8192 blocks):  Done.
Index: e2fsprogs-1.43.8/tests/j_long_trans_mcsum_32bit/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_long_trans_mcsum_32bit/expect
+++ e2fsprogs-1.43.8/tests/j_long_trans_mcsum_32bit/expect
@@ -135,6 +135,8 @@ Fix? yes
 Free inodes count wrong (32756, counted=32757).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 Recreate journal? yes
 
 Creating journal (16384 blocks):  Done.
Index: e2fsprogs-1.43.8/tests/j_long_trans_mcsum_64bit/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_long_trans_mcsum_64bit/expect
+++ e2fsprogs-1.43.8/tests/j_long_trans_mcsum_64bit/expect
@@ -134,6 +134,8 @@ Fix? yes
 Free inodes count wrong (32756, counted=32757).
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 Recreate journal? yes
 
 Creating journal (16384 blocks):  Done.
Index: e2fsprogs-1.43.8/tests/j_recover_csum2_32bit/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_recover_csum2_32bit/expect.1
+++ e2fsprogs-1.43.8/tests/j_recover_csum2_32bit/expect.1
@@ -10,6 +10,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/8192 files (0.0% non-contiguous), 7739/131072 blocks
Index: e2fsprogs-1.43.8/tests/j_recover_csum2_64bit/expect.1
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_recover_csum2_64bit/expect.1
+++ e2fsprogs-1.43.8/tests/j_recover_csum2_64bit/expect.1
@@ -10,6 +10,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/8192 files (0.0% non-contiguous), 7739/131072 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans/expect
@@ -32,6 +32,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans_64bit/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans_64bit/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans_64bit/expect
@@ -34,6 +34,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 5196/65536 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans_mcsum_64bit/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans_mcsum_64bit/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans_mcsum_64bit/expect
@@ -34,6 +34,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/32768 files (0.0% non-contiguous), 6353/131072 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans_old_csum/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans_old_csum/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans_old_csum/expect
@@ -34,6 +34,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans_open_recover/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans_open_recover/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans_open_recover/expect
@@ -37,6 +37,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans_recover/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans_recover/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans_recover/expect
@@ -34,6 +34,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
Index: e2fsprogs-1.43.8/tests/j_short_trans_recover_mcsum_64bit/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/j_short_trans_recover_mcsum_64bit/expect
+++ e2fsprogs-1.43.8/tests/j_short_trans_recover_mcsum_64bit/expect
@@ -36,6 +36,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/32768 files (0.0% non-contiguous), 6353/131072 blocks
Index: e2fsprogs-1.43.8/tests/t_replay_and_set/expect
===================================================================
--- e2fsprogs-1.43.8.orig/tests/t_replay_and_set/expect
+++ e2fsprogs-1.43.8/tests/t_replay_and_set/expect
@@ -30,6 +30,8 @@ Fix? yes
 Inode bitmap differences:  +(1--11)
 Fix? yes
 
+Padding at end of inode bitmap is not set. Fix? yes
+
 
 test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
 test_filesys: 11/16384 files (0.0% non-contiguous), 5164/65536 blocks
++++++ e2fsck-don-t-try-to-rehash-a-deleted-directory.patch ++++++
>From 71ba13755337e19c9a826dfc874562a36e1b24d3 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Thu, 19 Dec 2019 19:45:06 -0500
Subject: [PATCH] e2fsck: don't try to rehash a deleted directory
References: bsc#1160571 CVE-2019-5188

If directory has been deleted in pass1[bcd] processing, then we
shouldn't try to rehash the directory in pass 3a when we try to
rehash/reoptimize directories.

Signed-off-by: Theodore Ts'o <[email protected]>
Acked-by: Jan Kara <[email protected]>
---
 e2fsck/pass1b.c | 4 ++++
 e2fsck/rehash.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 5693b9cfcc5a..bca701cab94f 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -705,6 +705,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
                fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
        if (ctx->inode_bad_map)
                ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
+       if (ctx->inode_reg_map)
+               ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino);
+       ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino);
+       ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino);
        ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode));
        quota_data_sub(ctx->qctx, &dp->inode, ino,
                       pb.dup_blocks * fs->blocksize);
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index 3dd1e94131c6..2c908be04d70 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -1028,6 +1028,8 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
                        if (!ext2fs_u32_list_iterate(iter, &ino))
                                break;
                }
+               if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
+                       continue;
 
                pctx.dir = ino;
                if (first) {
-- 
2.16.4

++++++ e2fsprogs-1.42-ext2fsh_implicit.patch ++++++
Index: lib/ext2fs/ext2fs.h
===================================================================
--- lib/ext2fs/ext2fs.h.orig
+++ lib/ext2fs/ext2fs.h
@@ -62,6 +62,7 @@ extern "C" {
 #include <string.h>
 #include <time.h>
 #include <errno.h>
+#include <unistd.h>
 
 #if EXT2_FLAT_INCLUDES
 #include "e2_types.h"
++++++ e2fsprogs-1.42-implicit_fortify_decl.patch ++++++
Index: lib/ext2fs/mmp.c
===================================================================
--- lib/ext2fs/mmp.c.orig
+++ lib/ext2fs/mmp.c
@@ -27,6 +27,13 @@
 #include "ext2fs/ext2_fs.h"
 #include "ext2fs/ext2fs.h"
 
+#if _BSD_SOURCE || _XOPEN_SOURCE >= 500
+#include <netdb.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+
 #ifndef O_DIRECT
 #define O_DIRECT 0
 #endif
++++++ libcom_err-compile_et_permissions.patch ++++++
Index: e2fsprogs-1.42.13/lib/et/compile_et.sh.in
===================================================================
--- e2fsprogs-1.42.13.orig/lib/et/compile_et.sh.in
+++ e2fsprogs-1.42.13/lib/et/compile_et.sh.in
@@ -51,7 +51,7 @@ if test -f ${BASE}.h && cmp -s ${BASE}.h
     rm -f ${BASE}.h.$$
 else
     mv -f ${BASE}.h.$$ ${BASE}.h
-    chmod a-w ${BASE}.h
+#    chmod a-w ${BASE}.h
 fi
 $AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et"
 if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then
++++++ libext2fs-Fix-fsync-2-detection.patch ++++++
From: Jan Kara <[email protected]>
Date: Wed, 31 May 2017 14:49:18 +0200
Subject: [PATCH] libext2fs: Fix fsync(2) detection
References: bsc#1038194

For some reason lib/config.h.in was missing a definition of HAVE_FSYNC
and as a result lib/config.h never had HAVE_FSYNC defined. As a result
we never called fsync(2) for example from
lib/ext2fs/unix_io.c:unix_flush() when we finished creating filesystem
and could miss IO errors happening during creating of the filesystem.
Test generic/405 exposes this problem.

Fix the problem by defining HAVE_FSYNC in lib/config.h.in.

Signed-off-by: Jan Kara <[email protected]>
---
 lib/config.h.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/config.h.in b/lib/config.h.in
index 37d0c461338a..91e869e7d3d7 100644
--- a/lib/config.h.in
+++ b/lib/config.h.in
@@ -470,6 +470,9 @@
 /* Define to 1 if you have the `sync_file_range' function. */
 #undef HAVE_SYNC_FILE_RANGE
 
+/* Define to 1 if you have the 'fsync' function. */
+#undef HAVE_FSYNC
+
 /* Define to 1 if you have the `sysconf' function. */
 #undef HAVE_SYSCONF
 
-- 
2.12.3

++++++ libext2fs-call-fsync-2-to-clear-stale-errors-for-a-n.patch ++++++
>From e8236b49d0fb056847da5fb95b2709e63e6be7c6 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Wed, 4 Jul 2018 00:23:10 -0400
Subject: [PATCH] libext2fs: call fsync(2) to clear stale errors for a new a
 unix I/O channel
References: bsc#1145716

Newer versions of Linux will retain errors and allow them to be
returned by fsync() or close(), even if the error happened before the
file descriptor was opened.  This was to accomodate Postgres's
"interesting" method of error collection.

Unfortunately, for e2fsck, we never want to see stale errors, as this
can cause xfstests (such generic/347) to fail with a false positive.

Signed-off-by: Theodore Ts'o <[email protected]>
Acked-by: Jan Kara <[email protected]>
---
 lib/ext2fs/unix_io.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 53fbd28bf803..18a2e5f75c07 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -569,6 +569,14 @@ static errcode_t unix_open_channel(const char *name, int 
fd,
        if (safe_getenv("UNIX_IO_FORCE_BOUNCE"))
                flags |= IO_FLAG_FORCE_BOUNCE;
 
+#ifdef __linux__
+       /*
+        * We need to make sure any previous errors in the block
+        * device are thrown away, sigh.
+        */
+       (void) fsync(fd);
+#endif
+
        retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
        if (retval)
                goto cleanup;
-- 
2.16.4

++++++ libext2fs-fix-build-failure-in-swapfs.c-on-big-endia.patch ++++++
>From 876d9b0c8eac2fd80dd62bfa1b09adea62aa08f3 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Wed, 3 Jan 2018 01:32:02 -0500
Subject: [PATCH] libext2fs: fix build failure in swapfs.c on big-endian
 systems
References: bsc#1077420

Addresses-Debian-Bug: #886119

Reported-by: James Clarke <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Acked-by: Jan Kara <[email protected]>
---
 lib/ext2fs/swapfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 6e5cff97e505..b13dc4229225 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -19,6 +19,7 @@
 
 #include "ext2_fs.h"
 #include "ext2fs.h"
+#include "ext2fsP.h"
 #include <ext2fs/ext2_ext_attr.h>
 
 #ifdef WORDS_BIGENDIAN
@@ -358,7 +359,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct 
ext2_inode_large *t,
        if (inode_includes(inode_size, i_projid))
                 t->i_projid = ext2fs_swab16(f->i_projid);
        /* catch new static fields added after i_projid */
-       EXT2FS_BUILD_BUG_ON(sizeof(ext2_inode_large) != 160);
+       EXT2FS_BUILD_BUG_ON(sizeof(struct ext2_inode_large) != 160);
 
        i = sizeof(struct ext2_inode) + extra_isize + sizeof(__u32);
        if (bufsize < (int) i)
-- 
2.13.6

++++++ libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch ++++++
>From 8dbe7b475ec5e91ed767239f0e85880f416fc384 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Sun, 1 Sep 2019 00:59:16 -0400
Subject: [PATCH] libsupport: add checks to prevent buffer overrun bugs in
 quota code
References: bsc#1152101 CVE-2019-5094

A maliciously corrupted file systems can trigger buffer overruns in
the quota code used by e2fsck.  To fix this, add sanity checks to the
quota header fields as well as to block number references in the quota
tree.

Addresses: CVE-2019-5094
Addresses: TALOS-2019-0887
Signed-off-by: Theodore Ts'o <[email protected]>
Acked-by: Jan Kara <[email protected]>
---
 lib/support/mkquota.c      |  1 +
 lib/support/quotaio_tree.c | 71 ++++++++++++++++++++++++++++++----------------
 lib/support/quotaio_v2.c   | 28 ++++++++++++++++++
 3 files changed, 76 insertions(+), 24 deletions(-)

diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index 0b9e76659118..ddb531247819 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -671,6 +671,7 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, enum 
quota_type qtype,
        err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
        if (err) {
                log_debug("Error scanning dquots");
+               *usage_inconsistent = 1;
                goto out_close_qh;
        }
 
diff --git a/lib/support/quotaio_tree.c b/lib/support/quotaio_tree.c
index a7c2028c1dc7..6cc4fb5b2c10 100644
--- a/lib/support/quotaio_tree.c
+++ b/lib/support/quotaio_tree.c
@@ -540,6 +540,17 @@ struct dquot *qtree_read_dquot(struct quota_handle *h, 
qid_t id)
        return dquot;
 }
 
+static int check_reference(struct quota_handle *h, unsigned int blk)
+{
+       if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks) {
+               log_err("Illegal reference (%u >= %u) in %s quota file",
+                       blk, h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
+                       quota_type2name(h->qh_type));
+               return -1;
+       }
+       return 0;
+}
+
 /*
  * Scan all dquots in file and call callback on each
  */
@@ -558,7 +569,7 @@ static int report_block(struct dquot *dquot, unsigned int 
blk, char *bitmap,
        int entries, i;
 
        if (!buf)
-               return 0;
+               return -1;
 
        set_bit(bitmap, blk);
        read_blk(dquot->dq_h, blk, buf);
@@ -580,23 +591,12 @@ static int report_block(struct dquot *dquot, unsigned int 
blk, char *bitmap,
        return entries;
 }
 
-static void check_reference(struct quota_handle *h, unsigned int blk)
-{
-       if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks)
-               log_err("Illegal reference (%u >= %u) in %s quota file. "
-                       "Quota file is probably corrupted.\n"
-                       "Please run e2fsck (8) to fix it.",
-                       blk,
-                       h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
-                       quota_type2name(h->qh_type));
-}
-
 static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
                       char *bitmap,
                       int (*process_dquot) (struct dquot *, void *),
                       void *data)
 {
-       int entries = 0, i;
+       int entries = 0, ret, i;
        dqbuf_t buf = getdqbuf();
        __le32 *ref = (__le32 *) buf;
 
@@ -607,22 +607,40 @@ static int report_tree(struct dquot *dquot, unsigned int 
blk, int depth,
        if (depth == QT_TREEDEPTH - 1) {
                for (i = 0; i < QT_BLKSIZE >> 2; i++) {
                        blk = ext2fs_le32_to_cpu(ref[i]);
-                       check_reference(dquot->dq_h, blk);
-                       if (blk && !get_bit(bitmap, blk))
-                               entries += report_block(dquot, blk, bitmap,
-                                                       process_dquot, data);
+                       if (check_reference(dquot->dq_h, blk)) {
+                               entries = -1;
+                               goto errout;
+                       }
+                       if (blk && !get_bit(bitmap, blk)) {
+                               ret = report_block(dquot, blk, bitmap,
+                                                  process_dquot, data);
+                               if (ret < 0) {
+                                       entries = ret;
+                                       goto errout;
+                               }
+                               entries += ret;
+                       }
                }
        } else {
                for (i = 0; i < QT_BLKSIZE >> 2; i++) {
                        blk = ext2fs_le32_to_cpu(ref[i]);
                        if (blk) {
-                               check_reference(dquot->dq_h, blk);
-                               entries += report_tree(dquot, blk, depth + 1,
-                                                      bitmap, process_dquot,
-                                                      data);
+                               if (check_reference(dquot->dq_h, blk)) {
+                                       entries = -1;
+                                       goto errout;
+                               }
+                               ret = report_tree(dquot, blk, depth + 1,
+                                                 bitmap, process_dquot,
+                                                 data);
+                               if (ret < 0) {
+                                       entries = ret;
+                                       goto errout;
+                               }
+                               entries += ret;
                        }
                }
        }
+errout:
        freedqbuf(buf);
        return entries;
 }
@@ -642,6 +660,7 @@ int qtree_scan_dquots(struct quota_handle *h,
                      int (*process_dquot) (struct dquot *, void *),
                      void *data)
 {
+       int ret;
        char *bitmap;
        struct v2_mem_dqinfo *v2info = &h->qh_info.u.v2_mdqi;
        struct qtree_mem_dqinfo *info = &v2info->dqi_qtree;
@@ -655,10 +674,14 @@ int qtree_scan_dquots(struct quota_handle *h,
                ext2fs_free_mem(&dquot);
                return -1;
        }
-       v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap,
-                                              process_dquot, data);
+       ret = report_tree(dquot, QT_TREEOFF, 0, bitmap, process_dquot, data);
+       if (ret < 0)
+               goto errout;
+       v2info->dqi_used_entries = ret;
        v2info->dqi_data_blocks = find_set_bits(bitmap, info->dqi_blocks);
+       ret = 0;
+errout:
        ext2fs_free_mem(&bitmap);
        ext2fs_free_mem(&dquot);
-       return 0;
+       return ret;
 }
diff --git a/lib/support/quotaio_v2.c b/lib/support/quotaio_v2.c
index 38be2a34ffae..739066761022 100644
--- a/lib/support/quotaio_v2.c
+++ b/lib/support/quotaio_v2.c
@@ -175,6 +175,8 @@ static int v2_check_file(struct quota_handle *h, int type, 
int fmt)
 static int v2_init_io(struct quota_handle *h)
 {
        struct v2_disk_dqinfo ddqinfo;
+       struct v2_mem_dqinfo *info;
+       __u64 filesize;
 
        h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
                sizeof(struct v2r1_disk_dqblk);
@@ -185,6 +187,32 @@ static int v2_init_io(struct quota_handle *h)
                         sizeof(ddqinfo)) != sizeof(ddqinfo))
                return -1;
        v2_disk2memdqinfo(&h->qh_info, &ddqinfo);
+
+       /* Check to make sure quota file info is sane */
+       info = &h->qh_info.u.v2_mdqi;
+       if (ext2fs_file_get_lsize(h->qh_qf.e2_file, &filesize))
+               return -1;
+       if ((filesize > (1U << 31)) ||
+           (info->dqi_qtree.dqi_blocks >
+            (filesize + QT_BLKSIZE - 1) >> QT_BLKSIZE_BITS)) {
+               log_err("Quota inode %u corrupted: file size %llu; "
+                       "dqi_blocks %u", h->qh_qf.ino,
+                       filesize, info->dqi_qtree.dqi_blocks);
+               return -1;
+       }
+       if (info->dqi_qtree.dqi_free_blk >= info->dqi_qtree.dqi_blocks) {
+               log_err("Quota inode %u corrupted: free_blk %u; dqi_blocks %u",
+                       h->qh_qf.ino, info->dqi_qtree.dqi_free_blk,
+                       info->dqi_qtree.dqi_blocks);
+               return -1;
+       }
+       if (info->dqi_qtree.dqi_free_entry >= info->dqi_qtree.dqi_blocks) {
+               log_err("Quota inode %u corrupted: free_entry %u; "
+                       "dqi_blocks %u", h->qh_qf.ino,
+                       info->dqi_qtree.dqi_free_entry,
+                       info->dqi_qtree.dqi_blocks);
+               return -1;
+       }
        return 0;
 }
 
-- 
2.16.4

++++++ pre_checkin.sh ++++++
#!/bin/sh
sed -e 's/Name:.*/Name:           e2fsprogs-mini/' \
    -e 's/spec file for package.*/&-mini/' \
    -e 's/%define.*build_mini.*/%define build_mini 1/' e2fsprogs.spec > 
e2fsprogs-mini.spec
cp e2fsprogs.changes e2fsprogs-mini.changes

++++++ resize2fs-Make-minimum-size-estimates-more-reliable.patch ++++++
>From 1c580154d4e1ae3b4f13cf58a85f8a5ae792fbfc Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Fri, 18 Oct 2019 14:41:10 +0200
Subject: [PATCH] resize2fs: Make minimum size estimates more reliable for
 mounted fs
References: bsc#1154295

Currently, the estimate of minimum filesystem size is using free blocks
counter in the superblock. The counter generally doesn't get updated
while the filesystem is mounted and thus the estimate is very unreliable
for a mounted filesystem. For some usecases such as automated
partitioning proposal to the user it is desirable that the estimate of
minimum filesystem size is reasonably accurate even for a mounted
filesystem. So use group descriptor counters of free blocks for the
estimate of minimum filesystem size. These get updated together with
block being allocated and so the resulting estimate is more accurate.

Signed-off-by: Jan Kara <[email protected]>
Acked-by: Jan Kara <[email protected]>
---
 resize/resize2fs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index c2e10471bfd1..8a3d08db19f3 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -2926,11 +2926,11 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, 
int flags)
                        fs->super->s_reserved_gdt_blocks;
 
        /* calculate how many blocks are needed for data */
-       data_needed = ext2fs_blocks_count(fs->super) -
-               ext2fs_free_blocks_count(fs->super);
-
-       for (grp = 0; grp < fs->group_desc_count; grp++)
+       data_needed = ext2fs_blocks_count(fs->super);
+       for (grp = 0; grp < fs->group_desc_count; grp++) {
                data_needed -= calc_group_overhead(fs, grp, old_desc_blocks);
+               data_needed -= ext2fs_bg_free_blocks_count(fs, grp);
+       }
 #ifdef RESIZE2FS_DEBUG
        if (flags & RESIZE_DEBUG_MIN_CALC)
                printf("fs requires %llu data blocks.\n", data_needed);
-- 
2.16.4


Reply via email to