]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 years agofdisk: gpt: check header size
Davidlohr Bueso [Wed, 14 Nov 2012 08:04:24 +0000 (00:04 -0800)] 
fdisk: gpt: check header size

UEFI states that the size of the GPT header must be between 92 and
the sector size. Add the check when verifying a valid header.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: don't offer GPT stuff in BSD menu
Karel Zak [Tue, 13 Nov 2012 17:05:36 +0000 (18:05 +0100)] 
fdisk: don't offer GPT stuff in BSD menu

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: allways return MOUNT_EX_*
Karel Zak [Tue, 13 Nov 2012 15:50:02 +0000 (16:50 +0100)] 
umount: allways return MOUNT_EX_*

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: add -R, --recursive option
Dave Reisner [Wed, 7 Nov 2012 18:02:28 +0000 (13:02 -0500)] 
umount: add -R, --recursive option

This allows unmounting of an entire tree of filesystems, which might be
of particular interest for a shutdown initramfs.

[kzak@redhat.com: - always return MOUNT_EX_* codes
                  - cosmetic changes on coding style]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolscpu: make read_topology() more robust to avoid SIGFPE
Karel Zak [Tue, 13 Nov 2012 09:36:25 +0000 (10:36 +0100)] 
lscpu: make read_topology() more robust to avoid SIGFPE

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add armv7 lscpu dump
Karel Zak [Mon, 12 Nov 2012 15:21:29 +0000 (16:21 +0100)] 
tests: add armv7 lscpu dump

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add ppc64-POWER7-64cpu lscpu dump
Karel Zak [Mon, 12 Nov 2012 15:21:09 +0000 (16:21 +0100)] 
tests: add ppc64-POWER7-64cpu lscpu dump

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: remove lscpu /sys dumps without 'possible' CPU mask
Karel Zak [Mon, 12 Nov 2012 14:00:24 +0000 (15:00 +0100)] 
tests: remove lscpu /sys dumps without 'possible' CPU mask

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolscpu: Fix issue found on CPU hot-remove
Toshi Kani [Tue, 23 Oct 2012 19:49:46 +0000 (13:49 -0600)] 
lscpu: Fix issue found on CPU hot-remove

read_basicinfo() relies on sysfs cpu directories
"/sys/devices/system/cpu/cpu%d" with assumption that cpu
logical number %d is always sequentially assigned for all
CPUs. However, this assumption is not correct with CPU
hot-remove operation since it removes a target sysfs cpu
directory after it is ejected. As a result, lscpu may not
recognize all CPUs.

The issue can be easily reproduced on KVM or VirtualBox,
which supports CPU eject operation, as follows.

1) The system has 4 CPUs
  $ lscpu -a -e
  CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE
  0   0    0      0    0:0:0      yes
  1   0    1      1    1:1:1      yes
  2   0    2      2    2:2:2      yes
  3   0    3      3    3:3:3      yes

2) Eject cpu2
  # echo 1 > /sys/bus/acpi/devices/LNXCPU:02/eject

3) lscpu no longer recognizes cpu3 after cpu2 is ejected
  $ lscpu -a -e
  CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE
  0   0    0      0    0:0:0      yes
  1   0    1      1    1:1:1      yes

The following changes are made to address this issue.
 - Use maxcpus to allocate and parse bitmaps.
 - Set desc->ncpu from cpu/present, which includes both on-line
   and off-line CPUs.
 - Add is_cpu_present() to check if a CPU is present. Ejected
   CPUs are not present.

[kzak@redhat.com: - read also /sys/devices/system/cpu/possible mask to
                    determine maximal number of CPUs,
                  - err() if possible mask is not found in /sys]

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolosetup: allow to use -O without --list
Karel Zak [Mon, 12 Nov 2012 13:36:29 +0000 (14:36 +0100)] 
losetup: allow to use -O without --list

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolosetup: rename SIZE->SIZELIMIT
Karel Zak [Mon, 12 Nov 2012 12:24:45 +0000 (13:24 +0100)] 
losetup: rename SIZE->SIZELIMIT

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: mark old losetup output format as DEPRECATED
Karel Zak [Mon, 12 Nov 2012 12:23:19 +0000 (13:23 +0100)] 
docs: mark old losetup output format as DEPRECATED

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolosetup: add --list and --output option
Ondrej Oprala [Mon, 12 Nov 2012 12:08:00 +0000 (13:08 +0100)] 
losetup: add --list and --output option

