Karel Zak [Wed, 11 Apr 2012 10:37:59 +0000 (12:37 +0200)]
Merge branch 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit
* 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit:
disk-utils: verify writing to streams was successful
fdisk: verify writing to streams was successful
getopt: verify writing to streams was successful
hwclock: verify writing to streams was successful
login-utils: verify writing to streams was successful
misc-utils: verify writing to streams was successful
mount: verify writing to streams was successful
partx: verify writing to streams was successful
schedutils: verify writing to streams was successful
sys-utils: verify writing to streams was successful
term-utils: verify writing to streams was successful
text-utils: verify writing to streams was successful
include: add stream error checking facility
Add a random number(s) generator specific file. The intial functions are based
on what libuuid provide. I did some modifications like avoid WIN32 checks - this
is util-LINUX.
[kzak@redhat.com: - move jrand_seed to lib/randutils.c
- use TLS for jrand_seed (like original code from libuuid)
- use size_t for buffer sizes
- add close() to random_get_bytes]
Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Petr Uzel [Fri, 6 Apr 2012 14:53:13 +0000 (16:53 +0200)]
sfdisk: fix calculation due to type mismatch (ix86)
Instructing sfdisk to create one partition spanning
across entire disk (",,") on 32bit system, if the disk
is sufficiently large (~2TB) leads to wrong calculation
in compute_start_sect() due to type mismatch.
Can be reproduced as:
--------------------------
linux-3ln5:~ # modprobe scsi_debug virtual_gb=2000
linux-3ln5:~ # sfdisk /dev/sda <<< ',,'
Checking that no-one is using this disk right now ...
OK
Disk /dev/sda: 261083 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
sfdisk: /dev/sda: unrecognized partition table type
Old situation:
sfdisk: No partitions found
no room for partition descriptor
sfdisk: bad input
--------------------------
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789 Reported-by: Dan Mares <dan.mares@norcrossgroup.com> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Sami Kerola [Thu, 5 Apr 2012 20:40:49 +0000 (22:40 +0200)]
docs: eject.1: align with Documentation/howto-man-page.txt
* Add spaces after dots (English spacing).
* Add line break macros.
* Use URL and email macros where appropriate.
* Fix typo at the end of the manual (s/lsblk/eject/).
Mike Frysinger [Thu, 5 Apr 2012 15:50:46 +0000 (11:50 -0400)]
eject: use CDROM_DRIVE_STATUS if available for tray toggling
One some platforms, the -T option can be unreliable (see reference bug
report for some examples). Instead, if the kernel supports the cdrom
status ioctl, use that to ask explicitly for the current tray status
and then open/close accordingly.
The eject_cdrom() func was reworked slightly, but none of the existing
callers care about the explicit normalization to [0,1] values, so have
it return the raw value so we can convert toggle_tray() over to using
that.
Finally, now that toggle_tray() uses a lot of helper functions, drop
the check on CDROMCLOSETRAY. The sub-functions take care of that.
Reference: https://bugs.gentoo.org/261880 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Dave Reisner [Tue, 27 Mar 2012 12:53:58 +0000 (08:53 -0400)]
fsck: don't free fstab table on parse failure
Even if we fail parsing, fstab gets referenced later in the code (and
will subsequently crash via heap corruption). Take the easy way out and
simply avoid deallocating this table, as it will be freed for us on
program exit regardless.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Karel Zak [Thu, 5 Apr 2012 13:58:02 +0000 (15:58 +0200)]
Merge branch 'eject'
* eject: (47 commits)
tests: use eject --force
eject: use BUILD_EJECT, move to sys-utils
eject: clean up usage()
eject: clean up man page
eject: add --force option
eject: check for hotplug/removable attribute
eject: remove obsolete code, use EXIT_* macros
tests: add umount-by-eject tests
eject: improve work with partitioned devices
lib/sysfs: improve sysfs_is_partition_dirent()
eject: call umount <mountpoint> rather than <device>
eject: use libmount to detect if cdrom is mounted
eject: make the code robust
eject: use SG_IO ioctl for scsi
eject: support CDIOCEJECT ioctl
eject: new close_tray code from Fedora
eject: new auto_eject code from Fedora
eject: add -X from Fedora
eject: add --manualeject from fedora
eject: clean up devname usage
...
Karel Zak [Thu, 5 Apr 2012 10:06:23 +0000 (12:06 +0200)]
eject: check for hotplug/removable attribute
* based on code from Fedora
* supported are only:
- /sys/dev/block/<maj:min>/removable devices
- devices connected by usb, ieee1394, pcmcia, mmc or ccw subsystem.
Frankly, this heuristic sucks -- all is hot-pluggable in this days,
but it's probably good idea to restrict the default behavior to avoid
user's mistakes.
Sami Kerola [Wed, 4 Apr 2012 17:22:08 +0000 (19:22 +0200)]
include: add stream error checking facility
The close_stream() is copied from GNU lib. Inspiration to do this is
talk by Jim Meyering - Goodbye World! The perils of relying on output
streams in C.
Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Paul Fox [Fri, 30 Mar 2012 12:16:50 +0000 (08:16 -0400)]
rtcwake: only invoke RTC_AIE_ON/OFF ioctls in pairs
many rtc drivers don't implement the RTC_AIE_ON/OFF ioctls at all --
so if we never tried to enable the alarm interrupt, don't try to
disable it later.
Sami Kerola [Sun, 18 Mar 2012 20:45:11 +0000 (21:45 +0100)]
tools: ko-release: make scripts bourne sh compliant [checkbashisms]
$ checkbashisms ko-release-gen
possible bashism in ko-release-gen line 31 ('function' is useless):
function die {
possible bashism in ko-release-gen line 36 ('function' is useless):
function add_file {
possible bashism in ko-release-gen line 68 ('function' is useless):
function add_html_dir {
possible bashism in ko-release-gen line 72 (brace expansion):
for fl in $(ls $src/*.{html,css,png}); do
$ checkbashisms ko-release-push
possible bashism in ko-release-push line 29 ('function' is useless):
function die {
possible bashism in ko-release-push line 34 ('function' is useless):
function push_file {
Sami Kerola [Sun, 18 Mar 2012 20:38:39 +0000 (21:38 +0100)]
tools: config-gen: make scripts bourne sh compliant [checkbashisms]
$ checkbashisms config-gen
script config-gen does not appear to be a /bin/sh script
possible bashism in config-gen line 27 (export foo=bar should be foo=bar; export foo):
export CFLAGS="$CFLAGS"
$ checkbashisms config-gen-functions.sh
possible bashism in config-gen-functions.sh line 14 ('function' is useless):
Sami Kerola [Sun, 18 Mar 2012 20:34:09 +0000 (21:34 +0100)]
tools: checkconfig.sh: make scripts bourne sh compliant [checkbashisms]
script checkconfig.sh does not appear to be a /bin/sh script
possible bashism in checkconfig.sh line 14 ('function' is useless):
function die() {
possible bashism in checkconfig.sh line 27 ('((' should be '$(('):
while (( "$#" )); do
Sami Kerola [Sun, 18 Mar 2012 20:10:35 +0000 (21:10 +0100)]
reset: make scripts bourne sh compliant [checkbashisms]
In addition strict compliance the commit will take variable name
quoting, and $(command) substitution in use.
$ checkbashisms reset reset.033c
possible bashism in reset line 11 ('$[' should be '$(('):
bot=$[ ${LINES:-`tput lines`} - 1 ]
possible bashism in reset.033c line 11 (echo -e):
echo -e \\033c
Bernhard Voelker [Mon, 26 Mar 2012 09:30:16 +0000 (11:30 +0200)]
docs: clarify KiB vs. KB in man pages
Update the man pages of blkid, wipefs, fallocate, fstrim, losetup
and hexdump to clarify the suffixes for the numerical values of the
offset and size/length arguments regarding KiB=1024 vs KB=1000.
Also mention the ZiB/YiB and ZB/YB suffixes supported by strtosize().
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>