summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
* logger: sort the options in the manpage alphabeticallyBenno Schulenberg2015-11-091-47/+46Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: improve grammar and formatting of the manpageBenno Schulenberg2015-11-091-50/+53
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: shadow declarationSami Kerola2015-11-061-7/+7
| | | | | | | | misc-utils/logger.c:448:17: warning: declaration of 'msg' shadows a parameter [-Wshadow] misc-utils/logger.c:429:74: note: shadowed declaration is here Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Merge branch 'cal-span' of https://github.com/Deiz/util-linuxKarel Zak2015-11-052-8/+21
|\ | | | | | | | | | | * 'cal-span' of https://github.com/Deiz/util-linux: cal: Add --span option cal: Track date span independently from months_in_row
| * cal: Add --span optionDeiz2015-10-102-8/+18
| | | | | | | | | | | | | | This allows the date spanning behaviour of -3 to be used with other month ranges. Signed-off-by: Deiz <silverwraithii@gmail.com>
| * cal: Track date span independently from months_in_rowDeiz2015-10-101-1/+4
| | | | | | | | | | | | | | | | This fixes a minor issue where cal -n 3 would mirror the spanning behaviour of cal -3 with Gregorian calendars, instead of starting with the current month. Signed-off-by: Deiz <silverwraithii@gmail.com>
* | logger: remove unnecessary commentKarel Zak2015-10-291-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: use --id as local socket credentialsKarel Zak2015-10-292-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you have really paranoid syslog (or systemd who listens on /dev/log) then it replaces in the message PID with a real PID from socket header credentials: # echo $PPID 1550 # logger -p info --stderr --id=$PPID "This is message baby!" <14>Oct 29 11:22:13 kzak[1550]: This is message baby! # journald -n 1 Oct 29 11:22:13 ws kzak[22100]: This is message baby! ^^^^^ This patch forces kernel to accept another *valid* PID if logger(1) executed with root permissions; improved version: # logger -p info --stderr --id=$PPID "This is message baby!" <14>Oct 29 11:26:00 kzak[1550]: This is message baby! # journald -n 1 Oct 29 11:26:00 ws kzak[1550]: This is message baby! Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: use iovec for all messageKarel Zak2015-10-271-20/+45
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: use iovec and sendmsg() to send messageKarel Zak2015-10-271-11/+19
| | | | | | | | | | | | | | | | | | The iovec based solutions allow to send multiple strings by one syscall (for example additional \n messages separator). We can also use it to send additional socket header metadata (e.g. SCM_CREDENTIALS) later. Signed-off-by: Karel Zak <kzak@redhat.com>
* | mount, umount, swapon, fsck, lsblk, findmnt: ignore malformed linesKarel Zak2015-10-152-1/+12
|/ | | | | | | | | | | | | | | | | The libmount provides way how to deal with parsing errors in fstab -- on error callback function is executed and according to the return libmount manipulate with the malformed line, possible are three states: 1/ fatal error; all file ignored (callback rc < 0) 2/ recoverable error; malformed line ignored (callback rc > 0) 3/ ignore the error (callback rc == 0) The 2/ is the default if no callback specified. Unfortunately our utils uses 3/. The correct way is to use 2/. Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: add debug message for timeoutKarel Zak2015-10-091-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use REALTIME_LIBSKarel Zak2015-10-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: use cxt->quietKarel Zak2015-10-091-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: fix compiler warning [-Wsign-compare]Karel Zak2015-10-091-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: fix shadow declarationSami Kerola2015-10-091-5/+5
| | | | | | | | misc-utils/uuidd.c:384:13: warning: declaration of 'ret' shadows a previous local [-Wshadow] misc-utils/uuidd.c:327:6: note: shadowed declaration is here Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: use signalfd() and setup_timer()Sami Kerola2015-10-092-41/+98
| | | | | | | | Point of this change is to replace use of signal() and alarm() system calls using newer interfaces. Nice side effect is that the point where timer was earlier used cannot be distracted by sending rogue SIGALRM. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blkid, uuidd, uuidgen: assume getopt.h and getopt.h are availableSami Kerola2015-10-093-22/+0Star
| | | | | | These headers are in use allover this project without issues. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: slice up the usage text and normalize its layoutSami Kerola2015-10-091-19/+17Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: fix messages separation on UNIX socketKarel Zak2015-10-061-11/+23
| | | | | | | | | | | | | | | | | | | | The function write_output() add additional \n after each message on TYPE_TPC. This is required by syslog daemons, otherwise you will see multiple log messages merged together in your log file, for example: Oct 6 09:01:40 ws kzak: AAA<14>Oct 6 09:01:40 kzak: BBB for printf "AAA\nBBB\n" | logger -p info -u <any-socket> Unfortunately, the connection initialization functions keep the default ALL_TYPES as connection type and nowhere in the control struct is info about the final real connection type. The problem is invisible when you specify --tpc or --udp on logger command line. Addresses: https://github.com/karelzak/util-linux/issues/225 Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: improve socket activation error messagingSami Kerola2015-10-021-3/+11
| | | | | | | Tell more exactly what is wrong and how, and give hint how to recover when possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: add --sd-id and -sd-paramKarel Zak2015-10-013-18/+276
| | | | | | | | | | | | | | | | | | This patch add support for RFC 5424 structured data elements. For example: logger --rfc5424 --sd-id zoo@123 \ --sd-param tiger=\"hungry\" \ --sd-param zebra=\"running\" \ --sd-id manager@123 \ --sd-param onMeeting=\"yes\" \ "this is message" produces: <13>1 2015-10-01T14:07:59.168662+02:00 ws kzak - - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="218616"][zoo@123 tiger="hungry" zebra="running"][manager@123 onMeeting="yes"] this is message Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: improve logger --journald man page exampleMichal Schmidt2015-09-071-1/+7
| | | | | | | | | | | | | | | | The example use of logger --journald in the man page has a couple of flaws: - It's missing a "MESSAGE=" field. This is supposed to be the primary human readable text. Without it the log entry is invisible in a plain "journalctl" output. - The MESSAGE_ID is supposed to be a 128-bit hexadecimal string that globally uniquely identifies the message type. One can generate such an id with "journalctl --new-id". This patches fixes the above and also changes the example to use a here-document instead of printf. In my opinion it makes the expected multi-line data format more obvious. Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
* cal: check biggest week number correctly when highlightingSami Kerola2015-08-311-1/+1
| | | | | | | This allows Sunday based week 54 be highlighted, and deny week 54 for Monday based weeks when year has only 52 weeks. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cal: replace magic constants with symbolical valuesSami Kerola2015-08-311-32/+41
| | | | | | This makes it easier to know what the values in guestion represent. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cal: correct gregorian week numberingSami Kerola2015-08-311-18/+15Star
| | | | | | | | | | | Jan 1 is always First week, and year always has 53 weeks. The week 53 may be cut short, e.g., it may and often has fewer than 7 days. Every year 28 year intervals US week numbering continues all the way to 54th week, such as 1972, 2000, and 2028. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1249486 Reported-by: Michal Toth Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: fix resource leak [coverity scan]Andreas Henriksson2015-08-311-1/+3
| | | | Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* Fix typos in --targetFrederick Grose2015-08-141-4/+4
|
* logger: improve readability [smatch scan]Karel Zak2015-08-051-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lslocks: slice up the recently modified usage textBenno Schulenberg2015-08-031-8/+10
| | | | | | For ease of translation when it changes. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* lsblk: Display mountpoint even for top-level deviceMilan Broz2015-07-311-2/+1Star
| | | | | | | | | | | | | | | | | | | | If a filesystem is mounted on top-level block device with existing partitions, the mountpoint is not displayed in the lsblk output. This situation can happen by a configuration mistake and lsblk could be used to detect such a mistake. This patch allows searching for a mountpoint for all displayed devices, not only for leaf nodes. (It should be pretty cheap operation, mtab is parsed only once.) For example: lsblk /dev/loop1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop1 7:1 0 128M 0 loop /mnt/tst └─loop1p1 259:0 0 127M 0 loop Signed-off-by: Milan Broz <gmazyland@gmail.com>
* mcookie: fix -f usage [clang analyze]Karel Zak2015-07-291-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: Add support to logger for RFC6587 octet countingAlex Bligh2015-07-292-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support to logger for RFC6587 octet counting. RFC6587 provides support for two sorts of framing: 1. Octet counting (at RFC6587 s3.4.1) In essence each frame is preceded by a decimal length and a space. 2. Non-transparent framing (at RFC6587 s3.4.2), also called 'octet stuffing' In essence each frame is terminated by a `\n` Prior to this patch, logger used option 2 (non-transparent framing) on TCP, and used no framing on UDP. After this patch, the default behaviour is unchanged, but if the '--octet-count' option is supplied, option 1 is used for both TCP and UDP. Arguably octet count framing makes little sense on UDP, but some servers provide it and this allows testing of those servers. Signed-off-by: Alex Bligh <alex@alex.org.uk>
* logger: do not exit when socket errors are not enforcedSami Kerola2015-07-201-4/+5
| | | | | | | | | | | | | | | The libc openlog(3) does not have error detection whether unix socket could be opened. As a side effect that made it possible to use logger even if syslogd was not running. Of course user message in these cases were lost. This change makes the logger do behave similar way again, so that sysvinit scripts can successfully pipe messages to logger when ever. Addresses: https://bugs.debian.org/787864 Addresses: https://bugs.debian.org/790875 Reported-by: Andreas Beckmann <anbe@debian.org> Reported-by: Andreas Henriksson <andreas@fatal.se> Tested-by: Robie Basak <robie.basak@ubuntu.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: Add verbose to man page.Raghavendra D Prabhu2015-07-031-0/+3
| | | | | kill adds a verbose option to print the pid(s) and the signal. It is added to man page here.
* getopt: use $(...) command substitution in example script [shellcheck]Sami Kerola2015-06-291-2/+2
| | | | | Reference: https://github.com/koalaman/shellcheck/wiki/SC2006 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid/whereis: simplify some conditions [cppcheck]Boris Egorov2015-06-251-1/+1
| | | | | | | | | [misc-utils/whereis.c:466]: (style) Redundant condition: uflag. 'A && (!A || B)' is equivalent to 'A || B' [libblkid/src/tag.c:373]: (style) Redundant condition: dev. 'A && (!A || B)' is equivalent to 'A || B' Signed-off-by: Boris Egorov <egorov@linux.com>
* rename: allow full-path renamesAndreas Henriksson2015-06-251-2/+3
| | | | | | | | | | | The command "touch b0;rename.ul -v ./b0 ./b1 ./b0" used to work before "allow renaming in subdirectories" change. (regression in commit bd9ced628bb86) Addresses: https://bugs.debian.org/789240 Reported-by: gregrwm <bug-grub@whitleymott.net> Reviewed-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* cal: correct the man page: the reformation eliminated eleven days, not tenBenno Schulenberg2015-06-251-7/+7
| | | | | | | Also tweak some other wordings and formatting. Reported-by: Felix Neumann <felix.neumann@inka.de> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: add note about kern->user conversionKarel Zak2015-06-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lslocks: add --jsonKarel Zak2015-06-052-2/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --jsonKarel Zak2015-06-052-4/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: add --jsonKarel Zak2015-06-042-2/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk.8: Fix description of output formatStanislav Brabec2015-06-021-2/+2
| | | | Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* lsblk: use internally sysfs devnamesKarel Zak2015-05-291-5/+4Star
| | | | | | | It seems better to keep the strange sysfs devnames internally and translate to real devnames only on output or when we read from /dev. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: rename devname functions, cleanupKarel Zak2015-05-281-8/+11
| | | | | | | | | | | | | | | | | | Well, I don't have mental power to use function names like sysfs_devname_to_dev_name() so this patch renames to sysfs_devname_sys_to_dev() sysfs_devname_dev_to_sys() It also cleanups usage of the functions. We have to be sure that sysfs.c code returns regular devnames. The existence of the sysfs devnames (with '!') should be completely hidden in sysfs specific code. Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix /sys to /dev node name translationStanislav Brabec2015-05-261-0/+1
| | | | | | | | | | | | | | linux/drivers/base/core.c: device_get_devnode() defines a translation of '!' in sysfs nodes to '/' in /dev nodes. The same translation has to be done to properly support device nodes with slash (e. g. device nodes of cciss driver and several other drivers). Introduce new helper sysfs_devname_to_devno() and use it where appropriate. Fixes for example lsblk -f on devices using cciss driver. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* blkid: another hint to the man pageKarel Zak2015-05-211-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: be more precise in the man pageKarel Zak2015-05-211-5/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: don't ignore info about partitions on non-formated devicesKarel Zak2015-05-211-15/+0Star
| | | | | | | | | | | | |  # blkid -p /dev/sdc1; echo $? 2 but libblkid provides information about partition, fixed version: # blkid -p /dev/sdc1; echo $? /dev/sdc1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="4c1e518c-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="1021952" PART_ENTRY_DISK="8:32" 0 Signed-off-by: Karel Zak <kzak@redhat.com>