Avoid a potential out-of-bounds memory access if the group passed to
ext2fs_clear_block_uninit() or ext2fs_clear_inode_uninit() is greater
than the number of groups in the file system. This prevents a failure
in resize2fs when to allocate a block when growing the file system
significantly.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Hurd and *BSD is not going to have FS_IOC_FIEMAP, at least not at
Linux's codepoint.
Addresses-Debian-Bug: #822576
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fix resize2fs so that the location of the backup superblocks when the
sparse_super2 feature is enabled is properly set when growing the file
system from a single block group to larger file system sizes.
Also fix a bug where the block group summary statistics in some cases
when exapnding a sparse_super2 file system.
Finally, accurately calculate the file system metadata overhead of the
last block group in sparse_super2 file systems.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Some users will get confused and try to specify multiple -O options.
So teach mke2fs to treat "-O feature1 -O feature2" as
"-O feature1,feature2".
https://bugzilla.kernel.org/show_bug.cgi?id=117421
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The lib/support library is only used for internal e2fsprogs programs,
and it won't compile correctly due to the fact that lib/ext2fs isn't
included in the e2fsprogs-libs distribution anyway.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Commit 2d2d799c72 tried to use parse_quota_options(), which uses
commas to separate out the quota types. Unfortunately, when parsing
extended options, commands are used to separate different extended
options.
To fix this, I've add a new support function parse_quota_type(), which
allows either commas or colons to used as a separator character, and
which manipulates a bit field to indicate which quota types should be
enabled. Eventually tune2fs should be converted to use
parse_quota_type() as well, thus obsoleting parse_quota_options(), but
that's a more complicated cleanup patch for later.
Fix a lint warning which could the number of blocks to be incorretly
printed if it exceeds 2**32.
Also fix some typos and other minor bugs in the usage message.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If the user specifies an offset using -E offset without specifying an
explicit size, the system will use the block device (or file) size as
the default file system size. If we are using the default file system
size, subtract out the offset so the resulting file system will stay
within the block device. Also print a warning that this might not be
what the user wants.
Addresses-Debian-Bug: #803629
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If the sources for e2fsprogs are located in a pathname that contains a
tilde character (which can happen when the sources are unpacked using
"apt-get source" when e2fsprogs has a pre-release test version),
texi2dvi will fail due to a bug (Debian bug #822492: "texinfo:
texi2dvi doesn't protect the ~ character in the second pass"). Work
around this bug by using texi2dvi --clean.
Addresses-Debian-Bug: #822227
Reported-by: svante.signell@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Since e2image is used to capture broken fs images for debugging,
ignore checksum errors when creating the image.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Update the tests to match with the new behavior and error messages
Also fix test_one so that it doesn't print the failed test output in
the case where the script does not exist.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If e2fsck_run_ext3_journal() returns an error indicating that a CRC
error was detected, we shouldn't abort, but instead proceed so the
file system can be fixed.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If the UUID field is NULL, e2fsck will try to generate and set a new
UUID. This will cause massive problems if the metadata_csum feature
is set, so avoid doing so in that case.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Sync up with kernel commit 6a797d27: "ext4: call out CRC and
corruption errors with specific error codes".
This allows us to distinguish between CRC errors and I/O errors.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Commit c8ee0d60 fixed most of these, but missed this one.
# e2image -r -p <device> - > imagefile
leads to a corrupted image due to the "Scanning inodes..."
printf going to stdout.
Reported-by: Alex Markley <alex@malexmedia.net>
Addresses-Red-Hat-Bugzilla: #1327329
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Configure the io channel with the specified offset before
calling mke2fs_discard_device(). Otherwise the data before offset
is discarded.
Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Added offset support to the following functions:
- unix_cache_readahead
- unix_discard
- unix_zeroout
Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Test that mke2fs does not modify any data before the offset and
after the end of the filesystem.
Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
When calculating time diffs, use difftime() instead of risking
integer overflow. Also build a "blkid" binary.
Addresses-Google-Bug: #11175082
Change-Id: I23521f45204574bb32f152926401c2cbad93175b
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
After
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/lib/ext2fs/llseek.c?id=274d46e1d35af423d0292d63c4d0ad7a03be82ba
with
__linux__
defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
SIZEOF_OFF_T >= SIZEOF_LONG_LONG
it leads to ext2fs_llseek() doing a "return lseek(fd, offset, origin);"
Which fails for offsets > 32bit.
Also, with
__linux__
!(defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE))
defined(HAVE_LLSEEK)
SIZEOF_OFF_T == SIZEOF_LONG_LONG
my_llseek is not defined at all. And there is no need to define
llseek as lseek, as llseek is never used.
Luckily ext2fs_llseek() then does "return lseek(...);"
It would seem that my_llseek should be used in both places.
Addresses-Google-Bug: #13340735
Change-Id: Ie7330300c9c1ca103eaaef97536dcf10adbbba02
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
In commit 0355d6d047 we used a Makefile shell assignment syntax
which is compatible with pmake and gmake 4.x, but which breaks on
gmake 3.x. So only use the pmake-compatible construction if we are
not using GNU make.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
The major() cpp macro is defined as requiring sys/types.h to be
included with _BSD_SOURCE defined. However, in older glibc's this
hasn't been strictly required and the stdlib.h header file included
sys/types.h implicitly. Fix this so that more aggressive
distributions run into build errors.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
in with andchanges. Lines starting
Glibc has depcreated _SVID_SOURCE and _BSD_SOURCE in favor of
_DEFAULT_SOURCE. So define _DEFAULT_SOURCE to shut up glibc 2.20
Signed-off-by: Theodore Ts'o <tytso@mit.edu>