Commit Graph

60 Commits

Author SHA1 Message Date
Theodore Ts'o
4e5f24ae42 Use an autoconf test to detect for a BSD- or GNU-style qsort_r function
BSD is planning on changing their qsort_r() implementation to align
with the POSIX/GNU-style qsort_r() function signature.  So use an
autoconf test to determine which qsort_r() a system has.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-09-22 20:10:19 -04:00
Theodore Ts'o
2869485be9 Build the fuzzers from oss-fuzz
The fuzzers from oss-fuzz in projects/e2fsprogs/fuzz (as of commit
78ecd3f07fca with some slight modifications for better error
reporting) have been placed in the tests/fuzz directory and the
configure script now supports a new option --enable-fuzzing which will
build these fuzzers using clang's -fsanitize=fuzzer command line
option.

In general, some sanitizer such as --enable-addrsan or --enable-ubsan
(to enable ASAN or UBSAN, respectively) should be enabled alongside
--enable-fuzzing.

A typical configure command to build the fuzzers might be:

  configure CC=clang CXX=clang++ CFLAGS=-g --enable-fuzzing --enable-addrsan

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-08-09 19:45:07 -04:00
Theodore Ts'o
54445dc254 Update configure/configure.ac/aclocal.m4 to use autoconf 2.71
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-08-07 19:49:33 -04:00
Lukas Czerner
97079a792d Use mallinfo2 instead of mallinfo if available
mallinfo has been deprecated with GNU C library version 2.33 in favor of
mallinfo2 which works exactly the same as mallinfo but with larger field
widths. Use mallinfo2 if available.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-04-28 13:13:56 -04:00
Theodore Ts'o
39ace91b8e libuuid: try to use getrandom() or getentropy() if available
If getrandom() or getentropy() is available, use these interfaces in
favor of opening /dev/[u]random.  This avoids a potential TSAN problem
that could potentially cause a fd leak when trying to open
/dev/urandom.  (Which is not a disaster, but these interfaces are more
foolproof and avoids needing to open a file descriptor in a library,
which is a good thing.)

Addresses-Google-Bug: #198050608
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-12-21 14:28:51 -05:00
Paulo Antonio Alvarez
d1d44c146a ext2fs: compile the io implementation according to os
In mingw and cygwin, compile the windows_io manager, compile the unix_io
everywhere else.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-03-31 16:09:23 -04:00
Theodore Ts'o
8c9e2921ec configure.ac: convert all help strings to use AS_HELP_STRING
Some help strings were using the deprecated AC_HELP_STRING, and others
were completely hard-coded.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 15:54:12 -05:00
Theodore Ts'o
24487a7fa6 configure.ac: fix build failure on systems with pthreads && !fuse support
The configure script checks for pthread.h as part of double-checking
that the FUSE support works correctly, which implicitly defined
HAVE_PHREAD_H.  If the FUSE libraries are not present (or fuse support
is explicitly disabled), this check doesn't happen and so
HAVE_PTHREAD_H is not defined, and this causes a build failure.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-29 22:28:31 -05:00
Theodore Ts'o
35b67cab5c e2fsck: drop use of sysctl(2)
Remove the use of the binary interface using the sysctl(2) system call
since sys/sysctl.h has been deprecated.  We can find the total memory
available in the system using the POSIX standard sysconf(2) interface.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-29 01:10:29 -05:00
Theodore Ts'o
3fb16e7424 configure.ac: add substitution for @mkdir_p@ since po/Makefile.in.in uses it
Fixes: e598c29b4d ("Update gettext files to version 0.19.8")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-29 01:10:18 -05:00
Theodore Ts'o
bdcd5f2220 Add configure and build support for the pthreads library
Support for pthreads can be forcibly disabled by passing
"--without-pthread" to the configure script.

The actual changes in this commit are in configure.ac and MCONFIG.in;
the other files were generated as a result of running aclocal,
autoconf, and autoheader on a Debian testing system.

Note: the autoconf-archive package must now be installed before
rerunning aclocal, to supply the AX_PTHREAD macro.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21 10:50:40 -05:00
Theodore Ts'o
e598c29b4d Update gettext files to version 0.19.8
This also removes the built-in "intl" directory as this is now
considered deprecated by the gettext package.  This means that we
won't try to use an internal version of gettext if it's not installed
on the build system.  We will simply disable NLS support in that case.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-11-25 11:55:46 -05:00
Theodore Ts'o
7b8253ba09 Merge branch 'maint' into next 2020-10-01 17:13:27 -04:00
Jan Kara
f4979dd566 mke2fs: Warn if fs block size is incompatible with DAX
If we are creating filesystem on DAX capable device, warn if set block
size is incompatible with DAX to give admin some hint why DAX might not
be available.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01 16:51:46 -04:00
Theodore Ts'o
b9e66a187f e2fsck: add a developer-only extended option: clear_all_uninit_bits
This option clears the uninitialized bit on all extents of all inodes.
Note that this can end up exposing uninitialized data to userspace.
It should only used in very specialized situations.

