It's highly unlikely after five seconds that zero blocks would have
been written, but let's silence the Coverity warning.
Addresses-Coverity-ID: 1147780
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Dividing a floating point number by zero is undefined in C. It
happens to work with gcc/glibc, but it's not something that's
guaranteed.
Addresses-Coverity-ID: #1147781
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Previously, this message used 8193 as the example alternate
superblock. But for most file systems, the backup superblock is
located at 32768 (since most file systems have a block size of 4k, and
not 1k).
Addresses-Debian-Bug: #719185
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Commit fbabd5c44c added loopback mount detection. However, we
failed to update the config.h file, so the code wasn't actually
enabled. Fix this oversight.
Addresses-Debian-Bug: #497984
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
As part of the debian build, the e2fsprogs sources are built multiple
times --- for the udeb packages, for e2fsck.static, etc. Make sure
that when we disable the use of the built-in blkid and uuid libraries
(in favor of the ones shipped with util-linux), that we do so for all
of the builds.
Previously we were using the internal blkid library for e2fsck.static.
While this isn't completely broken, the internal blkid library hasn't
been maintained in quite some time, so it's better to use the
util-linux blkid library instead.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
In response to reviewer comments, commit fe56188b07 included changes
that modified some of the code used to output error messages when
checking user-supplied block numbers. These changes converted calls
to parse_ulonglong() to calls to strtoblk(). Because strtoblk() calls
parse_ulonglong(), and both output error messages, two redundant and
relatively generic messages were output on each error.
Fix this by removing the error message output from strtoblk(), and
extending it to accept an optional error message argument that it
supplies in lieu of a default to parse_ulonglong(). Also, revert to
the more descriptive original error messages with mods per reviewer
comments, and fix an error message in do_replace_node().
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Use the --dbg-package option instead of manually moving the files into
the debug packages. This is simpler to maintain, and avoids a problem
where creating directories using mkdir -p can create world-writeable
/usr/lib directory dependind on the umask used by the Debian buildd.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
An integer overflow could happen if the file system is large and has
very large contiguous chunks of free space.
Addresses-Debian-Bug: #718205
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
We need to explicitly specify the $DEB_BUILD_HOST when querying for
the version of the libblkid1 package.
Addresses-Debian-Bug: #721365
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The texi2html utility from the texi2html ceased being developed
upstream in 2011, and upstream has declared it superseded by the
makeinfo utility from the texinfo package.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This allows "e2image -rp /dev/sdc1 - | bzip2 > sdc1.img.bz2" to work
correctly, so the progress information doesn't corrupt the image being
sent to stdout.
Also add a diagnostic indicating that the -p option is currently only
implemented for raw mode.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The old progress reporting code would crash on small file systems.
For example:
cp /dev/null /tmp/foo.img
mke2fs -t ext4 -F /tmp/foo.img 100
e2image -o 0 -O 4096 -rap /tmp/foo.img
Fix this, and while we're at it, factor out the code to make it easier
to read and maintain.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
If dumpe2fs tries to print journal info when using an image file
created using e2image, it will crash since the journal isn't
available. So don't even try to print it.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The e2image progam was originally intended to create image files.
However, some people have started using e2image to copy a file system
from one block device to another, since it is more efficient than
using dd because it only copies the blocks which are in use. If we
are doing this, however, we must not skip writing blocks which are all
zero in the source device, since they may not be zero in the
destination device.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Phillip Susi <psusi@ubuntu.com>
Refactor calls to ext2fs_llseek(). This makes the code more compact,
easier to read, and it also fixes a number of places where we call
ext2fs_llseek() without doing proper error checking.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
When doing an in place move, interrupting it past the
point of no return will destroy the filesystem since
parts of it have been overwritten. Catch SIGINT the
first time and issue a warning if this is the case.
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
When given the -p switch, print progress information, including
block counts, percentage complete, estimated time remaining, and
throughput.
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
If given at least one offset and only one file, assume source
and dest are the same, and do an in place move.
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Add -o and -O switches to specify the offset where the source
and destination filesystems start. This is useful if you have
an image of a partitioned disk or wish to create one.
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Currently the ext4 block group descriptor is 64 bytes. In case we
need to support larger block group descriptors in the future, teach
ext2fs_group_desc_csum() to checksum parts of the block group
descriptors that libext2fs doesn't yet understand.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>