Commit Graph

88 Commits (master)

Author SHA1 Message Date
Theodore Ts'o f3bc1561c8 Fix FreeBSD pmake support
Fix a typo in the @ifNotGNUmake@ case of MCONFIG.in.

Also allow the FORCE_NATIVE_MAKE to force the use of the non-GNU make
optimized Makefile.  The resulting makefile will work with GNU Make
4.2.1, although "make V=1" won't be honored.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-04 00:16:35 -04:00
Theodore Ts'o c2ff6bac50 Fix "make gcc-wall" for library code
Commit fd1677e80: "Add --enable-hardening which builds e2fsprogs with
security hardening" broken the gcc warnings mode by changing how
CFLAGS were used to build static and shared library objects.

Also shut up GCC's whining about casting the return value from
dlsym(2) to function pointers --- since due to conflicing standards,
there is no way to use dlsym() without causing gcc to whine one way or
another.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 17:07:17 -04:00
Theodore Ts'o fd1677e801 Add --enable-hardening which builds e2fsprogs with security hardening
Enable the following security features: stack protection, fortify,
read-only relocation tables, immediate dynamic symbol binding, and
text segment ASLR by enabling position independent executable
(PIE).

Special handling is provided for shared library and statically linked
executables.  For all the gory details please see:

   https://lists.debian.org/debian-devel/2016/05/msg00302.html

Distributions who want to do their own special thing can set CFLAGS,
CFLAGS_SHLIB, CLFAGS_STLIB, LDFLAGS, LDFLAGS_SHLIB and LDFLAGS_STATIC
as appropriate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-22 01:58:09 -04:00
Theodore Ts'o ca82d22bed Fix FreeBSD portability problems
FreeBSD doesn't have libintl support built into the libc, and
libsupport requires libintl support.  So we need to make sure it is
available when we link against the libsupport library.

