Commit Graph

121 Commits (5267a520bb7887b146f05ffa8726664afbb6c3c2)

Author SHA1 Message Date
Theodore Ts'o d2af1bdd05 Fix e2fsck's get_size logic so it will work with the Linux floppy driver
The Linux floppy driver is a bit different from the other block device
drivers, in that if the device has been opened with O_EXCL, it disallows
another open(), even if the second open() does not have the O_EXCL flag.
So this patch moves the call to ext2fs_get_device_size() so that if it
returns EBUSY, e2fsck can close the filesystem, retry the device size,
and then reopen it.  This rather complicated approach is required since
we need to know the blocksize of the filesystem before we can call
ext2fs_get_device_size().

Addresses Debian Bug: #410569

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-04 01:14:52 -04:00
Brian Behlendorf cae542ce8e [COVERITY] Fix memory leak when parsing extended options in e2fsck
Coverity ID: 35: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2007-03-28 11:28:24 -04:00
Theodore Ts'o a6d8302b48 Use the newer add/remove_error_table com_err interfaces
Change all of the e2fsprogs programs to use the newer add_error_table()
and remove_error_table() interfaces instead of the much older
initialize_*_error_table() function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-12-26 03:38:07 -05:00
Theodore Ts'o 642935c082 Fix misc. gcc -Wall complaints in the misc and e2fsck directories
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-11-14 23:38:17 -05:00
Eric Sandeen f335864338 Add checks to make sure inode counts don't overflow a 32-bit value
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:17 -04:00
Eric Sandeen d0ff90d520 Fix signed vs unsigned printf format strings for block and inode numbers
There were still some %d's lurking when we print blocks & inodes; also
many of the counters in the e2fsck_struct were signed, and probably
need to be unsigned to avoid overflows.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:15 -04:00
Matthias Andree abcfdfda7a Read mke2fs.conf and e2fsck.conf from root_sysconfdir rather than harcoded /etc. 2006-06-10 16:08:18 +02:00
Takashi Sato 8deb80a5d1 Fix format statements to make e2fsprogs programs 32-bit clean
Change the format string(%d, %ld) for a block number and inode number
to %u or %lu.

Signed-off-by: Takashi Sato <sho@tnes.nec.co.jp>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 21:43:46 -05:00
Theodore Ts'o 2e14e0c8cc Change e2fsck to open non-mounted filesystems in exclusive mode
Thanks to Andreas Dilger for this idea.  If the filesystem is not mounted,
e2fsck will open it in exclusive mode to prevent the a confused/careless 
system administrator from mounting the filesystem while the filesystem 
check is taking place, which could cause all sorts of problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 20:01:09 -05:00
Theodore Ts'o a5f37a9b25 Add a config option which controls whether fs checks are skipped when on battery
Whether fs checks are skipped when the system is running on battery can be
controlled by the new e2fsck.conf option defer_check_on_battery (this option 
defaults to TRUE).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-29 05:15:36 -05:00
Theodore Ts'o bc3392c389 Print an explanation when skipping a check due being on battery
On Sat, Jan 28, 2006 at 12:53:33PM -0600, Fredrick Knieper wrote:
> Package: e2fsprogs
> Version: 1.38+1.39-WIP-2005.12.31-1
>
> When running fsck at boot or when running e2fsck manually on a device,
> fsck will not check a filesystem based on the maximum mount count,
> unless a flag such as -f or -c is used to force the filesystem check.

What's happening is that when you run on battery, e2fsck will delay
running the filesystem check, on the assumption that it is better to
defer the check until some time in the future when your laptop is
running on AC mains again.  This deferral is not infinite, however; if
the number of mounts exceeds twice the max mount counts, or if the
interval between checks exceeds twice the check interval, e2fsck will
force the check even though you are on battery.

I've changed the sources to print a message to make this more clear.