The --list --all is the default output:

  # losetup
  NAME       SIZE OFFSET AUTOCLEAR RO BACK-FILE
  /dev/loop0    0      0         0  0 /home/fs-images/swap.img
  /dev/loop1    0    100         0  0 /home/fs-images/disk.img

[kzak@redhat.com: - default to --all if no device specified,
                  - cleanup column names (add BACK- prefix)
                  - add MAJ:MIN to of the loopdev device]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/loopdev: make loopcxt_get_device() more robust
Karel Zak [Mon, 12 Nov 2012 11:10:52 +0000 (12:10 +0100)] 
lib/loopdev: make loopcxt_get_device() more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/console: fix possible fd leak
Karel Zak [Fri, 9 Nov 2012 11:59:33 +0000 (12:59 +0100)] 
lib/console: fix possible fd leak

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: try another methods before go to fallback
Karel Zak [Fri, 9 Nov 2012 11:52:33 +0000 (12:52 +0100)] 
lib/consoles: try another methods before go to fallback

The current code goes immediately to the fallback section if any
detection method fails. It seems better to try another methods before
the fallback solution.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: add debug messages
Karel Zak [Fri, 9 Nov 2012 11:44:00 +0000 (12:44 +0100)] 
lib/consoles: add debug messages

 - may be enabled by CONSOLES_DEBUG env. variable

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: TIOCGDEV code refactoring
Karel Zak [Fri, 9 Nov 2012 11:18:31 +0000 (12:18 +0100)] 
lib/consoles: TIOCGDEV code refactoring

 - add missing scandev() otherwise TIOCGDEV make no sense
 - use this method independent on /proc/cmdline code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: cmdline code refactoring
Karel Zak [Fri, 9 Nov 2012 10:52:11 +0000 (11:52 +0100)] 
lib/consoles: cmdline code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: sysfs code refactoring
Karel Zak [Fri, 9 Nov 2012 10:17:23 +0000 (11:17 +0100)] 
lib/consoles: sysfs code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: /proc/consoles code refactoring
Karel Zak [Fri, 9 Nov 2012 09:49:56 +0000 (10:49 +0100)] 
lib/consoles: /proc/consoles code refactoring

 - move to separate function
 - cleanup code
 - fix fscanf() usage to avoid buffer overflow

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: small cleanup
Karel Zak [Fri, 9 Nov 2012 09:30:14 +0000 (10:30 +0100)] 
lib/consoles: small cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: don't call perror()
Karel Zak [Fri, 9 Nov 2012 09:18:49 +0000 (10:18 +0100)] 
lib/consoles: don't call perror()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: add test program
Karel Zak [Fri, 9 Nov 2012 09:12:35 +0000 (10:12 +0100)] 
lib/consoles: add test program

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: remove global variable consoles
Karel Zak [Fri, 9 Nov 2012 09:06:23 +0000 (10:06 +0100)] 
lib/consoles: remove global variable consoles

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consolas: remove global variable concount, fix linked list
Karel Zak [Fri, 9 Nov 2012 08:52:35 +0000 (09:52 +0100)] 
lib/consolas: remove global variable concount, fix linked list

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: remove global variable initcp
Karel Zak [Thu, 8 Nov 2012 16:25:09 +0000 (17:25 +0100)] 
lib/consoles: remove global variable initcp

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: remove global variable comparedev
Karel Zak [Thu, 8 Nov 2012 16:22:45 +0000 (17:22 +0100)] 
lib/consoles: remove global variable comparedev

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: minor clean ups
Karel Zak [Thu, 8 Nov 2012 16:04:01 +0000 (17:04 +0100)] 
lib/consoles: minor clean ups

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: add code to detect all system consoles
Werner Fink [Thu, 8 Nov 2012 14:55:48 +0000 (15:55 +0100)] 
lib/consoles: add code to detect all system consoles

Signed-off-by: Werner Fink <werner@suse.de>
12 years agoscript: do not try to close stderr twice
Sami Kerola [Tue, 6 Nov 2012 21:14:14 +0000 (21:14 +0000)] 
script: do not try to close stderr twice

The commit cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9 broke script(1)
return value.

$ script -e -c "echo"; echo $?
1

The reason, as Daniel it reported, was that the script will close stderr
twice, once as timing file and atexit() in function close_stdout().  This
commit fixes the problem.

