Martin Schulze [Sun, 27 Jan 2008 06:31:06 +0000 (23:31 -0700)]
mkswap: set UUID for swap space (add -U option)
A friend of mine is looking into the possibility of cloning Debian
(and other) systems automatically and stomped over swap partitions
getting assigned new UUIDs every time the new harddisk is partitioned
and swap is created.
It's essential when partitions are to be recognised by their uuid and
not by their old device path anymore.
Addresses-Ubuntu-Bug: #66637 Signed-off-by: LaMont Jones <lamont@debian.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Mark McLoughlin [Mon, 28 Jan 2008 13:30:29 +0000 (14:30 +0100)]
mount: "can't create lock file" message sometimes means failure, sometimes not
What the patch does is goes from the situation where:
1) If /etc/mtab doesn't exist and /etc is read-only, you get the
"can't create lock file" message and the mount fails
2) If /etc/mtab does exist and /etc is read-only,you get the same
message but the mount succeeds
Clearly, the failure to update /etc/mtab should either cause the mount
to fail or not ... sometimes causing it to fail, and sometimes not
(each with the same message) is not useful.
This patch sets the same behaviour for create and update mtab. In both
cases it prints error message and the mount succeeds.
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Samuel Thibault [Tue, 27 Nov 2007 22:54:35 +0000 (22:54 +0000)]
setterm: add -blan [force|poke] options for TIOCL_{BLANKED,BLANK}SCREEN
Linux has some interface to force an immediate blank
(TIOCL_BLANK/UNBLANKSCREEN) or get the blank status
(TIOCL_BLANKEDSCREEN), which is useful e.g. for blind people.
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
David Brownell [Sun, 3 Feb 2008 23:34:35 +0000 (15:34 -0800)]
rtcwake: fix UTC time usage
Timezone handling is broken in this version since it's always
passing UTC time into the kernel, even on systems where the
RTC uses the local timezone.
I think that bug must come from bugs in how the system used to
to originally develop this code handled the RTC timezone. Both
RTCs should have been kept in UTC ... but only one of them was.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Karel Zak [Fri, 23 Nov 2007 14:13:22 +0000 (15:13 +0100)]
losetup: support unlimited number of loops
Old implementation:
- supports 256 loop devices only
- doesn't support gaps in list of loop devices
(e.g. loop0, loop1, loop3 -- loop3 is invisible)
Kernel 2.6.21 removes artificial maximum 256 loop device. Now the maximum
of loop devices could be really huge (depends on limit of MINOR
numbers). It means we need a better way how work with loop devices
than blindly call stat(2) for all 0-1048575 devices.
This patch uses three methods:
a) scan /sys/block/loopN (used for losetup -a only). This method is
probably the fastest way how found used loop device on machine with
huge number of devices in /dev.
b) classic way, stat(2) for all loop[0-7] devices (default number of
loop devices). This cheap method is sufficient for 99% of all machines.
LaMont Jones [Sun, 13 Jan 2008 05:35:50 +0000 (22:35 -0700)]
renice: detect errors in arguments, add -v, -h and long options
* renice was using atoi(), which does no error detection, meaning
that: "renice +20 blah" was accepted as valid.
* add -h | --help
* add -v | --version
* add long options for -p, -u and -g
* cleanup coding style
Addresses-Debian-Bug: #385245
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: LaMont Jones <lamont@debian.org> Signed-off-by: Karel Zak <kzak@redhat.com>
H. Peter Anvin [Wed, 16 Jan 2008 18:53:56 +0000 (13:53 -0500)]
fdisk: better fallback for get_random_id()
When /dev/urandom is not available, we have to use some kind of a hack
to generate a random MBR identifier. Use a better fallback that
incorporates the clock down to microsecond granularity.
Karel Zak [Mon, 28 Jan 2008 13:02:35 +0000 (14:02 +0100)]
login: fix a small memory leak and remove unnecessary zeroing
This patch fix a small memory leak (rh#251539) and also remove
unnecessary pam_set_item(). We needn't to zeroing PAM_USER when the
value is already NULL, it doesn't make sense.
Addresses-Red-Hat-Bugzilla: #251539 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 28 Jan 2008 12:13:25 +0000 (13:13 +0100)]
umount: don't print duplicate error messages
umount(8) is trying to umount a device two times to prevent some
obscure scenarios. It's maybe a nice feature, but it also produces
duplicate error messages.
# umount /home
umount: /home: device is busy
umount: /home: device is busy
Pádraig Brady [Fri, 4 Jan 2008 10:44:53 +0000 (10:44 +0000)]
cal: fix weekday alignment for certain locales
For example this had too much padding: LANG=zh_CN.utf8 cal -j
while this had too little padding: LANG=hu_HU.utf8 cal
This had invalid chars: LANG=li_BE.utf8 cal
This had too few chars: LANG=si_LK.utf8 cal
Note some locales may display with slightly worse alignment
(fa_IR.utf8 for example), but that is only because the terminal
is not merging the combining characters. This happens on
gnome-terminal-2.18.3-1.fc8 at least.
Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
This patch also fixes the "Last cylinder..." hint message. The "+number"
without any suffix is not a size at all. It's number of cylinders/sectors.
Note, the 10^N suffixes are not proposed to end-uses in the hint message.
Frédéric Bothamy [Sun, 13 Jan 2008 05:35:51 +0000 (22:35 -0700)]
sys-utils: correct setarch.8 manpage link creation
At least on Debian, .so commands are relative to the man directory
(e.g., /usr/share/man), not to the subdirectory:
% man i386
man: can't open /usr/share/man/setarch.8: No such file or directory
No manual entry for i386
See also http://bugs.debian.org/453245
Addresses-Debian-Bug: #453245 Signed-off-by: Frédéric Bothamy <frederic.bothamy@free.fr> Signed-off-by: LaMont Jones <lamont@debian.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Matthias Koenig [Mon, 17 Dec 2007 10:33:20 +0000 (11:33 +0100)]
mount: "nofail" mount option
It would be nice to have a mount option "nofail" indicating that mount
should not return an error if the device does not exit. This is useful
for hotpluggable devices which are configured in fstab and __might__
not exist at boot time.
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
David Woodhouse [Tue, 4 Dec 2007 13:44:05 +0000 (14:44 +0100)]
hwclock: check for ENODEV
/sbin/hwclock is supposed to fall back to using /dev/rtc0 if /dev/rtc isn't
working (which it isn't, because mkinitrd creates it with the old device
numbers, and we're switching to the new RTC_CLASS driver).
Unfortunately, it'll only cope if the error it gets is ENOENT (i.e. the device
node doesn't exist). It doesn't fall back to the next device in the list if the
error is ENODEV, which is what happens when the device node exists, but there's
no driver.
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
David Brownell [Fri, 30 Nov 2007 21:42:41 +0000 (13:42 -0800)]
rtcwake: misc cleanups
Cleanups for rtcwake:
- Minor doc updates: highlight the framebuffer problem,
give correct history of this code
- Improve debug output
- Fix some linelength bugs
Note that this code predated the sysfs "wakealarm" mechanism, and
works around several now-fixed bugs in the kernel RTC framework.
Nowadays it would make sense to make this program use only the sysfs
interface to the RTC, using "since_epoch" instead of RTC_RD_TIME and
"wakealarm" instead of the four other ioctls. That could simplify
the mess involved in timezone handling.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Karel Zak <kzak@redhat.com>
There is absolutely no reason why cfdisk should not display
cylinders beyond 1024. The number of cylinders needs to be
truncated only for the CHS field.
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Matthias Koenig [Tue, 13 Nov 2007 15:28:38 +0000 (16:28 +0100)]
mkfs.minix: add sectorsize check
Minix filesystem until version 2 has a fixed blocksize of 1024 bytes.
If you try to create a filsystem on a device with a physical sectorsize
larger than 1024 bytes, this resulting minix fs cannot be mounted,
because the physical sectorsize must be smaller than the filesystem
blocksize.
This patch adds a check for this and will refuse to create a filesystem
if the sectorsize is bigger than the blocksize.
Randy Dunlap [Tue, 16 Oct 2007 00:38:57 +0000 (17:38 -0700)]
sfdisk: cleanup 83 gcc warnings
Fix strict gcc warnings that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
83 warnings fixed:
sfdisk.c:249: warning: pointer targets in initialization differ in signedness
sfdisk.c:376: warning: pointer targets in passing argument 1 of 'chars_to_ulong' differ in signedness
sfdisk.c:702: warning: pointer targets in passing argument 1 of 'copy_to_int' differ in signedness
sfdisk.c:703: warning: pointer targets in passing argument 1 of 'copy_to_int' differ in signedness
sfdisk.c:1709: warning: pointer targets in passing argument 1 of 'fgets' differ in signedness
sfdisk.c:1709: warning: pointer targets in assignment differ in signedness
sfdisk.c:1714: warning: pointer targets in passing argument 1 of 'index' differ in signedness
sfdisk.c:1714: warning: pointer targets in assignment differ in signedness
sfdisk.c:1719: warning: pointer targets in passing argument 1 of 'index' differ in signedness
sfdisk.c:1719: warning: pointer targets in assignment differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1729: warning: pointer targets in passing argument 1 of 'index' differ in signedness
sfdisk.c:1729: warning: pointer targets in assignment differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strncmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2067: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2083: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2096: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2154: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2155: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2156: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2167: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2168: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2169: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>