Addresses Debian Bug: #350306

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-29 05:05:31 -05:00
Theodore Ts'o f5f14fcfe9 Add syntax error reporting to the profile library
E2fsck will now report syntax errors in /etc/e2fsck.conf intead of simply
ignoring the config file when there are errors.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-04 10:32:16 -05:00
Theodore Ts'o 5dd2a6e08d Add E2FSCK_CONFIG environment variable
Also, use this environtment variable to make sure that a local
/etc/e2fsck.conf file will not interfere with the regression test
suite.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 16:21:00 -05:00
Theodore Ts'o eb065ccf18 Add allow_cancellation config option
If the e2fsck configuration file sets the allow_cancellation option to be 
true, then if the filesystem does not have any known problems, and was 
known to be cleanly unmounted, then let e2fsck exit with a status code of 0 
instead of 32 (FSCK_CANCELED) so that the bootup scripts will continue 
without stopping the boot.  (Addresses Debian Bug: #150295)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 00:52:23 -05:00
Theodore Ts'o 1017f65179 Read in /etc/e2fsck.conf configuration file at startup
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 00:00:10 -05:00
Theodore Ts'o ae1182cb84 Make e2fsck -cc warn on a read-only root filesystem
Don't let the user run e2fsck -ccn on the root partition, without warning 
that he or she might be doing something Really Stupid.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09 18:11:16 -05:00
Theodore Ts'o f4b6d2a039 Fix typo in e2fsck error message.
Thanks to Solar Designer for pointing out the missing preposition.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09 17:31:08 -05:00
Theodore Ts'o 8dceb92407 E2fsck: fix future times in the superblock's last mount or last write fields
Detect if the superblock's last mount field or last write field is in
the future, and offer to fix if so.  (Addresses Debian Bug #327580)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-24 21:59:45 -04:00
Theodore Ts'o b28a6e96af Fix use-after-free bug of e2fsck context structure.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-07-25 11:36:43 -05:00
Theodore Ts'o bb145b01cf Fix e2fsprogs messages for grammar and consistency, based on suggestions
from Benno Schulenberg.

Add missing _() so all strings can be internationalized.
2005-06-20 08:35:27 -04:00
Theodore Ts'o 1f3ad14a5a Use a centrally stored current time for "now" which
can be overridden using the E2FSCK_TIME environment 
variable, for better reproducibility for regression tests.
2005-04-14 14:07:53 -04:00
Theodore Ts'o 550a4afa24 E2fsck will now check the individual block group inode and block free counts,
as well as the filesystem-wide inode and block free counts.  If any of the
free counts is too large, force a full filesystem check.  (Addresses 
Debian Bug #291571)
2005-01-25 03:09:24 -05:00
Theodore Ts'o 9214dccbfb Miscellaneous gcc -Wall cleanups. Use fixed rather than floating point
math to avoid rounding issues.
2005-01-19 13:57:40 -05:00
Theodore Ts'o ecd0d8fe2a Clean up Matthais's "fix crash when /proc/acpi/ac_acapter is not present"
patch.
2005-01-17 13:59:18 -05:00
Matthias Andree 4b13704cbe Fix crash when /proc/acpi/ac_adapter/ is not present, for instance,
on pre-ACPI and non-Linux systems.
2005-01-13 03:35:29 +01:00
Theodore Ts'o 2e8ca9a26b Add support for passing options to the io layer using the URL syntax. For
example, /tmp/test.img?offset=1024.  Multiple options can separated using
the & character, although at the moment the only option implemented is
the offset option in the unix_io layer.
2004-11-30 14:07:11 -05:00
Theodore Ts'o 66fbee8cbb unix.c (check_if_skip): If the checkinterval is zero, then
disregard it when calculating when the next check will
	take place by e2fsck.
2004-05-04 20:38:17 -04:00
Theodore Ts'o c07f9f2639 In e2fsck, when trying to determine if the system is running on
battery, be more flexible about the name of the ACPI device that
corresponds to the AC adapter.  (Addresses Debian bug #242136)
2004-04-12 00:16:44 -04:00
Theodore Ts'o bc69f82db8 Add missing break statement so e2fsck -k actually works.
(Addresses Debian Bug #234993)
2004-02-27 10:39:27 -05:00
Theodore Ts'o 4fb9d52ba6 unix.c (main, PRS), e2fsck.8.in: Add a new -k option which keeps
the existing badblocks list when using the -c option.
	(Addresses Debian bug #229103)
2004-02-24 00:16:09 -05:00
Theodore Ts'o 544349270e Fix gcc -Wall nitpicks 2003-12-07 01:28:50 -05:00
Theodore Ts'o 3ddf2f662e When testing a disk using e2fsck -c, use the list
of new bad blocks to replace the current list of bad
blocks.  This way "e2fsck -c" can be used to recover from
a corrupted bad block inode.
2003-12-02 07:56:42 -05:00
Theodore Ts'o 015b03df7d In e2fsck, given an extra grace period before actually forcing
a filesystem check if a laptop system reports it is running on
battery.  This way the laptop will be biased to waiting until
it is on AC power before doing a filesystem check.  (Addresses
Debian bug #205177)
2003-11-21 11:02:22 -05:00
Theodore Ts'o 6de289cb10 In e2fsck, if the number of mounts until the next forced filesystem
check is 5 or less, mention this to the user.  (Addresses 
Debian bug #157194)
2003-11-21 10:54:54 -05:00
Theodore Ts'o 817e49e3ce Check the returned name from blkid_get_devname in tune2fs and
e2fsck, and print an error if the requested LABEL/UUID does 
not exist (previously, we core dumped!)
2003-11-21 09:10:29 -05:00
Theodore Ts'o 54a31a3b2e e2fsck.h, unix.c (PRS, e2fsck_clear_progbar,
e2fsck_simple_progress): Don't print the ^A and ^B
	characters which bracket the progress bar when the e2fsck
	program is talking directly to a tty, but only when it is
	being piped to another program.  (Addresses Debian bug
	#204137)
unix.c: Move some initialized variables to the BSS segment to 
	shrink the size of the e2fsck executable.
2003-08-19 10:08:34 -04:00
Theodore Ts'o 113e405bb6 unix.c (show_stats), e2fsck.h: Use ngettext (abbreivated with
the macro P_(str1, str2, n)) to simplify the statistics
	reporting.
2003-05-17 21:00:46 -04:00
Theodore Ts'o 2a29f1354f Add --enable-test-io-debug configure option which causes e2fsck and
tune2fs to use the test I/O manager.

The test I/O manager has been changed to not do anything extra by 
default, unless the TEST_IO_FLAGS and/or TEST_IO_BLOCK environment
variables are set, which controls what I/O operations are logged and
a block number to watch, respectively.  The log messages are sent to
stderr by default, unless a filename is specified via the 
TEST_IO_LOGFILE environment variable.
2003-05-05 12:08:47 -04:00
Theodore Ts'o ddc32a045b Add Czech translation.
Remove "NYC" translation.  Add Czech translation from Miloslav 
Trmac <mitr@volny.cz>

Random NLS and other display fixes from Miloslav.
2003-05-03 18:45:55 -04:00
Theodore Ts'o 520ead378e Fix gcc -Wall warnings. 2003-04-19 13:48:27 -04:00
Theodore Ts'o 908b785c3f Use setvbuf instead of setbuf to force stdout and
stderr to be non-buffered when the stdout/stderr are a pipe.
This fixes a cosmetic problem when using e2fsck under logsave.
2003-04-16 15:20:13 -04:00
Theodore Ts'o bc34d6be65 * Add support for the -a and -s options to logsave.
* Change e2fsck to bracket its progress bar output with ctrl-A and ctrl-B 
    characters, so that logsave -s can omit writing the progress bar output
    to the log file.
2003-04-16 14:05:06 -04:00
Theodore Ts'o fff45483ed Add portability enhancements for Cygwin32 environment. 2003-04-13 00:44:19 -04:00
Theodore Ts'o e71d87317a Add Apple/Darwin patches. 2003-03-14 02:13:48 -05:00
Theodore Ts'o b0700a1b60 Change e2fsck to detect and offer to delete or rename duplicate
filenames in directories when rebuilding directories using
"e2fsck -fD /dev/XXX"
2003-03-14 01:43:56 -05:00
Theodore Ts'o f364093b19 Update debugfs and e2fsck to use the blkid library. 2003-03-01 19:47:44 -05:00
Theodore Ts'o 19445ef970 Fixed up minor documentation issues (man page for badblocks and usage
message for e2fsck).
2003-01-29 21:04:52 -05:00
Theodore Ts'o b92ae1535c Detect if there is an attempt to run the journal twice, and
abort the e2fsck run with an error if this is the case.
(Address IBM Bugzilla bug #1226)
2003-01-02 16:53:54 -05:00
Theodore Ts'o 8161a7484f Print an error if more than one of the -p/-a, -n or -y options
are passed to e2fsck.
2003-01-02 16:36:44 -05:00
Theodore Ts'o c1637bd371 unix.c (main): Fix a bug where e2fsck could erroneously mark a
filesystem as being valid if it was being checked and it
	is interrupted with a ^C.  (Bug introduced in e2fsprogs
	1.28.)
2002-11-08 15:55:17 -05:00