Reported-by: Daniel Narvaez <dwnarvaez@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolibmount: convert /dev/root from mountinfo to the device name
Karel Zak [Thu, 8 Nov 2012 13:43:38 +0000 (14:43 +0100)] 
libmount: convert /dev/root from mountinfo to the device name

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: add private mnt_get_kernel_cmdline_option()
Karel Zak [Thu, 8 Nov 2012 10:52:23 +0000 (11:52 +0100)] 
libmount: add private mnt_get_kernel_cmdline_option()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: update TODO file
Karel Zak [Wed, 7 Nov 2012 19:46:38 +0000 (20:46 +0100)] 
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: fix "COMMAND not specified" error
Karel Zak [Wed, 7 Nov 2012 14:20:39 +0000 (15:20 +0100)] 
su: fix "COMMAND not specified" error

 # su
 su: COMMAND not specified

This error message make sense for "runuser -u <user> <command>" only.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=872787
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: fix and update man page about --scsi
Karel Zak [Wed, 7 Nov 2012 13:39:43 +0000 (14:39 +0100)] 
lsblk: fix and update man page about --scsi

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: add TRANsport to --scsi output
Karel Zak [Wed, 7 Nov 2012 13:34:51 +0000 (14:34 +0100)] 
lsblk: add TRANsport to --scsi output

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: don't ignore disk device
Karel Zak [Wed, 7 Nov 2012 13:25:32 +0000 (14:25 +0100)] 
lsblk: don't ignore disk device

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: Add --scsi switch
Milan Broz [Fri, 2 Nov 2012 17:56:31 +0000 (18:56 +0100)] 
lsblk: Add --scsi switch

The --scsi switch prints similar information to lsscsi command.

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agolsblk: Add vendor column
Milan Broz [Fri, 2 Nov 2012 17:56:30 +0000 (18:56 +0100)] 
lsblk: Add vendor column

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agolsblk: Add revision column
Milan Broz [Fri, 2 Nov 2012 17:56:29 +0000 (18:56 +0100)] 
lsblk: Add revision column

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agoagetty: fix autodetection for TERM
Michal Schmidt [Mon, 29 Oct 2012 22:33:01 +0000 (23:33 +0100)] 
agetty: fix autodetection for TERM

open_tty() autodetects whether to set TERM to "linux" or "vt102", but it
can apply the result only if op->term is still NULL.

12 years agogpt: create empty disklabels
Davidlohr Bueso [Sat, 27 Oct 2012 17:23:47 +0000 (19:23 +0200)] 
gpt: create empty disklabels

This patch enables creating a new, empty, GPT disklabel from either
an empty disk or one that already has a disklabel. For this
purpose, a 'g' option is added to the main menu and is visible to all
labels. Here's an example for a scsi_debug device (/dev/sdb):

...
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x20a614c8.
3696: fdisk:  CONTEXT: zeroize in-memory first sector buffer

Command (m for help): g
3696: fdisk:    LABEL: changing to gpt label

3696: fdisk:  CONTEXT: zeroize in-memory first sector buffer
3696: fdisk:    LABEL: created new empty GPT disklabel (GUID: D4EA0706-F011-46DC-B7DE-6A72C7090AF8)

Command (m for help): w
The partition table has been altered!
...

Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: gpt: write entire first sector
Davidlohr Bueso [Sat, 27 Oct 2012 17:23:36 +0000 (19:23 +0200)] 
fdisk: gpt: write entire first sector

We were writing only 1 byte in LBA0, and GPT requires dealing with an entire
sector. This bug wasn't affecting when dealing with already existing devices
with GPT as we weren't writing an important part of the first sector, thus
leaving it unchanged. Also use write_all() wrapper from all-io.h

Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agobuild-sys: cleanup cpu_set_t usage
Karel Zak [Fri, 2 Nov 2012 11:07:36 +0000 (12:07 +0100)] 
build-sys: cleanup cpu_set_t usage

 - make taskset depend on cpu_set_t
 - make cpuset.c optional for libcommon and lib/path.c

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosfdisk: fix formatting typo in man page
Karel Zak [Fri, 2 Nov 2012 08:17:49 +0000 (09:17 +0100)] 
sfdisk: fix formatting typo in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: fix stupid typo
Karel Zak [Thu, 1 Nov 2012 12:03:28 +0000 (13:03 +0100)] 
su: fix stupid typo

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: move runuser(1) to sbin dir
Karel Zak [Thu, 1 Nov 2012 11:01:52 +0000 (12:01 +0100)] 
build-sys: move runuser(1) to sbin dir

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agorunuser: add -u to not execute shell
Karel Zak [Thu, 13 Sep 2012 09:58:00 +0000 (11:58 +0200)] 
runuser: add -u to not execute shell

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: supports paths canonicalization for alternative fstabs
Karel Zak [Wed, 24 Oct 2012 21:59:04 +0000 (23:59 +0200)] 
mount: supports paths canonicalization for alternative fstabs

 # mount --fstab /path/my.fstab

