summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
* logger: add --socket-errors compatibility optionSami Kerola2015-02-162-12/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hello, Depending viewpoint this change is either regression fix, or re-regression in context of none-systemd init. I ack the change is sent very late to be part of v2.26, but then again the excess noise was found only because of -rc1 was tested in sysvinit environment. IMHO it would contradict purpose of having rc's if faults will not lead to fixes. I also want to point out the sysvinit scripts are broken, not the logger(1), but getting them corrected is practically impossible. Assuming sysvinit script are further developed by various teams and distributions who maintain them they should use --socket-error=on in future, and write scripts that pass without noise. Meanwhile trying to be clever when to silence errors seems like a reasonable thing to do. --->8---- From: Sami Kerola <kerolasa@iki.fi> Date: Sat, 14 Feb 2015 19:05:55 +0000 Subject: [PATCH] logger: add --socket-errors compatibility option Now when logger(1) has stopped using openlog() for Unix sockets, in commit mentioned in reference, the lack of /dev/log detected will report error accordingly. According to Gabriele Balducci this makes sysvinit style boot scripts to print a lot of errors. So make the logger to detect whether it should be in compatibility mode, and not report errors if logging device is missing. That imitates behavior of glibc openlog(). To allow full control to users the /dev/log error messages can be forced to on or off. The automatic error messaging is explained in manual page. Reference: 1d57503378bdcd838365d625f6d2d0a09da9c29d Reported-by: Gabriele Balducci <balducci@units.it> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* findmnt: don't parse mountinfo twiceKarel Zak2015-02-121-0/+23
| | | | | | | We parse /proc/self/mountinfo to initialize cache targets, this step is unnecessary if --mtab reads all from kernel. Signed-off-by: Karel Zak <kzak@redhat.com>
* rename: use strrchr() instead of rindex()Sami Kerola2015-02-101-1/+1
| | | | | | | | | The rindex() is marked legacy in POSIX.1-2001, and apparently Androids bionic libc does not even have it so it is best not to use the legacy interface. Reference: https://lists.gnu.org/archive/html/weechat-dev/2014-02/msg00004.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cal: use int64_t instead of longRuediger Meier2015-02-101-1/+2
| | | | | | | Followup 26f3a386, bigyear test was broken on ppc. CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* docs: add info about *_DEBUG= to man pagesKarel Zak2015-02-031-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: grammarize and harmonize the stat error messageBenno Schulenberg2015-02-022-2/+2
| | | | | | | | | The message "stat failed %s" seems to say that stat() failed to do something, or failed to pass a test, but of course it means that the statting of something failed. So say so. Also make two very similar messages equal to this one. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* whereis: lookup also info docsKarel Zak2015-02-022-4/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wipefs: fix FD leak on error [coverity scan]Karel Zak2015-01-291-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: implement SOMEOK (=64) return codeKarel Zak2015-01-292-13/+38
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: fix mem leaks [coverity scan]Karel Zak2015-01-291-10/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'timex' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2015-01-261-1/+8
|\ | | | | | | | | * 'timex' of https://github.com/kerolasa/lelux-utiliteetit: logger: check availability of ntp_gettime()
| * logger: check availability of ntp_gettime()Samuel Thibault2015-01-231-1/+8
| | | | | | | | | | | | | | | | Make compilation to work in systems which don't have sys/timex.h and its ntp_gettime(). Reviewed-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Samuel Thibault <sthibault@debian.org>
* | textual: fix various minor typosYuri Chornoivan2015-01-261-1/+1
| |
* | Merge branch 'opts' of https://github.com/jwpi/util-linuxKarel Zak2015-01-263-3/+3
|\ \
| * | docs: restore minus symbols in long optsJ William Piggott2015-01-213-3/+3
| |/ | | | | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | logger: improve usage()Karel Zak2015-01-261-14/+14
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | textual: put option and its description into a single translatable stringBenno Schulenberg2015-01-261-2/+2
| | | | | | | | | | | | | | Also improve the description: notime, notq, and nohost are literals, not things to be replaced by something else -- so no angular brackets. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | docs: fix two spellings in man page of loggerBenno Schulenberg2015-01-261-2/+2
| | | | | | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | textual: fix spellos and inconsistencies in several program messagesBenno Schulenberg2015-01-261-1/+1
|/ | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: fix-up man-pages flaged by checkmans.shJ William Piggott2015-01-131-1/+0Star
| | | | | | | | | disk-utils/sfdisk.8 Fix font escape login-utils/vipw.8 Delete bogus macro misc-utils/look.1 Delete bogus macro sys-utils/prlimit.1 Delete bogus macro Signed-off-by: J William Piggott <elseifthen@gmx.com>
* docs: remove obsolete and unneeded comments from man-page filesBenno Schulenberg2015-01-129-19/+0Star
| | | | | | | Transform some of them into copyright lines. Also fix three header lines and snip some trailing whitespace. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* look: remove dead codeSami Kerola2015-01-071-10/+0Star
| | | | | | | MAP_FILE is ignored compatibility flag. Reference: http://man7.org/linux/man-pages/man2/mmap.2.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lslocks: fix type warningSami Kerola2015-01-071-1/+1
| | | | | | | | misc-utils/lslocks.c:229:2: warning: format '%x' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=] Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/locks.c?id=5e0f872c7d7e371fbdf09e864eddd24bddfda8fe#n2533 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* maint: fix shadow declarationSami Kerola2015-01-072-4/+4
| | | | | | | | | | | | | | | | This change fixes all shadow declarations. The worth while to mention fix is with libfdisk sun geometry. It comes from bitops.h cpu_to_be16 macro that further expands from include/bits/byteswap.h that has the shadowing. libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow] libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow] That could have caused earlier some unexpected results. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* look: slice up the usage text for ease of translationBenno Schulenberg2015-01-061-8/+9
| | | | | | | Also use the standard macros, and correct the synopsis: use angular brackets and show that look accepts multiple files. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: improve some wordings on the man page of wipefsBenno Schulenberg2015-01-061-16/+17
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-0615-0/+51
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cal: fix signed integer overflow [AddressSanitizer]Sami Kerola2014-12-191-2/+4
| | | | | | | misc-utils/cal.c:811:16: runtime error: signed integer overflow: 2147483645 + 536870911 cannot be represented in type 'int' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: adjust some formatting and wordings in a handful of man pagesBenno Schulenberg2014-12-195-65/+68
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: adjust the grammar, text, sorting and formatting of logger man pageBenno Schulenberg2014-12-191-142/+116Star
| | | | | | | | | | The message argument is not an option and should not be listed among those. Describe the optional argument of --rfc5424 better. Use the = and no space for optional option arguments. Don't italicize words unnecessarily. Use bold for literal things. And sort the options alphabetically (apart from -V and -h). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: don't use bold or italics for "[option]" in synopsis of man pagesBenno Schulenberg2014-12-1912-20/+25
| | | | | | | As per the convention shown in Documentation/howto-man-page.txt. Also make a few other tiny adjustments along the way. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: improve the sorting of the options in the man page of getoptBenno Schulenberg2014-12-191-9/+9
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: do not start option descriptions with a capitalBenno Schulenberg2014-12-191-14/+14
| | | | | | | This normalizes the help text of getopt, clarifies one description, and also adjust two comments. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* getopt: cleanup add_log_options()Karel Zak2014-12-091-6/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getopt: rename function to keep code readableKarel Zak2014-12-091-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getopt: fix compiler warningKarel Zak2014-12-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getopt: avoid re-terminating long_option list at every updateSami Kerola2014-12-081-11/+10Star
| | | | | | | | | Terminating the ctl->long_options list once when adding options is completed is enough. This also allows moving ctl->long_options_nr increment to more appropriate location. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: change --shell argument parsing functionSami Kerola2014-12-081-12/+10Star
| | | | | | | Avoid passing getopt_control stucture in when returning a value is enough. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: prefer switch-case rather than long if statementSami Kerola2014-12-081-27/+37
| | | | | | | And avoid testing same thing time after time. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: remove unnecessary codeSami Kerola2014-12-081-9/+1Star
| | | | | | | The control structure is initialized in main(). CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: make normalize() print stringsSami Kerola2014-12-081-14/+12Star
| | | | | | | A change towards less indirection, and a change to free allocated memory. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: use xstrdup rather than malloc + strcpySami Kerola2014-12-081-12/+5Star
| | | | | CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: add struct getopt_control and remove global variablesSami Kerola2014-12-081-81/+83
| | | | | CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: remove function prototypesSami Kerola2014-12-081-10/+0Star
| | | | | | | | Functions are in right order so they do not need prototypes, with effect of not needing to keep function argument changes in sync in two locations. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: make nonoptions optstring comment correctSami Kerola2014-12-081-2/+2
| | | | | | | | | | From manual page: 'If the first character of optstring is '-', then each nonoption argv-element is handled as if it were the argument of an option with character code 1.' Reference: http://man7.org/linux/man-pages/man3/getopt.3.html CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: sync with 1.1.6 releaseSami Kerola2014-12-081-4/+17
| | | | | | Reference: http://www.spinics.net/lists/util-linux-ng/msg10556.html CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: add SUBSYSTEMS columnKarel Zak2014-12-021-0/+37
| | | | | | | | $ lsblk -oNAME,SIZE,TYPE,SUBSYSTEMS /dev/sr0 NAME SIZE TYPE SUBSYSTEMS sr0 7.8M rom block:scsi:usb:pci Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: add HOTPLUG columnKarel Zak2014-12-021-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: care about unsafe chars in cacheKarel Zak2014-11-272-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The high-level libblkid API uses /run/blkid/blkid.tab cache to store probing results. The cache format is <device NAME="value" ...>devname</device> and unfortunately the cache code does not escape quotation marks: # mkfs.ext4 -L 'AAA"BBB' # cat /run/blkid/blkid.tab ... <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device> such string is later incorrectly parsed and blkid(8) returns nonsenses. And for use-cases like # eval $(blkid -o export /dev/sdb1) it's also insecure. Note that mount, udevd and blkid -p are based on low-level libblkid API, it bypass the cache and directly read data from the devices. The current udevd upstream does not depend on blkid(8) output at all, it's directly linked with the library and all unsafe chars are encoded by \x<hex> notation. # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1 # udevadm info --export-db | grep LABEL ... E: ID_FS_LABEL=X__/tmp/foo___ E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22 Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: add hint about lsblk to the man pageKarel Zak2014-11-191-1/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>