Also, work around *BSD's interesting interpretation of how
_XOPEN_SOURCE is supposed to work.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-21 23:43:41 -04:00
Theodore Ts'o f34af41b72 rename libquota.a to libsupport.a
We will be using libsupport.a for e2fsprogs's internal support
functions.  It will contain the quota support functions, but we will
also be moving code such as profile.c and plausible.c to libsupport.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-12 16:09:22 -04:00
Theodore Ts'o 9e8fcd6e01 configure: remove support to disable quota support
For the 1.43 release, quota support will be the default.  It's much
simpler if we don't try to make quota support optional.  This was done
originally because the quota feature wasn't fully tested.  It is now,
so we can remove this as an option.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-03 22:02:30 -04:00
Theodore Ts'o 5ea7aee425 rename configure.in to configure.ac
Some newer versions of autoconf kvetch if we are still using
configure.in.  As of this writing the only version of autoconf which I
support is autoconf 2.69, and if you try to recreate the configure
script which is shipped with e2fsprogs, and it breaks, you get to keep
both pieces.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-06-20 14:33:24 -04:00
Darrick J. Wong 81cbf1ef4f misc: add fuse2fs, a FUSE server for e2fsprogs
This is the initial implementation of a FUSE server based on
e2fsprogs.  The point of this program is to enable ext4 to run on any
OS that FUSE supports (and doesn't already have a native driver), such
as MacOS X, BSDs, and Windows.  The code requires FUSE API v28, which
is available in Linux fuse and osxfuse releases that are available as
of August 2013.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-06-10 20:07:48 -04:00
Theodore Ts'o ed9881bb6c MCONFIG: allow developers to override CFLAGS
Move other C compiler flags to ALL_CFLAGS so that CFLAGS only controls
the debugging and optimization flags.  This allows a developer to
build with "make CFLAGS=-g" in order to compile w/o optimization.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-21 15:35:21 -04:00
Darrick J. Wong b291c11f08 misc: use libmagic when libblkid can't identify something
If we're using check_plausibility() to try to identify something that
obviously isn't an ext* filesystem and libblkid doesn't know what it
is, try libmagic instead.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-20 23:42:19 -04:00
Darrick J. Wong 759c46cf45 debugfs: create journal handling routines
Create a journal.c with routines adapted from e2fsck/journal.c to
handle opening and closing the journal, and setting up the
descriptors, and all that.  Unlike e2fsck's versions which try to
identify and fix problems, the routines here have no way to repair
anything.

[ Modified by tytso to fold debugfs/jfs_user.h into e2fsck/jfs_user.h,
  so we don't have to copy recovery.c and revoke.c into debugfs. --tytso ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 16:44:10 -04:00
Theodore Ts'o 330cebc0e9 Merge branch 'maint' into next
Conflicts:
	debugfs/debugfs.c
	e2fsck/Makefile.in
	lib/ext2fs/Makefile.in
	tests/test_config
2014-09-11 12:40:43 -04:00
Michael Forney 60abcd7394 tests: Add to LD_LIBRARY_PATH instead of overriding
Signed-off-by: Michael Forney <forney@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-08 18:55:42 -04:00
Theodore Ts'o 7f7d1cb462 Merge branch 'maint' into next
Conflicts:
	debugfs/set_fields.c
	tests/f_mmp/script
	tests/f_mmp_garbage/script
	tests/m_mmp/script
	tests/t_mmp_1on/script
	tests/t_mmp_2off/script
2014-07-06 00:09:27 -04:00
Theodore Ts'o e7822c1f40 fix cross-compilation support
Commit 2500ebfc89 (util: fix make dependencies for subst) broke cross
compilation because it unconditionally used config.h without setting a
includes path so that the config.h file could be found.

The proposed fix of adding the include path (such as was proposed at
http://patchwork.ozlabs.org/patch/355662/ or in Debian Bug #753375)
isn't really the right way to go, since the information in config.h is
for the target environment, and not the build environment.  So using
config.h when building helper programs used as part of the build can
potentially cause more problems than it solves.

In general, build helpers must be written to be as portable as
possible, and to not require any autoconf defined #ifdef's whenever
possible.  The subst program broke this rule to (1) address a Coverity
security complaint by using futimes(2) instad of utimes(2) if present,
and (2) to preserve the nanosecond portion of the file timestamp.

Oh, well.  We won't be able to do the latter when cross compiling, and
as to the former, if an attacker has write access to your build tree
while you are building programs that will be run as root, you've got
bigger problems.  :-)

Fix the problem that commit 2500ebfc89 was trying to address by
explicitly adding @DEFS@ to CFLAGS, so that -DHAVE_CONFIG_H is passed
to make depend.  This fixes up the make depend without forcing the use
of config.h when cross-compiling.

Addresses-Debian-Bug: #753375
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Tested-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Cc: Helmut Grohne <helmut@subdivi.de>
Cc: 753375@bugs.debian.org
2014-07-05 20:49:52 -04:00
Eric Sandeen 2f8d025196 e2fsprogs: remove checker infrastructure
Per http://www.gnu.org/software/checker/ the gcc "-checker" option
is long deprecated.  Nuke it from e2fsprogs.

Most people would never hit this, but people who love to turn knobs,
such as the reporter of kernel.org bz#74171, might run into it and be
sad.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-04 23:59:30 -04:00
Theodore Ts'o 6bb8845953 Merge branch 'maint' into next
Conflicts:
	debugfs/debugfs.c
2014-05-27 12:38:23 -04:00
Theodore Ts'o ceff962c67 tst_libext2fs: add new debug program which used for libext2fs unit tests
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-05-27 12:14:27 -04:00
Darrick J. Wong a46300fe70 misc: create better-packaged static analysis reports
Fix some minor bugs relating to passing CFLAGS to cppcheck, and
package the cppcheck output into nicer looking reports.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-11 18:32:07 -04:00
Theodore Ts'o c9bc7484cc Merge branch 'maint' into next
Conflicts:
	e2fsck/pass1.c
2014-05-11 18:30:11 -04:00
David Michael 4e2d9f7f4e Add a make variable for the pkgconfig install dir
Adding the pkgconfigdir variable allows specifying an installation
location for pkg-config files independent of libdir.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-05-07 10:51:50 -04:00
Darrick J. Wong f1605243a4 all: Introduce cppcheck static checking for make C=1
Introduce more static checking via cppcheck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-03-14 09:32:50 -04:00
Theodore Ts'o fedfb27fe5 Add coverage testing using gcov
To check the coverage of e2fsprogs's regression test, do the
following:

	configure --enable-gcov
	make -j8 ; make -j8 check ; make coverage.txt

The coverage information will be the coverage.txt and *.gcov files in
the build directories.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-02-23 00:17:09 -05:00
Theodore Ts'o 6c59a665da configure: fix --with-diet-libc
Newer versions of autoconf pull in AC_PROG_GCC as part of
AC_CANONICAL_HOST.  So we need check for WITH_DIET_LIBC earlier in
configure.in.

Also, e2fsprogs now needs functions which are found in diet libc's
compat library.  So add support for autoconf's LIBS function, and
automatically set libs to include -lcompat.

Finally, disable compiling e4defrag by deault if --with-diet-libc is
specified because the program has too many glibc dependencies.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-01-05 22:58:16 -05:00
Theodore Ts'o 5f16f6c337 Fix optional static code analysis using sparse
Commit 832cb612: "e2fsprogs: add (optional) sparse checking to the
build" breaks systems that are not using GNU make.  In addition, it
breaks if the developer tries to build in a subdirectory (i.e., if he
or she tries running "make" in the misc or e2fsck or lib/ext2fs
directory), since CHECK_CMD is not set.

Fix this by moving the sparse setup to MCONFIG.

Cc: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-10-23 20:09:12 -04:00
Theodore Ts'o c1986ecb6f Fix blhc (Build Log Hardening Check) warnings
The Build Log Hardening Check is a debian tool which scans the output
of a package build making sure that the security hardening flags are
used when compiling and linking all of binaries in a package.

For the most part we were passing CFLAGS, CPPFLAGS, and LDFLAGS down
to the compiler and link commands, but there there were one or two
exceptions.  In addition, there where a few places in "make install"
where the V=1 option was not being honored, which triggered blhc
warnings since it couldn't analyze those commands.

The e2fsck.static was the only binary that was not getting built and
packaged with the hardening flags, but I've fixed all of the blhc
warnings so in the future it will be obvious if we regress.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-06-13 16:06:44 -04:00
Theodore Ts'o 183c73b026 Teach build system to install relative symlinks if requested
Add a configure option, --enable-relative-symlinks, which will use
relative symlinks for the ELF shared library files.

Addresses-Sourceforge-Bug: #3520767

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-05-12 23:34:33 -04:00
Theodore Ts'o 8f9d708f6a libquota: only build a static library
Since the libquota library has namespace contamination issues, don't
build a shared library and link against it statically.  Don't include
it as part of the Debian packages.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-19 13:39:38 -04:00
Theodore Ts'o d1154eb460 Shorten compile commands run by the build system
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18 17:34:37 -04:00
Aditya Kali f239fefc14 e2fsprogs: add quota library to e2fsprogs
This patch adds the quota library (ported form Jan Kara's quota-tools) in
e2fsprogs in order to make quotas as a first class supported feature in Ext4.
This patch also provides interface in lib/quota/mkquota.h that will be used by
mke2fs, tune2fs, e2fsck, etc. to initialize and update quota files.
This first version of the quota library does not support reading existing quota
files. This support will be added in the near future.
Thanks to Jan Kara for his work on quota-tools. Most of the files in this patch
are taken as-is from quota tools and were simply modified to work with
libext2fs in e2fsprogs.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-08-31 15:21:40 -04:00
Theodore Ts'o 9b3018a82e e2fsck: catch termination signals and print information about them
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-08-11 14:56:49 -04:00
Theodore Ts'o 5f70f2e647 MCONFIG: Fix dependency definitions for the static and profiled blkid library
The dependency definitions for DEPSTATIC_LIBBLKID and
DEPPROFILED_LIBBLKID incorrectly referenced the non-dependency macros
(i.e., STATIC_LIBUUID instead of DEPSTATIC_LIBUUID).  This resulted in
-luuid showing up as a Makefile dependency, which is of course wrong.

Addresses-Debian-Bug: #604629

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-11-26 19:35:10 -05:00
Theodore Ts'o 5aa6c3f61c Add configure options --enable-symlink-build and --enable-symlink-install
These options allow e2fsprogs to be built using symlinks instead of
hard links, and to be installed using symlinks instead of hard links,
respectively.

Addresses-Sourceforge-Bug: #1436294

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-17 19:21:42 -04:00
Theodore Ts'o bcb915b0d0 Enhance build system so that "make V=1" works like the Linux Kernel
If gmake is available, the developer can use "make V=1" instead of
using a configure-time switch, --enable-verbose-makecmds, to see all
of the commands executed by the Makefile.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-02 18:19:10 -04:00
Theodore Ts'o c13351f6c5 Add support for configure --enable-verbose-makecmds
Some people don't want to see the concise "kernel-style" make output.
This configure option allows build engines that want to see the full
set of commands executed by the makefile to get what they want.  Most
people will find this more distracting than useful, unless they need
to debug the Makefiles.

(It is not necessary to rerun configure to enable this verbose make
output temprarily; if a developer wants to do a quick debug of a
directory's makefile, he or she can simply edit the definition of the
$(E) and $(Q) variables in the Makefile; instructions can be found in
the MCONFIG file which is included in at the beginning of every
Makefile.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-02 00:11:17 -04:00
Theodore Ts'o a6a1c0815c Fix Makefile dependencies for libcom_err
The e2fsprogs makefiles were using the same Makefile variable
LIBCOM_ERR for the link-line arguments as well as the dependencies.
Since LIBCOM_ERR can now include non-file arguments such as
"-lpthread", we need to use a separate DEPLIBCOM_ERR variable that
only has build file dependencies.

Do the same thing for STATIC_LIBCOM_ERR and PROFILED_LIBCOM_ERR.

Addresses-Sourceforge-Patches: #2813809

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-01 22:06:51 -04:00
Theodore Ts'o 4a1e15a8ba Fix compilation problem when building with --disable-uuid
The MCONFIG.in file used $(LIBUUID) in the definition of DEPLIBBLKID,
when it should have used $(DEPLIBUUID) instead.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-01 17:20:24 -04:00
Scott James Remnant 39fd3d4f13 configure.in: add --disable-libuuid option
Add an option to switch between the private (in-tree) libuuid and
public (in-system installed) library.  The private version is still
enabled by default.

Signed-off-by: Scott James Remnant <scott@netsplit.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-06-29 00:36:45 -04:00
Theodore Ts'o 14b596d409 configure.in: add --disable-libblkid option
Add an option to switch between the private (in-tree) libblkid and
public (in-system installed) library.  The private version is still
enabled by default.

If --disable-libblkid is specified the findfs(8) program, which is a
variant of tune2fs, is also not built or installed.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-04-22 09:18:30 -04:00
Theodore Ts'o ad64399d15 Add support to build profiled binaries in the misc directory
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-11-15 12:34:28 -05:00
Theodore Ts'o 992a2f7f68 e2fsck: Fix build of e2fsck.profiled if profiling is enabled
It's been a while since I've done a build using "configure
--enable-profile", and some bitrot had set into the Makefiles...

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-11-15 12:12:57 -05:00
Theodore Ts'o d7f45af802 libcom_err: Use sem_post/sem_init to prevent race conditions
SuSE has been carrying a patch for a long time to prevent a largely
theoretical race condition if a multi-threaded application adds and
removes error tables in multiple threads.  Unfortunately SuSE's
approach breaks compatibility by forcing applications to link and
compile with the -pthread option; using pthread mutexes has
historically been problematic.

This commit fixes things in a more portable way by using
sem_post/sem_wait instead, which is an older interface that doesn't
require the pthreads library.  Linux happens to implement
sem_post/sem_init using futexes, and -lrt ends up pulling in
-lpthread, but the advantage of using POSIX semaphores is that
applications don't have to be built using -pthread, unlike the use of
pthread mutexes.

The add_error_table() and remove_error_table() interfaces are the
preferred interfaces and locking protection have been added to only
these interfaces.  I have not added locking protection to the
generated initialize_xxx_error_table and initialize_xxx_error_table_r
interfaces, to avoid adding symbol dependencies that would cause a
library to fail to work when linking against older com_err libraries
that do not export et_list_lock() and et_list_unlock().  Threaded
applications shouldn't be using these interfaces in any case.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-12 10:15:26 -04:00
Theodore Ts'o 29551cacca Fix e2initrd_helper, blkid, and fsck from linking with unneeded libraries
... especially when using ELF shared libraries.  We only need to link
with a library if the executable uses that library directly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-04 22:39:20 -04:00
Theodore Ts'o 55da987650 Improve ELF shared library handling
Pass in -rpath-link option to the linker so that blkid will build
correctly on systems that don't have libcom_err.so.2 installed.

Fix debugfs to only try to link with -ldl when building without shared
libraries; with ELF shared libraries, the library which requires -ldl
(libss.so) can required the library dependency itself.

Fix how we build tune2fs.static so that we use @LDFLAG_STATIC@, via
$(LDFLAGS_STATIC), instead of hard-coding the use of -static.

Addresses-Sourceforge-Bug: #2088537

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-02 23:12:38 -04:00
Theodore Ts'o 7515a74478 Remove use of devmapper library by the blkid library
The devmapper library is no longer needed given commit f4e89bcd.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-26 23:56:00 -04:00
Theodore Ts'o 9d99416ea3 Fix dependency for $(LIBSS) when an explicit dlopen() library is needed
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-07 21:53:35 -04:00
Theodore Ts'o daf7a6e5d1 Fix tst_extents build when building w/o dynamic libraries
$(LIBSS) should automatically include @DLOPEN_LIB@ so the right thing
happens for programs that need to use the ss library.

Reorder the library link order for tst_extents since the blkid library
uses libuuid functions.

Thanks to Eric Sandeen for pointing this problem out!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-17 16:56:09 -04:00
Theodore Ts'o a4ece35911 Use pkg-config to determine where to find the devmapper library
Fedora and Red Hat puts the devmapper library in different locations
compared to Debian, so we use pkg-config.  Unfortunately Debian's
devmapper.pc file is buggy (See Debian Bug #390243), so we have to
work around it.

Historically, e2fsprogs has tried not to depend on pkg-config, since
its answers are so often **wrong** (the Debian bug has been ignored
for over a year), so I'm hoping I'm not going to regret this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-03 12:36:59 -05:00
Theodore Ts'o 19c000e816 Update WFLAGS to suppress spurious warning messages
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-11-14 23:40:19 -05:00
Theodore Ts'o b6b65c3de4 Add datarootdir definition for compatibility with autoconf 2.60
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-10-22 00:14:26 -04:00