This option is only enabled via a new configure flag,
--enable-developer-features.  It should *not* be enabled by
distributions, as it enables features thare only designed for use by
ext4 developers.  These features have no documentation in the man
page, or regression tests, and if it breaks, you get to keep both
pieces.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-08-15 14:41:13 -04:00
Theodore Ts'o
188bf39acf configure: fix test where cron is not installed on a non-systemd system
Reported-by: thomas@linuxfromscratch.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-05-27 15:10:31 -04:00
Theodore Ts'o
2fe97b2bd0 Merge branch 'old-maint' into maint 2019-03-07 16:18:10 -05:00
Dongyang Li
f72ea2deb0 Fix autoheader warnings
autoheader complains after 1.44.6 release:
autoheader: warning: missing template: HAVE_BLKID_PROBE_ENABLE_PARTITIONS
autoheader: Use AC_DEFINE([HAVE_BLKID_PROBE_ENABLE_PARTITIONS], [], [Description])
autoheader: warning: missing template: HAVE_BLKID_PROBE_GET_TOPOLOGY

This could fail automatic rpm builds.
Fixes: 7154d97 ("Check for the newer blkid functions without adding blkid to @LIBS@")

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-03-07 16:09:20 -05:00
Theodore Ts'o
a935b93dca Merge branch 'maint' into next 2019-02-10 21:50:26 -05:00
Theodore Ts'o
7154d974b2 Check for the newer blkid functions without adding blkid to @LIBS@
If we are using the system-provided blkid, check for the newer blkid
functions without adding -lblkid to @LIBS@.  This prevents programs
(like badblocks) which don't use the blkid library getting linked
against it.

Addresses-Debian-Bug: #919958
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-02-10 21:44:05 -05:00
Nicholas Clark
ea1a3fa2fd fuse2fs: add fakeroot option.
Add a new 'fakeroot' option to fuse2fs. When enabled, fuse2fs will
will pretend to be root when checking file permssions. This allows
fuse2fs to be used for building/modifying rootfs images as an
unprivileged user.

As per the maintainer's request, nosuid and nodev are automatically
enabled when fakeroot is selected (on platforms that support them)
to help prevent accidental misuse.

Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-10-16 15:37:45 -04:00
Theodore Ts'o
62dfbc0fb2 Merge branch 'maint' into next 2018-10-04 10:39:50 -04:00
Theodore Ts'o
feb235e081 For --enable-subset, change "make install" so it implies "make install-libs"
The e2fsprogs-libs-1.44.x.tar.gz subset distribution had a hack so
that "make install" would install the libraries via an implied "make
install-libs" --- since after all the tarball had was just the
libraries.

This commit makes "make install" behave the same was as the
e2fsprogs-libs distribution in the case of "configure --enable-subset"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-24 17:12:20 -04:00
Theodore Ts'o
6ac81e4526 Merge branch 'maint' into next 2018-08-18 23:22:53 -04:00
Theodore Ts'o
0afb9be6aa Drop subset tarball and replace it with "configure --enable-subset"
There's no point creating two separate tarfiles.  It's not clear
anyone was actually using the subset tarball --- and if they are, they
can replace it by the full source distribution and using the
--enable-subset option.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-18 11:21:30 -04:00
Theodore Ts'o
e5f0f3eebe Stop generating e2fsprogs.spec automatically
It adds extra complexity for not much gain, and stands in the way of
generating the release tarfile via git archive.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-18 11:06:23 -04:00
Theodore Ts'o
139a30928a configure: don't enable LTO by default
Not all compilers (or versions of compilers) use the same LTO options
or behave the same way with LTO.  In particular, using clang and the
current LTO options cause the build to fail.  We should probably fix
up the configure script to handle Clang and LTO, but for now, we won't
enable LTO unless the user explicitly passes --enable-lto to the
configure script.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-17 22:26:24 -04:00
Theodore Ts'o
2ca70c2253 Merge branch 'maint' into next 2018-08-13 22:40:15 -04:00
Ross Burton
5abc041492 build: use MKDIR_P instead of MKINSTALLDIRS
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-11 15:29:48 -04:00
Theodore Ts'o
4971570449 Fix LTO builds so debugging information is preserved
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 22:16:07 -04:00
Darrick J. Wong
bcca786b83 enable thread sanitizer if the builder wants it
Enable the gcc/clang thread data corruption sanitizer if the builder
requests it and it's available.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 11:16:15 -04:00
Darrick J. Wong
5e666e3d88 enable gcc/clang address sanitizer if the builder wants it
Enable AddressSanitizer to look for memory usage errors if the builder
asks for it and it's available.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 11:16:12 -04:00
Darrick J. Wong
1c2a76aeb0 enable UBSAN if the builder wants it
Enable the undefined behavior sanitizer (ubsan) if the builder requests
it and it's available.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 11:16:09 -04:00
Darrick J. Wong
4aece3281e enable link time optimization, if requested
Enable link time optimization (LTO) if the builder requests it.  The
extra link optimization results in smaller binaries.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 11:16:03 -04:00
Darrick J. Wong
a2df58945c e2scrub: add service (cron, systemd) support
Add the ability to run the e2scrub utilities as a periodically scheduled
system service.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 14:59:40 -04:00
Darrick J. Wong
5ce368f07c e2scrub: create online fsck tool of sorts
Implement online fsck for ext* filesystems which live on LVM-managed
logical volumes.  The basic strategy mirrors that of e2croncheck --
create a snapshot, fsck the snapshot, report whatever errors appear,
remove snapshot.  Unlike e2croncheck, this utility accepts any LVM
device path, knows about snapshots running out of space, and can call
fstrim having validated that the fs metadata is ok.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 14:43:12 -04:00
Shuichi Ihara
32b8802aa5 misc: add e2mmpstatus utility via dumpe2fs
e2mmpstatus is a Multi-Mount Protection (MMP) helper utility to read
an MMP block to see if it is being updated.  It can also output the
latest update time, nodename, and device from the MMP block.