has to support standard operations with paths.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: support loopdevs in mnt_table_is_fs_mounted()
Karel Zak [Wed, 24 Oct 2012 21:44:11 +0000 (23:44 +0200)] 
libmount: support loopdevs in mnt_table_is_fs_mounted()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: tiny refactoring in mnt_table_is_fs_mounted()
Karel Zak [Tue, 23 Oct 2012 13:45:50 +0000 (15:45 +0200)] 
libmount: tiny refactoring in mnt_table_is_fs_mounted()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: fix compiler warning [-Wpointer-arith] and floating point exception
Karel Zak [Tue, 23 Oct 2012 13:10:26 +0000 (15:10 +0200)] 
fdisk: fix compiler warning [-Wpointer-arith] and floating point exception

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomisc: make readlink() usage more robust
Karel Zak [Tue, 23 Oct 2012 10:40:39 +0000 (12:40 +0200)] 
misc: make readlink() usage more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: use new sysfs functions, clean up get_transport()
Karel Zak [Tue, 23 Oct 2012 10:21:37 +0000 (12:21 +0200)] 
lsblk: use new sysfs functions, clean up get_transport()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/sysfs: add SCSI link functions
Karel Zak [Tue, 23 Oct 2012 10:12:07 +0000 (12:12 +0200)] 
lib/sysfs: add SCSI link functions

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/sysfs: add functions for SCSI host attributes
Karel Zak [Tue, 23 Oct 2012 09:32:55 +0000 (11:32 +0200)] 
lib/sysfs: add functions for SCSI host attributes

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/sysfs: add SCSI host:channel:target:lun support
Karel Zak [Tue, 23 Oct 2012 08:57:59 +0000 (10:57 +0200)] 
include/sysfs: add SCSI host:channel:target:lun support

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/tt: don't ignore "extreme" columns if an free space is available
Karel Zak [Tue, 23 Oct 2012 08:56:23 +0000 (10:56 +0200)] 
lib/tt: don't ignore "extreme" columns if an free space is available

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: add SCSI transport type attribute
Milan Broz [Fri, 19 Oct 2012 12:10:41 +0000 (14:10 +0200)] 
lsblk: add SCSI transport type attribute

Patch adds "SCSI transport layer" similar attribute to "lsscsi -t".

This is useful for script where you want to distinguish e.g. FC, iSCSI
or USB devices from local disks.

Detection logic is quite simplified in comparison to lsscsi but it
should provide the same output (except detailed transport attributes).

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agolsblk: add SCSI H:C:T:L attribute
Milan Broz [Fri, 19 Oct 2012 12:10:40 +0000 (14:10 +0200)] 
lsblk: add SCSI H:C:T:L attribute

For block devices it is sometimes useful to print SCSI device ID"
Host:Channel:Target:LUN.

Patch adds column name HCTL which can be used in lsblk.

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agolsblk: add parent kernel name column
Milan Broz [Fri, 19 Oct 2012 12:10:39 +0000 (14:10 +0200)] 
lsblk: add parent kernel name column

For raw output used in scripts it is sometimes necessary
to reconstruct tree of devices.

Parent kernel name (PKNAME) provides needed information
to do that easily.

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agologin: fix compiler warning [-Wunused-result]
Karel Zak [Mon, 22 Oct 2012 11:13:02 +0000 (13:13 +0200)] 
login: fix compiler warning [-Wunused-result]

It's probably unnecessary paranoia, but let's check if we're able to
restore the original IDs after ~/.hushlogin file check.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/c: move usleep() fallback to c.h
Karel Zak [Mon, 22 Oct 2012 09:03:09 +0000 (11:03 +0200)] 
include/c: move usleep() fallback to c.h

To make it available everywhere in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: remove gethostbyname() check
Sami Kerola [Fri, 12 Oct 2012 21:13:05 +0000 (22:13 +0100)] 
build-sys: remove gethostbyname() check

Removed as unnecessary, there are no references to gethostbyname() in
code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoagetty: replace gethostbyname() with getaddrinfo()
Sami Kerola [Fri, 12 Oct 2012 21:11:16 +0000 (22:11 +0100)] 
agetty: replace gethostbyname() with getaddrinfo()

