]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 years agosfdisk: make unhiding as complete as possible
Sami Kerola [Sun, 7 Jul 2013 19:54:16 +0000 (20:54 +0100)] 
sfdisk: make unhiding as complete as possible

It is unlikely anyone will ever need this, but I like idea commands being
complete.  The partition id's that can be unhide after this change are;

Hidden HPFS/NTFS
Hidden W95 FAT32
Hidden W95 FAT32 (LBA)
Hidden W95 FAT16 (LBA)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoMerge branch 'patch-1' of https://github.com/kernc/util-linux
Karel Zak [Tue, 9 Jul 2013 09:16:28 +0000 (11:16 +0200)] 
Merge branch 'patch-1' of https://github.com/kernc/util-linux

* 'patch-1' of https://github.com/kernc/util-linux:
  Fixes "getty: unrecognized option '--loginpause'"

12 years agodocs: make description of --activate clearer on man page of sfdisk
Benno Schulenberg [Wed, 3 Jul 2013 10:09:10 +0000 (12:09 +0200)] 
docs: make description of --activate clearer on man page of sfdisk

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agodocs: fix wording and formatting of man page for dmesg
Benno Schulenberg [Wed, 3 Jul 2013 09:34:25 +0000 (11:34 +0200)] 
docs: fix wording and formatting of man page for dmesg

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agodocs: improve formatting and wording of man pages for fdisk and cfdisk
Benno Schulenberg [Sun, 16 Jun 2013 12:37:52 +0000 (14:37 +0200)] 
docs: improve formatting and wording of man pages for fdisk and cfdisk

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agounshare: add --mount-proc for pid namespaces
Karel Zak [Wed, 3 Jul 2013 10:28:16 +0000 (12:28 +0200)] 
unshare: add --mount-proc for pid namespaces

Based on patch from Mike Frysinger <vapier@gentoo.org>.

Mike Frysinger wrote:
 When it comes to pid namespaces, it's also useful for /proc to reflect
 the current namespace.  Again, this is easy to pull off, but annoying
 to force everyone to do it themselves.  So let's add a --mount-proc to
 do the magic for us.  The downside is that this also implies creating
 a mount namespace as mounting the new pid namespace /proc over top the
 system one will quickly break all other processes on the system.

Signed-off-by: Karel Zak <kzak@redhat.com>
Acked-by: Mike Frysinger <vapier@gentoo.or>
12 years agounshare: add --fork options for pid namespaces
Mike Frysinger [Fri, 28 Jun 2013 00:04:58 +0000 (20:04 -0400)] 
unshare: add --fork options for pid namespaces

The ability of unshare to launch a new pid namespace is a bit limited.
The first process in the namespace is expected to be the "init" for it.
When it's not, you get bad behavior.

For example, trying to launch a shell in a new pid namespace fails very
quickly:
$ sudo unshare -p dash
# uname -r
3.8.3
# uname -m
dash: 2: Cannot fork
# ls -ld /
dash: 3: Cannot fork
# echo $$
1324

For this to work smoothly, we need an init process to actively watch over
things.  But forcing people to re-use an existing init or write their own
mini init is a bit overkill.  So let's add a --fork option to unshare to
do this common bit of book keeping.  Now we can do:
$ sudo unshare -p --fork dash
# uname -r
3.8.3
# uname -m
x86_64
# ls -ld /
drwxr-xr-x 22 root root 4096 May  4 14:01 /
# echo $$
1

Thanks to Michael Kerrisk for his namespace articles on lwn.net