This is useful for HA and other maintenance scripts to determine if
the filesystem is in use on another node, and which node it is.

Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>

Moved e2mmpstatus checking/dumping code to be part of dumpe2fs rather
than a standalone program, using the "-m" option to check MMP status,
and "-i" to dump info.  If dumpe2fs is called as "e2mmpstatus" (and
also "mmpstatus" for compatibility reasons), assume "-m" is specified.

Re-use the existing MMP block handing routines (with some changes) to
check and dump the MMP block, rather than adding duplicate versions.

Modify dumpe2fs to exit with a non-zero error code if there is an
error while reading the filesystem metadata or MMP block, or if
"-m" is used with the "mmp" feature and is in use by another node.

Add a configure check for gethostname() rather than depending on
_BSD_SOURCE or _XOPEN_SOURCE to be set.

Update the f_mmp, m_mmp, m_mmp_bad_csum, and m_mmp_bad_magic tests
to use e2mmpstatus to check and dump the MMP state before and after
e2fsck is run to verify that the tool is working correctly.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-22 18:22:37 -04:00
Theodore Ts'o
3829c16c10 Merge branch 'maint' into next 2017-12-12 23:45:02 -05:00
Dmitry V. Levin
d7de3f3d13 Fix compilation warnings about functions declared in sys/xattr.h
attr commit v2.4.47-34-g7921157 removes <attr/xattr.h>
and syscall wrappers with the following wording:
"The xattr syscalls are provided by glibc since ages [...]
This removes the need for the <attr/xattr.h> header;
use <sys/xattr.h> instead."

Check for <sys/xattr.h> and include it to fix the following compilation
warnings:

create_inode.c: In function 'set_inode_xattr':
create_inode.c:136:9: warning: implicit declaration of function 'llistxattr' [-Wimplicit-function-declaration]
create_inode.c:172:16: warning: implicit declaration of function 'lgetxattr' [-Wimplicit-function-declaration]

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-12-12 23:02:58 -05:00
Theodore Ts'o
69ab815dbe Merge branch 'maint' into next 2017-10-15 23:20:53 -04:00
Sebastian Rasmussen
055866d84d Fix typos in code comments and developer docs
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
2017-10-15 23:00:11 -04:00
Theodore Ts'o
58a31b508e Merge branch 'maint' into next 2017-08-29 08:03:31 -04:00
Matthias Andree
ec3a69bbb0 Search for GNU-compatible dd for self-tests.
This checks for a dd that supports iflag=fullblock oflag=append,
and looks at gdd and dd for now, and warns of failing self-tests
if neither supports these two flags.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-08-29 01:05:58 -04:00
Theodore Ts'o
fed2dbdc64 Merge branch 'maint' into next 2017-07-27 20:07:22 -04:00
Theodore Ts'o
cfb8e0bd85 Fix build when configured with --disable-threads
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-07-27 19:43:00 -04:00
Darrick J. Wong
82424fc6bb e2freefrag: use GETFSMAP on mounted filesystems
Use GETFSMAP to query mounted filesystems for free space information.
This prevents us from reporting stale free space stats if there happen
to be uncheckpointed block bitmap updates sitting in the journal.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-05-29 22:29:15 -04:00
Adrien Schildknecht
f47f319585 AOSP: android: libext2fs and com_err for windows
Test: m libext2fs-host && m libext2_com_err-host

Change-Id: I92b6717b617a4f7f16182bf12af58cb22f20fa8f
From AOSP commit: 1538eb4c580d53657f82e4e0170ca5ad5b67455c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-05-23 22:47:23 -04:00
Theodore Ts'o
ca1de98a8b Fix spurious error when both gmake and makeinfo are not available
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-11 23:30:25 -04:00
Theodore Ts'o
a2143b5160 Fix build reproducibility for mk_cmds and compile_et
The mk_cmds and compile_et scripts include the build directory, which
breaks the build reproducibility goal of Debian.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 22:25:22 -04:00
Gustavo Zacarias
62bc243f1b fuse2fs: might need librt
It uses clock_gettime() which in older glibc versions is in librt.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-09 16:56:15 -04:00