Commit Graph

75 Commits

Author SHA1 Message Date
Alyssa Ross
6cbb0684c2 configure: add SIZEOF_TIME_T to public_config.h
This has recently started being used by ext2fs.h.  Other users of the
ext2fs.h header would always get the 32-bit versions of the
__encode_extra_time, __decode_extra_sec, and __sb_set_tstamp; and the
64-bit version of __sb_get_tstamp, due to the SIZEOF_TIME_T macro
being undefined and treated as zero.

Fixes: 5b599a32 ("Fix 32-bit build and test failures")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Link: https://lore.kernel.org/r/20240527074121.2767083-1-hi@alyssa.is
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2024-10-24 18:41:19 -04:00
Theodore Ts'o
9ebb163c44 configure: remove duplicated/unnecessary test for compiler fuzzing support
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2024-05-04 23:56:12 -04:00
Theodore Ts'o
7272a97244 configure: add --without-libarchive option
Teach configure the --without-libarchive option, which forcibly
disables use of the libarchive library.

The option --with-libarchive=direct will disable the use of dlopen,
and will link mke2fs with -larchive directly.  This doesn't work when
building mke2f.static, since -larchive has a large number of
depedencies, and even "pkgconf --libs --static libarchive" doesn't
provide all of the appropriate library dependencies.  :-(

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2024-04-29 01:23:29 -04:00
Theodore Ts'o
784c469575 configure: Use FORTIFY_SOURCE=3 when hardening is enabled
FORTIFY_SOURCE=3 provides much more robust checks for buffer overruns
and other memory bugs[1].  It requires gcc 12 and glibc 2.34 which
should be available on most modern distributions (which are the ones
that use --enable-hardening).

[1] https://developers.redhat.com/articles/2022/09/17/gccs-new-fortification-level

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2024-04-25 13:23:55 -04:00
Theodore Ts'o
4b819954e8 Merge branch 'support-fuse3' of https://github.com/DrDaveD/e2fsprogs into next 2024-04-21 01:03:35 -04:00
Theodore Ts'o
ddf8d89ae0 Merge remote-tracking branch 'josch/libarchive' into josch-libarchive 2024-04-18 15:02:49 -04:00
Johannes Schauer Marin Rodrigues
7e3a4f0a33
mke2fs: the -d option can now handle tarball input
If archive.h is available during compilation, enable mke2fs to read a
tarball as input. Since libarchive.so.13 is opened with dlopen,
libarchive is not a hard library dependency of the resulting binary.

In comparison with feeding a directory tree to mke2fs via -d this has
the following advantages:

 - no superuser privileges, nor fakeroot, nor unshared user namespaces
   are needed to create filesystems with arbitrary ownership information
   and special files like device nodes which otherwise require being root

 - by reading a tarball from standard input, no temporary files need to
   be written out first as mke2fs can be used as part of a shell pipeline
   which reduces disk usage and makes the conversion independent of the
   underlying file system

A round-trip from tarball to ext4 to tarball yields bit-by-bit identical
results

Signed-off-by: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
2024-04-18 11:02:09 +02:00
Mike Gilbert
fed000ae01 configure.ac: call AC_SYS_LARGEFILE before checking the size of off_t
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
Link: https://lore.kernel.org/r/20231107233323.2013334-1-sam@gentoo.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2024-04-04 11:01:07 -04:00
Dave Dykstra
448a3f8b48 add libfuse3 support to fuse2fs 2023-12-20 15:19:20 -06:00
Andreas Dilger
1ac0061609 build: split version and release in configure
Update configure.ac to separate Version from Release if there is
a '-' in version.h::E2FSPROGS_VERSION (e.g. "1.46.6-rc1").
Otherwise, the '-' in the version can make RPM building unhappy.

Simplify the generation of E2FSPROGS_VERESION, E2FSPROGS_DATE and
E2FSPROGS_DAY to avoid multiple grep/awk/sed/tr stages.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Link: https://lore.kernel.org/r/1683694677-9366-1-git-send-email-adilger@dilger.ca
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2023-12-01 11:06:26 -05:00
Eric Biggers
5598a968f3 e2freefrag: don't use linux/fsmap.h when fsmap_sizeof() is missing
Work around an issue with the Android NDK where its copy of
linux/fsmap.h is missing the inline functions fsmap_sizeof() and
fsmap_advance().  This was causing an error when building e2fsprogs
using the Android NDK, using the autotools-based build system.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2023-05-30 15:56:38 -04:00
Khem Raj
a22e7f16d0 Add option to enable/disable largefile support
fallocate can be used to have 64bit off_t provided its compiled with
_FILE_OFFSET_BITS=64 which will be added automatically when
--enable-largefile is used.

[ Run autoreconf to update configure and config.h.in -- TYT ]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2023-02-01 11:20:40 -05:00
Eric Biggers
b3d180e205 configure.ac: automatically add include/mingw/ headers
Since the include/mingw/ directory needs to be on the include path when
building for Windows with MinGW, add it to INCLUDES automatically, and
AC_DEFINE the corresponding HAVE_*_H constants.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2023-01-27 12:06:30 -05:00
Eric Biggers
f7581137f8 configure.ac: disable tdb by default on Windows
The tdb support does not build for Windows, due to the use of various
UNIX-isms, so disable it by default when building for Windows.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2023-01-27 12:06:29 -05:00
Eric Biggers
52fc14ffdc configure.ac: only use Windows I/O manager on native Windows
Cygwin and MSYS2 are UNIX-compatible platforms on top of Windows, so
they should use the UNIX I/O manager, not the Windows I/O manager.

(Note that "cygwin" was misspelled as "cigwin", so the code did not have
the intended effect anyway.)

Fixes: d1d44c146a ("ext2fs: compile the io implementation according to os")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2023-01-27 12:06:29 -05:00
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