The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agologger: replace gethostbyname() with getaddrinfo()
Sami Kerola [Fri, 12 Oct 2012 20:28:41 +0000 (21:28 +0100)] 
logger: replace gethostbyname() with getaddrinfo()

The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolibmount, eject: replace index() and rindex() with strrch() or strrchr()
Sami Kerola [Fri, 12 Oct 2012 19:23:54 +0000 (20:23 +0100)] 
libmount, eject: replace index() and rindex() with strrch() or strrchr()

Both index() and rindex() are legacy functions which may be withdrawn in
a future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html
Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/rindex.html
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agofsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check
Karel Zak [Mon, 22 Oct 2012 08:10:55 +0000 (10:10 +0200)] 
fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check

 make check
 sudo su -
 cd tests
 ./run.sh cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: add line breaks to whereis.1
Sami Kerola [Wed, 10 Oct 2012 18:14:43 +0000 (19:14 +0100)] 
docs: add line breaks to whereis.1

Fix to tools script checkmans.sh warning.

testing: /home/src/util-linux/misc-utils/whereis.1
:120: warning [p 1, 10.8i, div `an-div', 0.0i]: can't break line

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoinclude/c: remove MAXHOSTNAMELEN macro
Karel Zak [Fri, 19 Oct 2012 14:58:11 +0000 (16:58 +0200)] 
include/c: remove MAXHOSTNAMELEN macro

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolast: stop usig MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:56:57 +0000 (16:56 +0200)] 
last: stop usig MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agowrite: stop using MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:27:58 +0000 (16:27 +0200)] 
write: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: stop using MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:27:46 +0000 (16:27 +0200)] 
agetty: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: stop using MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:27:29 +0000 (16:27 +0200)] 
login: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/xalloc: add xgethostname()
Karel Zak [Fri, 19 Oct 2012 14:23:54 +0000 (16:23 +0200)] 
include/xalloc: add xgethostname()

The new function allocates memory by xalloc() for hostname and
fill in the buffer by gethostname().

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/env: unify indentation
Sami Kerola [Wed, 17 Oct 2012 19:26:14 +0000 (20:26 +0100)] 
include/env: unify indentation

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/c: add get_hostname_max() inline function
Sami Kerola [Wed, 17 Oct 2012 19:16:06 +0000 (20:16 +0100)] 
include/c: add get_hostname_max() inline function

Using sysconf(_SC_HOST_NAME_MAX) does not work everywhere.  At such even
header values for hostname length should be preferred, and if nothing
else works guess the maxium being 64 bytes.

Based-on-code-by: Karel Zak <kzak@redhat.com>
CC: Mike Frysinger <vapier@gentoo.org>
References: http://www.spinics.net/lists/util-linux-ng/msg07050.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: gpt: use swap_efi_guid for new partitions
Davidlohr Bueso [Sun, 7 Oct 2012 14:34:08 +0000 (16:34 +0200)] 
fdisk: gpt: use swap_efi_guid for new partitions

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: fix segfault when printing gpt raw data
Davidlohr Bueso [Sun, 7 Oct 2012 14:34:01 +0000 (16:34 +0200)] 
fdisk: fix segfault when printing gpt raw data

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: api: improve some comments
Davidlohr Bueso [Sun, 7 Oct 2012 14:33:45 +0000 (16:33 +0200)] 
fdisk: api: improve some comments

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: api: propagate partition deletion to users
Davidlohr Bueso [Sun, 7 Oct 2012 14:33:37 +0000 (16:33 +0200)] 
fdisk: api: propagate partition deletion to users

The generic fdisk_delete_partition() function returns 0 when a partition
is correctly deleted, otherwise it's corresponding error (negative values).
This, however, does not include problems that can occur in actual label
specific contexts, so we need to propagate the corresponding return code,
back to the user visible api.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agodocs: update deprecated file
Karel Zak [Thu, 18 Oct 2012 08:48:01 +0000 (10:48 +0200)] 
docs: update deprecated file

The goal is to consolidate the very basic linux commands and minimize
dependence on another packages (e.g. shadow-utils). It seems better to
keep newgrp, vipw and vigr as non-deprecated for now. Maybe we will
found a way how to improve the code. We will see... :-)

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/loopdev: check for /sys
Karel Zak [Wed, 17 Oct 2012 09:43:39 +0000 (11:43 +0200)] 
lib/loopdev: check for /sys

The current loopdev code prefers /sys to get information about
loop devices. The old methods like scan /dev are fallback solution
only. Unfortunately, the code does not check if /sys is mounted.

Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/loopdev: improve debug messages
Karel Zak [Wed, 17 Oct 2012 09:42:21 +0000 (11:42 +0200)] 
lib/loopdev: improve debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodmesg: Add a --color option to colorize error and panic messages
Ondrej Oprala [Tue, 9 Oct 2012 10:32:55 +0000 (12:32 +0200)] 
dmesg: Add a --color option to colorize error and panic messages

[kzak@redhat.com: - update man page
                  - colorize critical messages too]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
12 years agolib/color: add module for work with terminal colors
Ondrej Oprala [Tue, 16 Oct 2012 14:39:00 +0000 (16:39 +0200)] 
lib/color: add module for work with terminal colors

[kzak@redhat.com: - split from dmesg patch
                  - add more colors]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: add long options for -L and -U to man page
Bill Pemberton [Wed, 10 Oct 2012 20:54:02 +0000 (16:54 -0400)] 
mount: add long options for -L and -U to man page

The -L and -U flags both have long options too (--label and --uuid).
The usage() function will show them but the man page didn't list them.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agomount: add -c abbreviation for --no-canonicalize to man page
Bill Pemberton [Wed, 10 Oct 2012 20:54:01 +0000 (16:54 -0400)] 
mount: add -c abbreviation for --no-canonicalize to man page

The --no-canonicalize option can also be set using -c.  The --help for
mount shows this option but the man page did not.  Add -c to the man
page.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agodocs: remove hwclock --compare from TODO
Bill Pemberton [Wed, 10 Oct 2012 20:54:00 +0000 (16:54 -0400)] 
docs: remove hwclock --compare from TODO

commit 83765871ef0d6c554c46027577648b77c7351a78 added the --compare
option to hwclock so it can be removed from the TODO.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agohwclock: add the --compare option to the man page
Bill Pemberton [Wed, 10 Oct 2012 20:53:59 +0000 (16:53 -0400)] 
hwclock: add the --compare option to the man page

The compare option for hwclock was not listed in the man page.  This
adds a simple decription of it.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agodocs: add su(1) btmp logging
Karel Zak [Tue, 16 Oct 2012 09:27:35 +0000 (11:27 +0200)] 
docs: add su(1) btmp logging

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add mising "export" keyword
Karel Zak [Mon, 15 Oct 2012 15:28:02 +0000 (17:28 +0200)] 
tests: add mising "export" keyword

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: skip ipcs limits overflow when bc is not available
Gilles Espinasse [Sun, 14 Oct 2012 15:19:10 +0000 (17:19 +0200)] 
tests: skip ipcs limits overflow when bc is not available

Found only this one while trying as-root tests

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agotests: fix ipcs basic limit when bc is not available
Gilles Espinasse [Sun, 14 Oct 2012 13:52:55 +0000 (15:52 +0200)] 
tests: fix ipcs basic limit when bc is not available

Skip basic limit test if bc is not available.
That happen to be the case when building from sources, following LFS book

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agolibmount: fixed comment about param
Raul Gutierrez Segales [Sat, 13 Oct 2012 15:59:31 +0000 (08:59 -0700)] 
libmount: fixed comment about param

Signed-off-by: Raul Gutierrez Segales <rgs@itevenworks.net>
12 years agolibblkid: fix compiler warning [-Wstrict-aliasing]
Karel Zak [Mon, 15 Oct 2012 15:01:30 +0000 (17:01 +0200)] 
libblkid: fix compiler warning [-Wstrict-aliasing]

libblkid/src/superblocks/befs.c: In function 'get_uuid':
libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoswapon: remove loop declaration [smatch scan]
Sami Kerola [Mon, 8 Oct 2012 07:08:20 +0000 (08:08 +0100)] 
swapon: remove loop declaration [smatch scan]

sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are
only allowed in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomore: remove few memory leaks
Sami Kerola [Mon, 8 Oct 2012 07:08:19 +0000 (08:08 +0100)] 
more: remove few memory leaks

The remaining memory leaks are related to ncurses internals, or the one
open file descriptor when user users 'q' to exit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomore: align void in functions with prototypes, and remove void casts
Sami Kerola [Mon, 8 Oct 2012 07:08:18 +0000 (08:08 +0100)] 
more: align void in functions with prototypes, and remove void casts

If there is void in argument list at function prototype it is reasonable
to expect to see it also where the function is wrote.  This change also
removes unnecessary return value void casting.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>