[kzak@redhat.com: - fix "forkif logic, remove --mount-proc]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/xalloc: add warn_unused_result to allocation functions
Karel Zak [Tue, 9 Jul 2013 08:44:06 +0000 (10:44 +0200)] 
include/xalloc: add warn_unused_result to allocation functions

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: use devno to check if the filesystem is mounted
Karel Zak [Mon, 8 Jul 2013 12:21:03 +0000 (14:21 +0200)] 
lsblk: use devno to check if the filesystem is mounted

The device (for example LVM logical volume) could be renamed and then
the device name from /proc/self/mountinfo does not match with reality.
So, we also need to check devno. Unfortunately we cannot completely
rely on devno, because for example btrfs uses psudo device numbers.

References: https://bugzilla.redhat.com/show_bug.cgi?id=980463
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: use devno to get mountpoint
Karel Zak [Mon, 8 Jul 2013 12:21:03 +0000 (14:21 +0200)] 
lsblk: use devno to get mountpoint

The device (for example LVM logical volume) could be renamed and then
the device name from /proc/self/mountinfo does not match with reality.
So, we also need to check devno. Unfortunately we cannot completely
rely on devno, because for example btrfs uses psudo device numbers.

References: https://bugzilla.redhat.com/show_bug.cgi?id=980463
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoFixes "getty: unrecognized option '--loginpause'"
kernc [Thu, 4 Jul 2013 15:02:57 +0000 (17:02 +0200)] 
Fixes "getty: unrecognized option '--loginpause'"

Usage incorrectly stated --loginpause is a valid option, where instead --login-pause is.

Also --no-hostname --> --nohostname.

12 years agofindmnt: avoid unused parameter warning
Karel Zak [Wed, 3 Jul 2013 10:42:06 +0000 (12:42 +0200)] 
findmnt: avoid unused parameter warning

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: update libmount fstab full parse test
Karel Zak [Wed, 3 Jul 2013 09:23:39 +0000 (11:23 +0200)] 
tests: update libmount fstab full parse test

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: add functions to safely replace a fs table
Ondrej Oprala [Fri, 14 Jun 2013 11:00:49 +0000 (13:00 +0200)] 
libmount: add functions to safely replace a fs table

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
12 years agolibmount: add functions to handle comments in fs tables
Ondrej Oprala [Fri, 14 Jun 2013 10:41:30 +0000 (12:41 +0200)] 
libmount: add functions to handle comments in fs tables

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: add a generic append_string() function
Karel Zak [Tue, 2 Jul 2013 09:58:58 +0000 (11:58 +0200)] 
libmount: add a generic append_string() function

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: be more restrictive about valid tag names
Karel Zak [Tue, 2 Jul 2013 08:46:10 +0000 (10:46 +0200)] 
libmount: be more restrictive about valid tag names

 # mount DUMMY=filename.img /mnt

The 'DUMMY=filename.img' is a filename and should not be
interpreted as tag name. The valid tag names are LABEL, UUID,
PARTLABEL and PARTUUID only.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/canonical: use realpath() from libc
Karel Zak [Mon, 1 Jul 2013 14:13:46 +0000 (16:13 +0200)] 
lib/canonical: use realpath() from libc

.. after many many years it seems that we can follow libc code rather
than duplicate realpath(3) implementation.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofindmnt: make udev usage more robust
Karel Zak [Mon, 1 Jul 2013 13:59:16 +0000 (15:59 +0200)] 
findmnt: make udev usage more robust

 $ findmnt -rn --target /home/kzak/.bashrc -o UUID

uses libudev to ask for UUID, unfortunately /home/kzak is DM device
and libudev expects sysfs-like names (e.g. dm-0). We have to convert
the name to kernel devname.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodmesg: make time stamps to be printed consistently
Sami Kerola [Sun, 30 Jun 2013 18:11:22 +0000 (19:11 +0100)] 
dmesg: make time stamps to be printed consistently

Earlier uptime determination, which was done with sysinfo(2), had one
second resolution, which made time stamps to be rounded unstable way
depending on when a dmesg command was executed.  In practical terms; the
command below was supposed not to differ but it did.

$ diff -q <(dmesg --ctime) <(sleep 0.5 ; dmesg --ctime)

[kzak@redhat.com: - add -lrt to Makemodule.am,
                  - fallback to sysinfo() based boot time
                  - use #ifdef]

CC: Kay Sievers <kay@vrfy.org>
References: https://lkml.org/lkml/2013/6/30/37
Buglink: https://github.com/karelzak/util-linux/issues/24
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosfdisk: fix typo
Karel Zak [Mon, 1 Jul 2013 12:06:16 +0000 (14:06 +0200)] 
sfdisk: fix typo

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoul: enhance command performance
Sami Kerola [Sun, 30 Jun 2013 08:44:00 +0000 (09:44 +0100)] 
ul: enhance command performance

Avoid reseting, time after time, the memory which was not used.  Effect
of the change is below in before and after timings.

$ time ./ul </etc/services >/dev/null
real    0m0.320s
user    0m0.307s
sys     0m0.010s

$ time ./ul </etc/services >/dev/null
real    0m0.068s
user    0m0.050s
sys     0m0.017s

[kzak@redhat.com: - add "else" and use maxcol]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoexec_shell: add a license and touch up func def
Mike Frysinger [Fri, 28 Jun 2013 00:05:18 +0000 (20:05 -0400)] 
exec_shell: add a license and touch up func def

When this file was created, the standard license header was missed.
Add it using the same one from unshare.c.

The noreturn attribute is not needed since we include the header
which has it on the prototype.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agodmesg: define is_timefmt() macro only once
Karel Zak [Mon, 1 Jul 2013 09:29:06 +0000 (11:29 +0200)] 
dmesg: define is_timefmt() macro only once

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodmesg: fix --human color initialization
Karel Zak [Mon, 1 Jul 2013 09:17:17 +0000 (11:17 +0200)] 
dmesg: fix --human color initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosfdisk: clean up unhide code
Karel Zak [Mon, 1 Jul 2013 09:11:24 +0000 (11:11 +0200)] 
sfdisk: clean up unhide code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agohexdump: remove unnecessary global variables
Sami Kerola [Sun, 16 Jun 2013 18:53:55 +0000 (19:53 +0100)] 
hexdump: remove unnecessary global variables

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosd-daemon: update files taken from systemd project
Sami Kerola [Sun, 16 Jun 2013 18:53:54 +0000 (19:53 +0100)] 
sd-daemon: update files taken from systemd project

Update sd-damoen.[hc] files from systemd upstream, using commit
fa3868c6d317b88715c55422b898f9070afe6575 as the sync point.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodmesg: regroup time related options close to each other
Sami Kerola [Sun, 16 Jun 2013 18:53:53 +0000 (19:53 +0100)] 
dmesg: regroup time related options close to each other

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: add --time-format option and ISO-8601 format to manual
Sami Kerola [Sun, 16 Jun 2013 18:53:52 +0000 (19:53 +0100)] 
docs: add --time-format option and ISO-8601 format to manual

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodmesg: add iso-8601 time format
Sami Kerola [Sun, 16 Jun 2013 18:53:51 +0000 (19:53 +0100)] 
dmesg: add iso-8601 time format

The ISO-8601 should be welcomed by anyone who tries to parse dmesg time
stamp, and compare them across servers.  Time format tries to imitate
coreutils 'date --iso-8601=ns' output, but instead of having nanoseconds
the dmesg is using microseconds.

Reference: http://www.cs.tut.fi/~jkorpela/iso8601.html
Addresses: http://xkcd.com/1179/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodmesg: add --time-format option
Sami Kerola [Sun, 16 Jun 2013 18:53:50 +0000 (19:53 +0100)] 
dmesg: add --time-format option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodmesg: convert time format bitfield to enum
Sami Kerola [Sun, 16 Jun 2013 18:53:49 +0000 (19:53 +0100)] 
dmesg: convert time format bitfield to enum

Foremost this commit makes time printing formats explicit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosfdisk: replace my_warn() with warnx()
Sami Kerola [Sun, 16 Jun 2013 18:53:48 +0000 (19:53 +0100)] 
sfdisk: replace my_warn() with warnx()

This change adds program name in front of error messages.  Often that
helps user to know which command sent message, when the command is
executed as part of script.

Unfortunately the prefixing can break scripts, as someone might have
wrote automation which expects output in the format it has always been.
In programmer terms, the change has an ABI change, which some may find
annoying.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: correct sfdisk --activate instructions
Sami Kerola [Sun, 16 Jun 2013 18:53:46 +0000 (19:53 +0100)] 
docs: correct sfdisk --activate instructions

The activate can be enabled by renaming the command to 'activate'.  Quite
confusingly the option and command arguments are interchangeable, and
depending on which one is defined as --activate option argument the
command will behave different rather different ways.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosfdisk: use program_invocation_short_name to determine program name
Sami Kerola [Sun, 16 Jun 2013 18:53:45 +0000 (19:53 +0100)] 
sfdisk: use program_invocation_short_name to determine program name

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosfdisk: clean up usage() functions
Sami Kerola [Sun, 16 Jun 2013 18:53:44 +0000 (19:53 +0100)] 
sfdisk: clean up usage() functions

Includes removal of unhide usage function, which was never implemented.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosfdisk: use libc error printing function, and symbolic exit values
Sami Kerola [Sun, 16 Jun 2013 18:53:43 +0000 (19:53 +0100)] 
sfdisk: use libc error printing function, and symbolic exit values

The commit removes all references to perror(), and replaces them with
either warn() or err().

References: http://marc.info/?l=util-linux-ng&m=137060043804592&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agorenice: exit with non-zero value when arguments cause warnings
Sami Kerola [Sun, 16 Jun 2013 18:53:42 +0000 (19:53 +0100)] 
renice: exit with non-zero value when arguments cause warnings

This commit also fixes potential error counter wrap, which theoretically
could make command to exit with a success when it internally failed just
correct amount of times.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agofindmnt: test for fstype/options/maj:min before source and target
Karel Zak [Mon, 24 Jun 2013 11:28:06 +0000 (13:28 +0200)] 
findmnt: test for fstype/options/maj:min before source and target

This change allows to exclude for example NFS mountpoint:

  findmnt --fstab --target /mnt/foo --type nonfs

to stall on a stalled nfs mount.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoeject: Check host_status and driver_status when using SG_IO.
Karel Zak [Tue, 18 Jun 2013 10:24:28 +0000 (12:24 +0200)] 
eject: Check host_status and driver_status when using SG_IO.

Based on Suse patch, originally from
Anna Bernathova <anicka@suse.cz>, May 2008

  SG_IO completion status is weird but still well defined. You'll need
  to check both host_status, driver_status and status to determine that
  a command actually succeeded. -- Tejun Heo, May 2008

Note that we also need to check driver_status and sense_buffer to
detect situation when there is no medium. It's valid request to call
eject(8) for device with no medium.

References: https://bugzilla.novell.com/show_bug.cgi?id=358033
Signed-off-by: Anna Bernathova <anicka@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: improve wording, grammar and some formatting in man page
Benno Schulenberg [Fri, 14 Jun 2013 09:46:09 +0000 (11:46 +0200)] 
agetty: improve wording, grammar and some formatting in man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agoagetty: fix a kill/erase error in man page and improve clarity
Benno Schulenberg [Sat, 8 Jun 2013 18:10:41 +0000 (20:10 +0200)] 
agetty: fix a kill/erase error in man page and improve clarity

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agopg.c: Add --help and --version
Jari Aalto [Fri, 14 Jun 2013 09:42:27 +0000 (12:42 +0300)] 
pg.c: Add --help and --version

[kzak@redhat.com: - use USAGE_{HELP,VERISON} macros]

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: fix mistaken word and some grammar in man page of mount
Benno Schulenberg [Sun, 9 Jun 2013 08:50:01 +0000 (10:50 +0200)] 
mount: fix mistaken word and some grammar in man page of mount

Reported-by: Krzysztof Żelechowski <giecrilj@stegny.2a.pl>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agonsenter: Allow selecting the uid and gid to be used in the entered userns
Richard Weinberger [Tue, 18 Jun 2013 08:35:44 +0000 (10:35 +0200)] 
nsenter: Allow selecting the uid and gid to be used in the entered userns

Using -S (--setuid) and -G (--setgid) one can select the uid/gid which
will be used in the entered user namespace.

[kzak@redhat.com: - use setuid/gid unconditionally (always),
                  - update man page]

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agocal: fix -y output for UTF8
Karel Zak [Mon, 17 Jun 2013 16:08:01 +0000 (18:08 +0200)] 
cal: fix -y output for UTF8

... in the yearly() function is a static buffer where is not space for
multibyte headers. The patch also clean ups function where we
initialize headers.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: be robust for empty target/source strings
Karel Zak [Mon, 17 Jun 2013 11:02:15 +0000 (13:02 +0200)] 
libmount: be robust for empty target/source strings

 * lib/canonicalize.c: don't interpret empty strings as relative paths
 * libmount: more robust libmnt_table find function and debug messages

References: https://bugzilla.novell.com/show_bug.cgi?id=825150
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: support pseudo PARTUUID= for MBR
Karel Zak [Thu, 13 Jun 2013 13:11:04 +0000 (15:11 +0200)] 
libblkid: support pseudo PARTUUID= for MBR

  # blkid /dev/sdb1
  dev/sdb1: TYPE="ext2" PARTUUID="54e743a7-01"

the PARTUUID is generated from MBR Id and partition number. The same
method uses Linux kernel for root=PARTUUID= on systems with MBR.

Note that the patch also removes 0x prefix from PTUUID.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: split blkid_parttable_set_id()
Karel Zak [Thu, 13 Jun 2013 12:45:36 +0000 (14:45 +0200)] 
libblkid: split blkid_parttable_set_id()

to avoid things like strcmp(tab->type, "gpt") in generic code.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoblkid: export ID_PART_TABLE_UUID
Karel Zak [Thu, 13 Jun 2013 12:36:02 +0000 (14:36 +0200)] 
blkid: export ID_PART_TABLE_UUID

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: set PTUUID for GPT and DOS
Karel Zak [Thu, 13 Jun 2013 12:35:34 +0000 (14:35 +0200)] 
libblkid: set PTUUID for GPT and DOS

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: add functions to set PTUUID
Karel Zak [Thu, 13 Jun 2013 12:35:05 +0000 (14:35 +0200)] 
libblkid: add functions to set PTUUID

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: make uuid_is_empty() usable for whole library
Karel Zak [Thu, 13 Jun 2013 12:33:47 +0000 (14:33 +0200)] 
libblkid: make uuid_is_empty() usable for whole library

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomkfs.bfs: fix 64-Bit and endian problems
ihno [Fri, 7 Jun 2013 18:29:42 +0000 (20:29 +0200)] 
mkfs.bfs: fix 64-Bit and endian problems

[kzak@redhat.com: - use cpu_to_leXX() macros rather than htoleXX()]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoMerge branch 'master' of https://github.com/eric-s-raymond/util-linux
Karel Zak [Thu, 13 Jun 2013 11:32:02 +0000 (13:32 +0200)] 
Merge branch 'master' of https://github.com/eric-s-raymond/util-linux

* 'master' of https://github.com/eric-s-raymond/util-linux:
  Fix broken list syntax.
  Restore use of correct alternation syntax using { | }.
  Re-layout a FILES section in the traditional style.
  Remove another .ti for .RS/.RE, and remove a .TP that broke list parsing.
  Replace .IP o with .IP \(bu, using the [nt]roff bullet character.
  Replace .ti operations with equivalent .RS/.RE pairs.

12 years agofdisk: add support for the MicroBlaze architecture
Nathan Rossi [Fri, 7 Jun 2013 04:08:06 +0000 (14:08 +1000)] 
fdisk: add support for the MicroBlaze architecture

Add support to fdisk for the MicroBlaze architecture.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
12 years agoeject: unlock door before issuing CDROMEJECT command
Aaron Lu [Thu, 6 Jun 2013 08:28:37 +0000 (16:28 +0800)] 
eject: unlock door before issuing CDROMEJECT command

If user has inserted a disc into the drive, the drive will normally be
locked. When using eject command to eject the drive, we need to unlock
the door first, or the CDROMEJECT command will fail.

Though the 2nd attmpt to eject the drive with eject_scsi will succeed,
it actually does two things: first to unlock the door and then to eject
the tray, both with the SG_IO ioctl. The problem is, Linux SCSI driver
keeps track of if a device is in locked state or not, if we go with
SG_IO to do the unlocking, the driver will not be aware of the unlocking
and would think the drive is locked while actually it has already been
unlocked by the first SG_IO command.

Fix this by issuing a unlock door command before the CDROMEJECT command
in cdrom_eject. Prior to this fix, the following output is expected when
there is a disc inside:

[aaron@aaronlu util-linux-2.22.2]$ eject -v /dev/sr0
eject: device name is `/dev/sr0'
eject: /dev/sr0: mounted on /run/media/aaron/CD_ROM
eject: /dev/sr0: is whole-disk device
eject: /dev/sr0: is removable device
eject: /run/media/aaron/CD_ROM: unmounting
eject: /dev/sr0: trying to eject using CD-ROM eject command
eject: CD-ROM eject command failed
eject: /dev/sr0: trying to eject using SCSI commands
eject: SCSI eject succeeded

After this fix, the following output is expected:
[aaron@aaronlu util-linux-2.22.2]$ ./eject -v /dev/sr0
lt-eject: device name is `/dev/sr0'
lt-eject: /dev/sr0: mounted on /run/media/aaron/CD_ROM
lt-eject: /dev/sr0: is whole-disk device
lt-eject: /dev/sr0: is removable device
lt-eject: /run/media/aaron/CD_ROM: unmounting
lt-eject: /dev/sr0: trying to eject using CD-ROM eject command
lt-eject: CD-ROM eject command succeeded

And the SCSI device's locked state is correct now.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
12 years agoagetty: use O_NONBLOCK only for serial lines with CLOCAL
Karel Zak [Thu, 13 Jun 2013 09:06:13 +0000 (11:06 +0200)] 
agetty: use O_NONBLOCK only for serial lines with CLOCAL

 * regression introduced by ef264c830effc91add6da334204215f61eb8515e

 * also increase sleep when O_NONBLOCK used (grr.. this is so stupid
   thing, do we really need O_NONBLOCK for the stupid serial lines?)

References: https://bugzilla.redhat.com/show_bug.cgi?id=972457
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: don't use ptes[] in generic code
Karel Zak [Wed, 12 Jun 2013 15:32:03 +0000 (17:32 +0200)] 
fdisk: don't use ptes[] in generic code

... the array is MBR specific.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoFix broken list syntax.
Eric S. Raymond [Mon, 10 Jun 2013 21:51:31 +0000 (17:51 -0400)] 
Fix broken list syntax.

Bodiless .TP entries and unterminated .TP lists interfere with page
parsing.

12 years agoRestore use of correct alternation syntax using { | }.
Eric S. Raymond [Mon, 10 Jun 2013 21:18:15 +0000 (17:18 -0400)] 
Restore use of correct alternation syntax using { | }.

This is required in order for ther synopsis to be translated into the
corresponding XML markup.

12 years agoRe-layout a FILES section in the traditional style.
Eric S. Raymond [Mon, 10 Jun 2013 19:58:25 +0000 (15:58 -0400)] 
Re-layout a FILES section in the traditional style.

12 years agoRemove another .ti for .RS/.RE, and remove a .TP that broke list parsing.
Eric S. Raymond [Mon, 10 Jun 2013 19:55:45 +0000 (15:55 -0400)] 
Remove another .ti for .RS/.RE, and remove a .TP that broke list parsing.

12 years agoReplace .IP o with .IP \(bu, using the [nt]roff bullet character.
Eric S. Raymond [Mon, 10 Jun 2013 19:48:41 +0000 (15:48 -0400)] 
Replace .IP o with .IP \(bu, using the [nt]roff bullet character.

This will improve the quality of generated HTML. There is a cost,
which is that most terminal emulators will just display the bullet
as a (less visible) dot.  An alternative to this change would be
to use a * character for the bullet.

12 years agoReplace .ti operations with equivalent .RS/.RE pairs.
Eric S. Raymond [Mon, 10 Jun 2013 19:42:06 +0000 (15:42 -0400)] 
Replace .ti operations with equivalent .RS/.RE pairs.

This change makes automatic lifting to XML-DocBook possible, and
should enable generation of better-quality HTML from these pages.

12 years agotextual: improve clarity of some error messages
Benno Schulenberg [Wed, 5 Jun 2013 19:58:13 +0000 (21:58 +0200)] 
textual: improve clarity of some error messages

Reported-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agocal: fix few type mismatches
Sami Kerola [Sun, 2 Jun 2013 17:51:25 +0000 (18:51 +0100)] 
cal: fix few type mismatches

Sloppiness from commit e44fe4712140774b677de466affc31e0581ee335.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agorev: reduce stream checking when closing read-only file descriptor
Sami Kerola [Sun, 2 Jun 2013 17:51:18 +0000 (18:51 +0100)] 
rev: reduce stream checking when closing read-only file descriptor

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agorev: simplify new line detection and impossible test
Sami Kerola [Sun, 2 Jun 2013 17:51:17 +0000 (18:51 +0100)] 
rev: simplify new line detection and impossible test

The new line detection is earlier using only '\n' so there should not be
need to search for '\r' later.

The detection whether allocated address is pointing to null seems to be
unnecessary.  Assuming xmalloc() returned valid address space the address
should never be 0.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agorev: stop adding new line at the end when input does not have it
Sami Kerola [Sun, 2 Jun 2013 17:51:16 +0000 (18:51 +0100)] 
rev: stop adding new line at the end when input does not have it

When the rev(1) is executed twice outcome is expected to be exactly what
it was originally.  That includes not adding new line at the end of the
output.  The oneliner below demonstrates earlier issue.

$ printf "abc\n123" | rev | rev

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: add lscpu max mhz to manual and bash completion
Sami Kerola [Sun, 2 Jun 2013 17:51:09 +0000 (18:51 +0100)] 
docs: add lscpu max mhz to manual and bash completion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolscpu: add max MHz value to make cpu governor effects more visible
Sami Kerola [Sun, 2 Jun 2013 17:51:08 +0000 (18:51 +0100)] 
lscpu: add max MHz value to make cpu governor effects more visible

The existing 'CPU MHz' is usually dynamic value, which CPU governor
changes up on needs of CPU demand.  Assuming lscpu is used to gather
information to a hardware inventory the dynamic value is misleading.  For
inventing the maximum MHz value is more sensible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolib: remove unused code
Sami Kerola [Sun, 2 Jun 2013 17:51:07 +0000 (18:51 +0100)] 
lib: remove unused code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: slightly correct the man page of column
Benno Schulenberg [Thu, 30 May 2013 20:55:11 +0000 (22:55 +0200)] 
docs: slightly correct the man page of column

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agodocs: normalize the formatting of man pages for nsenter and unshare
Benno Schulenberg [Thu, 30 May 2013 10:40:51 +0000 (12:40 +0200)] 
docs: normalize the formatting of man pages for nsenter and unshare

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agotextual: fix several typos and angular brackets in messages
Benno Schulenberg [Wed, 29 May 2013 19:52:56 +0000 (21:52 +0200)] 
textual: fix several typos and angular brackets in messages

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agotextual: harmonize some loop-device error messages
Benno Schulenberg [Wed, 29 May 2013 19:43:49 +0000 (21:43 +0200)] 
textual: harmonize some loop-device error messages

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agomount: (deprecated) fix typo tailed->failed
Yuri Chornoivan [Wed, 29 May 2013 18:38:00 +0000 (21:38 +0300)] 
mount: (deprecated) fix typo tailed->failed

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
12 years agosu: fix exit status if terminated by signal
Ondrej Oprala [Fri, 17 May 2013 08:50:58 +0000 (10:50 +0200)] 
su: fix exit status if terminated by signal

[kzak@redhat.com: - add comment]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: improve grammar and consistency of comments in login.c
Benno Schulenberg [Wed, 29 May 2013 18:09:20 +0000 (20:09 +0200)] 
docs: improve grammar and consistency of comments in login.c

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agotextual: tiny alphabetical and grammatical tweak
Benno Schulenberg [Wed, 29 May 2013 17:53:38 +0000 (19:53 +0200)] 
textual: tiny alphabetical and grammatical tweak

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agotextual: standardize the spelling of "superuser"
Benno Schulenberg [Wed, 29 May 2013 17:47:48 +0000 (19:47 +0200)] 
textual: standardize the spelling of "superuser"

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agotextual: standardize synopsis for login, and improve an error message
Benno Schulenberg [Wed, 29 May 2013 17:46:23 +0000 (19:46 +0200)] 
textual: standardize synopsis for login, and improve an error message

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agorunuser: update man page, add note about -l vs. -p
Karel Zak [Fri, 7 Jun 2013 09:26:46 +0000 (11:26 +0200)] 
runuser: update man page, add note about -l vs. -p

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: use TCSANOW to remove HUPCL
Karel Zak [Wed, 5 Jun 2013 12:31:00 +0000 (14:31 +0200)] 
login: use TCSANOW to remove HUPCL

Fedora 19, kernel 3.9, systemd 204, telnetd with socket activation.

login(1) code:

        ttt.c_cflag &= ~HUPCL;
        tcsetattr(0, TCSAFLUSH, &ttt);

        close(STDIN_FILENO);
        close(STDOUT_FILENO);
        close(STDERR_FILENO);

        signal(SIGHUP, SIG_IGN);        /* so vhangup() wont kill us */
        vhangup();
        signal(SIGHUP, SIG_DFL);

strace :

ioctl(0, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF, {B9600 opost isig icanon echo ...}) = 0
close(0)                                = 0
close(1)                                = 0
close(2)                                = 0
--- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1, si_uid=0} ---
+++ killed by SIGTERM +++

It seems we get SIGHUP (and SIGTERM from systemd) before vhangup().
The problem occur sometimes.

I guess it's because TCSAFLUSH is not applied immediately, so it would
be probably better to use TCSANOW to make the code more robust.

References: https://bugzilla.redhat.com/show_bug.cgi?id=962145
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: don't remove ECHOCTL from c_lflag
Karel Zak [Mon, 3 Jun 2013 12:06:18 +0000 (14:06 +0200)] 
agetty: don't remove ECHOCTL from c_lflag

It's really unexpected that arrows keys move cursor when agetty/login
asks for login name or password.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=969458
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: update man page and usage()
Karel Zak [Mon, 3 Jun 2013 08:04:43 +0000 (10:04 +0200)] 
agetty: update man page and usage()

 - baud_rate is optional
 - agetty has been rewritten 2 years ago, so don't blame original
   authors in the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: more robust options string parsing
Karel Zak [Thu, 30 May 2013 11:29:34 +0000 (13:29 +0200)] 
libmount: more robust options string parsing

 # mount -o=rw /dev/sdb /mnt/test
 mount: libmount/src/optmap.c:212: mnt_optmap_get_entry: Assertion `namelen' failed.
 Aborted (core dumped)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=968786
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: ignore --preserve-environment, it's mutually exclusive to --login
Karel Zak [Wed, 29 May 2013 09:32:58 +0000 (11:32 +0200)] 
su: ignore --preserve-environment, it's mutually exclusive to --login

Addresses: http://bugs.gnu.org/10317
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologger: small coding style changes
Karel Zak [Wed, 29 May 2013 08:56:05 +0000 (10:56 +0200)] 
logger: small coding style changes

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologger: cleanup usage()
Karel Zak [Wed, 29 May 2013 08:54:51 +0000 (10:54 +0200)] 
logger: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologger: add support for --prio-prefix when logging stdin
Dennis H Jensen [Wed, 22 May 2013 11:12:08 +0000 (13:12 +0200)] 
logger: add support for --prio-prefix when logging stdin

This patch adds a new option to logger that will make it look for a
priority prefix <n> at the beginning of every line. The priority is
a single decimal number formed as explained in syslog(3).

If a prefix is found logger will log the message using the found
facility and level in that prefix, if the prefix doesn't contain a
facility the default facility specified by the -p option will be used.
If no prefix is found, logger will use the priority specified by -p.

[kzak@redhat.com: - add --prio-prefix to usage() output]

Signed-off-by: Dennis H Jensen <dennis.h.jensen@siemens.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agocal: improve coding style
Karel Zak [Tue, 28 May 2013 13:33:05 +0000 (15:33 +0200)] 
cal: improve coding style

 - use static for all global variables
 - use REFORMATION_YEAR macro
 - make if() lines more readable
 - etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agocal: simplify colormode parsing
Karel Zak [Tue, 28 May 2013 13:27:22 +0000 (15:27 +0200)] 
cal: simplify colormode parsing

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoMerge branch 'cal-fourth' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 28 May 2013 13:23:59 +0000 (15:23 +0200)] 
Merge branch 'cal-fourth' of git://github.com/kerolasa/lelux-utiliteetit

* 'cal-fourth' of git://github.com/kerolasa/lelux-utiliteetit:
  docs: cal: stop telling year 9999 is upper limit
  tests: check cal works when year is far in future
  cal: remove arbitrary limit of maxium year being 9999
  cal: use Claus Tøndering's day of the week algorithm
  cal: simplify day_in_week() calculation
  cal: mark all functions static
  cal: stop trimming whitespaces
  tests: add cal day color corner cases
  docs: cal: add --color option description to manual page
  cal: add --color to usage()
  cal: support --color[={auto,always,never}]
  cal: de-duplicate julian specific functions
  cal: remove unnecessary initializations
  cal: simplify calendar reformat calculations
  tests: add calendar reformation check
  cal: clean up use of constants
  cal: convert function like definitions to functions
  cal: fix preprocessor directive indendation

12 years agotextual: fix typo in error message and uniformize their use of period
Benno Schulenberg [Sat, 18 May 2013 07:45:11 +0000 (09:45 +0200)] 
textual: fix typo in error message and uniformize their use of period

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
12 years agogetopt: add reference to /usr/share/docs to man page
Karel Zak [Tue, 28 May 2013 10:53:35 +0000 (12:53 +0200)] 
getopt: add reference to /usr/share/docs to man page

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/tty: fix get_terminal_name() usage, cleanup code
Karel Zak [Tue, 28 May 2013 08:04:16 +0000 (10:04 +0200)] 
lib/tty: fix get_terminal_name() usage, cleanup code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: cal: stop telling year 9999 is upper limit
Sami Kerola [Fri, 24 May 2013 22:42:07 +0000 (23:42 +0100)] 
docs: cal: stop telling year 9999 is upper limit

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