Dima Kogan [Sat, 14 Aug 2010 09:15:47 +0000 (02:15 -0700)]
tailf: fixed timing issue that could cause duplicate data output
The issue is that in roll_file() we fstat() to find the file size, then read()
as much data as we can and then use the previously saved file size to mark our
position. The bug occurs if we read past the file size reported by fstat()
because more data has arrived while we were reading it. The attached patch uses
the current file position as the location marker instead, with some extra logic
to handle tailing truncated files.
[kzak@redhat.com: - fix coding style]
Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu> Signed-off-by: Karel Zak <kzak@redhat.com>
Davidlohr Bueso [Sun, 8 Aug 2010 21:03:56 +0000 (17:03 -0400)]
rev: coding style, various fixes
* Change indentation to 8 characters and coding style, for better reading the code.
* Add some memory allocation error handling.
* Fix memory leaks. In cases when Ctrl-C is used to exit the program,
'p' cannot be freed, so made it a global var, to share between main()
and sig_handler(). Signal handing is necessary to fix some leaks, so
added a very basic, non invasive, mechanism.
Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
The current heuristic for conversion from partition to whole-disk
is based on device names. It's pretty poor. This patch replaces this
code with blkid_devno_to_wholedisk(). This solution is based on
/sys FS and it works for arbitrary partitioned devices.
The another problem is the way how fsck determines stacked devices.
The current code checks device name for "md" prefix only. It does not
care about DM, dm-ccypt, and so on. This patch uses
/sys/block/.../slaves/, but it does not fully resolves dependencies
between all devices. The method is simple -- fsck does not check
stacked devices in parallel with any other device.
Karel Zak [Wed, 18 Aug 2010 07:02:03 +0000 (09:02 +0200)]
agetty: add -s to reuse existing baud rate
For example:
/sbin/agetty -s /dev/ttyS0 9600
will reuse the speed the kernel configured on the port. If the setting
from kernel is useless (tty returns BREAK character) then the baud
rate from command line (9600) is used.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623685 Signed-off-by: Karel Zak <kzak@redhat.com>
Valerie Aurora [Wed, 4 Aug 2010 00:09:19 +0000 (20:09 -0400)]
mount: get most recently mounted fs from /etc/mtab.
I spent most of the day tracking down this subtle remount bug. I
think this is the correct solution but I'd appreciate some
double-checking. I suspect this bug will munge the mount options
whenever you remount a file system mounted on the same mountpoint as
another file system, using the mountpoint as the handle.
mount: get most recently mounted fs from /etc/mtab.
In mount, when using /etc/mtab to lookup a mount entry, get the most
recently mounted entry instead of the first mounted entry. You want
to manipulate the most recent mount, not a covered mount. See comment
to umount_one_bw().
This bug has been util-linux-ng since the first git checkin. It
finally showed up on my system with the change to stop using
SETLOOP_AUTOCLEAR if /etc/mtab is writable (commit af092544). If you
do a remount of a file system mounted on the same dir as another file
system, it will take the options from the first mount and write them
out to /etc/mtab as the options to the second mount - including, in
the case of a loop device, loop=/dev/loop0. Then when you umount the
second mount, it grabs the line from /etc/mtab and tries to tear down
the loop device, which complains because it is still in use by the
first mount.
Reproducible test case (on a system with writable /etc/mtab):
mount -o loop,ro /tmp/ro /mnt
mount -t tmpfs tmpfs /mnt
mount -o remount,ro /mnt
cat /etc/mtab | tail -2
build-sys: drop the getsize test out of Makefile.am
The #ifdef TEST_PROGRAM block was removed with commit 3069624180bac35f1cd468249ddb9dfc91d1b7b1 so there is no point in
keeping the tests declared, as it won't build.
Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
Karel Zak [Thu, 29 Jul 2010 12:18:46 +0000 (14:18 +0200)]
mount: fix "mount -a" for auto-clear loopdevs and /proc/mounts
The "mount -a" uses /etc/mtab to detect already mounted file systems
from /etc/fstab -- this check requires the same FS name (1st field)
in fstab and mtab.
On systems with enabled auto-clear loop devies or systems without
regular mtab (symlink to /proc/mounts) there is /dev/loopN rather
than image filename in mtab. For example:
fstab:
/mnt/store/foo.ISO /mnt/image auto defaults 0 0
mtab:
/dev/loop0 /mnt/image iso9960 rw 0 0
We have to scan all available loop devices to check if some of the
devices is not associated with the image file from fstab.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=618957 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 20 Jul 2010 09:37:23 +0000 (11:37 +0200)]
mount: don't use auto-clear loopdev if mtab is available
# mount /home/images/floppy.img /mnt/test2
# mount | grep loop
/dev/loop0 on /mnt/test2 type udf (rw)
mount(8) with auto-clear loopdev does not store information about the
original backing file (the image) to /etc/mtab. (Note that this is our
long-term goal, because we want to remove mtab from Linux.)
Unfortunately, losetup(8) is not able to provide full path for the
backing file, because LOOP_GET_STATUS ioctl uses 64 bytes for the
filename...
So, without the information about the backing file in mtab the
information about mapping between the file and the loopdev is
unaccessible from userspace.
From my point of view it would be nice to add all necessary
information about loopdevs to /sys rather than rely on broken
LOOP_GET_STATUS[64] ioctls.
with this patch:
# mount /home/images/floppy.img /mnt/test2
# mount | grep loop# mount | grep loop
/home/images/floppy.img on /mnt/test2 type udf (ro,loop=/dev/loop0)
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=615389 Signed-off-by: Karel Zak <kzak@redhat.com>
According to a search on the internet, the 200 file number is not a
posix shell feature, since posix shells are only mandated to have 1
through 9. I haven't verified that this claim is right, but, at least
dash doesn't like the 200. So here is a patch for the flock man page
that replaces 200 with 9.
Signed-off-by: Patrice Dumas <pertusus@free.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
Jeff Mahoney [Wed, 7 Jul 2010 08:01:17 +0000 (10:01 +0200)]
swapon: Document btrfs limitation with swapfiles
Btrfs, as of 2.6.35, is unable to allow swapfiles to be used on its
filesystems. This is due to the swapfile implementation wanting to
build an extent map of each block in the file and expecting it to be
static for the life of the swapfile.
Btrfs can't guarantee this and refuses to return the mapping. The
swapfile implementation just makes a comment about there being holes
in the file - but that's how btrfs denies the mapping.
This patch adds a section to the swapon manpage to document it.
Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Thu, 1 Jul 2010 17:41:40 +0000 (13:41 -0400)]
cfdisk: search for ncursesw/ncurses.h
Some distros install the wide version of ncurses side by side with the
non-wide version and place the wide headers in an ncursesw/ subdir. So
detect that behavior and include the right header with cfdisk.
Karel Zak [Thu, 1 Jul 2010 08:43:06 +0000 (10:43 +0200)]
build-sys: explicitly check for slang.h
The slang/slcurses.h contains
#includes <slang.h>
but we don't use -I/usr/include/slang (and this is also missing in
slang.pc), it means that we have manually include the slang.h file
in our configure script.
Note this is Fedora-12, maybe some others distros have more usable
slang headers...
Note that option -v0 is obsolete, and remove the now unneeded comment
about new-style swap areas. Further doublespace sentences, add some
commas and articles, and alphabetize the options.
ipcs: advise translators a different output format
Shared memory status output format need changes but there are backward
compatibility problems. This is a invite to apply in translations the
same style used for the rest of the summaries as well as for the limits
reported by -l option.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Karel Zak [Wed, 16 Jun 2010 08:52:20 +0000 (10:52 +0200)]
fdisk: extend -c and -u options to support old DOS stuff
The DOS mode and cylinders as display units are disabled by default
now. For users who need old DOS behavior is it necessary to extend
-c (compatibility) and -u (units) command line options. The change is
backwardly compatible (so people who already uses -u and -c are not
affected with this change). New form:
-c[=<mode>] where <mode> is 'dos' or 'nondos' (default)
-u[=<units>] where <units> is 'cylinders' or 'sectors' (default)
For example old deprecated DOS behavior could be enabled by:
chrt: change two messages into four translatable sentences
In several languages the translations for "current" and "new" will
have to be slightly different depending on whether they apply to
"policy" or "priority". (As a general rule, translatable messages
should be full sentences, and not partial ones with optional words
filled in via %s.)
Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>