Sami Kerola [Sun, 27 Jul 2014 17:33:22 +0000 (18:33 +0100)]
logger: add hostname to rfc3164 message
This makes the obsolete protocol a little bit more compliant with the
internet standard, but few should care now when we have rfc5424 support,
and rfc3164 feels broken. For example it requires hostname to be not
fully qualified, which is hard to understand, and should make users to
prefer the new protocol.
Reported-by: Frank Thilo <thilo@unix-ag.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705217 CC: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sun, 27 Jul 2014 17:01:09 +0000 (18:01 +0100)]
logger: warn when --file and command line message are combined
When --file is combined with command line arguments the later has
silently been ignored. This commit makes user to be aware the logger
will not use command line arguments when --file is specified.
Reported-by: "Daniel 'DaB.' Baur" <debian@daniel.baur4.info>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467244 CC: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sat, 28 Jun 2014 14:37:39 +0000 (15:37 +0100)]
docs: add logger protocol notes to manual page
Inform about rfc5424 support, how to control what it includes to
submission, and that it is the new default when sending syslog messages
to remote server without specifying protocol.
Sami Kerola [Thu, 26 Jun 2014 15:13:55 +0000 (16:13 +0100)]
logger: add rfc5424 support
Add support the more recent syslog protocol and make it default. The
older BSD syslog protocol can still be used with option --rfc3164.
Protocols are meaningful only when messages are sent to remote syslog
server.
Requested-by: Kodiak Firesmith <ksf@sei.cmu.edu> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sat, 26 Jul 2014 12:10:25 +0000 (13:10 +0100)]
logger: tidy up main() by adding small functions and ctl data
Add logger_open(), logger_command_line(), logger_stdin(), and
logger_close() functions, and move all remaining option argument
assignments to control structure.
Proposed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sun, 22 Jun 2014 22:43:09 +0000 (23:43 +0100)]
logger: refactor long if clause
When if clause that continues throughout whole function it usually can be
shorten to immediate action, e.g., in this case return on the spot not at
end of the function.
Sami Kerola [Sun, 22 Jun 2014 22:29:36 +0000 (23:29 +0100)]
logger: do not rely only getlogin(3) telling who ran the command
The getlogin(3) is known not to always work, and when that happens it is
reasonable to try determine user of name by looking process owner and
passwd information.
Reference: http://man7.org/linux/man-pages/man3/getlogin.3.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Stef Walter [Thu, 3 Jul 2014 15:44:41 +0000 (17:44 +0200)]
agetty: Reprompt and reprint /etc/issue when asked
Add an 'agetty --reload' command which asks all running agetty
commands to display their prompts again.
Several of the /etc/issue escape codes such as \4 and \S depend on
variable data which can change after the agetty prompt is displayed.
This can cause stale data to be displayed when a user looks at a VT,
especially in cases of DHCP racing with system start up.
We never want this to occur once the user has started typing a
user name. So we detect when the user starts typing, after which
no further reprompting occurs after that point.
[kzak@redhat.com: - add #ifdefs to make it usable on non-inotify systems,
- use futimens() with NULL timespec
- add --reaload to usage()]
Signed-off-by: Stef Walter <stefw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Signed-off-by: Karel Zak <kzak@redhat.com>
various: erase all traces of the long-obsolete xiafs
The xiafs filesystem was removed from the kernel fifteen years ago,
and any kernel that contained it reached end of life ten years ago.
It's time to stop mentioning it in the mount man page and elsewhere.
tests: Fall back on host/getent in ts_resolve_host
Neither dig or nslookup would be my first option for resolving,
so add the host utility of ISC/bind fame and the (slow) getent
utility shipped with libc.
Karel Zak [Fri, 25 Jul 2014 10:28:34 +0000 (12:28 +0200)]
libmount: don't use /{proc,ext}/filesystems when more fs types specified
# mkfs.ext4 /dev/sda1
# mount -t foo,bar /dev/sda1 /mnt
successfully mount the device, this is unexpected as extN is no
between wanted (by -t specified) filesystems.
Summary about -t:
* "mount -t foo" mount(2) with "foo" type
* "mount -t foo,bar" try mount(2) with "foo" or "bar"
* "mount -t foo,auto" try mount(2) with "foo" or ask libblkid for
the type
* "mount -t nofoo,bar" try types from /{etc,proc}/filesystems, but
exclude "foo" and "bar"
Note that more filesystems may be specified in fstab (as comma
delimited list). The stuff from fstab is always interpreted as list
and never as a pattern ("no" prefix makes no sense in fstab).
Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
textual: fix some typos and inconsistencies in various messages
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).
Sami Kerola [Tue, 1 Jul 2014 20:40:04 +0000 (21:40 +0100)]
swapon: share get_swap_prober() with swaplabel to print uuid and label
The swapon(8) listing was almost complete, apart from label and uuid.
This change moves the code from swaplabel(8) to shared scope to be used
for printouts in other swap commands, such as swapon.
Adding this feature to lsblk(8) was a consideration, but lsblk is not
interested of swapfiles, so the swapon seems like a better option to add
this information.
Karel Zak [Tue, 22 Jul 2014 10:12:52 +0000 (12:12 +0200)]
Merge branch 'rename' of git://github.com/kerolasa/lelux-utiliteetit
* 'rename' of git://github.com/kerolasa/lelux-utiliteetit:
tests: add rename(1) return value check
rename: use function pointer to select file or symlink operation
rename: continue despite something failed
tests: add rename(1) checks
tests: use ts_cd everywhere to change direcrory
tests: add function to change directory reliable way
rename: allow renaming in subdirectories
docs: bring eight more man pages closer to standard formatting
Also, for chcpu, the options -c, -d, -e and -g are mutually exclusive,
and for the mode argument the option -p is not optional. For ldattach,
use the standard options separator ", " instead of the unusual " | ".
And add the missing --version to several of the pages. Besides, improve
the wording and the consistency of the spacing.
Sami Kerola [Sun, 22 Jun 2014 09:20:54 +0000 (10:20 +0100)]
tests: add function to change directory reliable way
Without arguments bash cd will move to $HOME. Ensure also that when
directory is assumed to be changed the current directory and intented
destination are the same location.
Reference: http://www.spinics.net/lists/util-linux-ng/msg09509.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sun, 25 May 2014 21:17:25 +0000 (22:17 +0100)]
rename: allow renaming in subdirectories
Earlier the rename(1) considered path as possible string to be renamed,
could lead to an issue with none existing destination. See below for
demonstration of this issue. After this change all directory elements
are ignored when the match finding happens.
$ cd $(mktemp -d)
$ mkdir aa ab
$ touch a{a,b}/aa
$ rename -v a x */aa
rename: aa/aa: rename to xa/aa failed: No such file or directory
Karel Zak [Thu, 17 Jul 2014 15:17:46 +0000 (17:17 +0200)]
lsblk: check number of used columns
The current code does not check size of the columns[] array when add
the next on command line specified column. We check the array size for
"-o <columns>" but not for another options.
Old version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
xargs: lsblk: terminated by signal 11
new version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
lsblk: too many columns specified, the limit is 83 columns.
docs: bring four more man pages closer to standard formatting
In the IPC man pages strictly adhere to the memory, queue, semaphore
order, to reduce disorientation. And for 'ipcmk', the arguments for
-M and -S and -p are not optional. Add --version for 'mountpoint'.
Sami Kerola [Wed, 16 Jul 2014 20:54:57 +0000 (21:54 +0100)]
fallocate: avoid unnecessary computation
Where POSIX_FADV_SEQUENTIAL and HAVE_POSIX_FADVISE are not available it
is waste of resources to have variables that are meaningful only for
posix_fadvise(). Also initialize the variables immediately to correct
values, and since cachesz is never changed mark it read only.