summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
* lib/md5: use ul_/UL_ prefixKarel Zak2017-12-121-7/+7
| | | | | | | The symbols names are too generic. Addresses: https://github.com/karelzak/util-linux/issues/548 Signed-off-by: Karel Zak <kzak@redhat.com>
* rename: use access(3) to check if a file existsSami Kerola2017-12-041-2/+1Star
| | | | | | | This is more lightweight than calling stat(3). In same go add a regression test to ensure changes like this will not break --no-overwrite option. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* man: use long options in text and add example to uuidgenSami Kerola2017-11-281-7/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix typosSami Kerola2017-11-281-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: add hint about perms to man pageKarel Zak2017-11-221-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: simplify leap year ruleKarel Zak2017-11-131-5/+1Star
| | | | | | | | | | | | Gregorian rule for leap years has been adopted by reformation in year 1782 (Calendar Act 1750), but all tools (date, SQL servers, etc. etc.) don't care about it and apply the new rule for all year -- including years before the reformation. It's better to be compatible with another tools than try to be perfect :-) Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1507271 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timeutils: add common ISO timestamp masksJ William Piggott2017-11-101-9/+3Star
| | | | | | | | | | | | | | | | | | | | | | * Start the ISO format flags at bit 0 instead of bit 1. * Remove unnecessary _8601 from ISO format flag names to avoid line wrapping and to ease readability. * ISO timestamps have date-time-timzone in common, so move the TIMEZONE flag to bit 2 causing all timestamp masks to have the first three bits set and the last four bits as timestamp 'options'. * Change the 'SPACE' flag to a 'T' flag, because it makes the code and comments more concise. * Add common ISO timestamp masks. * Implement the ISO timestamp masks in all applicable code using the strxxx_iso() functions. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* lslocks: add note about OFDLCKKarel Zak2017-11-032-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/signames: remove signame array from header fileKarel Zak2017-10-231-12/+11Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'kill-child-feature' of https://github.com/nh2/util-linuxKarel Zak2017-10-231-127/+1Star
|\ | | | | | | | | | | | | | | * 'kill-child-feature' of https://github.com/nh2/util-linux: unshare: Allow passing <signame> to --kill-child unshare: Add --kill-child option. signames: Make input char buffers const kill: Extract signal names into signames.h/signames.c
| * kill: Extract signal names into signames.h/signames.cNiklas Hambüchen2017-10-141-127/+1Star
| |
* | blkid: improve man page wordingKarel Zak2017-10-161-2/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | blkid: more info about ambivalent results to the man pageKarel Zak2017-10-161-0/+10
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | blkid: cleanup man page info about lsblkKarel Zak2017-10-161-15/+15
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: keep header generators independent on connectionKarel Zak2017-10-121-5/+1Star
| | | | | | | * avoid memory leaks * don't use incomplete or header after free() Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: make sure mmap(NULL, ...) [coverity scan]Karel Zak2017-10-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: allow to reconnect on initial failed connect tooKarel Zak2017-10-111-4/+7
| | | | | | | The current code sets noact flag if unix socked connection failed. This is ugly. We want to reconnect always in all cases (well, except --socket-error=on). Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: add dummy fallback for OSXKarel Zak2017-10-101-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: reconnect on failed send()Karel Zak2017-10-101-9/+38
| | | | | | | | | | | | | | | | | | | The libc syslog() reconnects on failed send(). We need the same thing as logger(1) is expected as long time running tool. For example recommended Apache configuration is: ErrorLog "| /usr/bin/logger -t apache_error -p local6.debug" The issue is that connection endpoint (e.g. syslogd) maybe restarted. The simple way how to test is: for i in $(seq 0 3600); do echo "This is message number $i"; sleep 1; done | logger --tcp --server 127.0.0.1 --port 514 and restart your syslog. The current implementation gets SIGPIPE or write warning message, but it never reconnect. Addresses: https://github.com/karelzak/util-linux/issues/363 Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'patch-1' of https://github.com/aner-perez/util-linuxKarel Zak2017-09-151-1/+1
|\
| * Example for renaming foo? does not work as describedAner Perez2017-09-141-1/+1
| | | | | | Command for renaming foo? should add 2 zeros to make all the file names have 3 digits as described in the example results.
* | uuidparse:fix stack-buffer-overflow [asan]Karel Zak2017-09-151-3/+2Star
| | | | | | | | | | Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* | misc: cleanup UUID_STR_LEN definitionsKarel Zak2017-09-151-2/+0Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: make stdin parsing more friendly to static analyzersKarel Zak2017-09-151-0/+2
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: small man page change in return codes descriptionKarel Zak2017-09-071-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidgen: add more details to man pageKarel Zak2017-09-051-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidgen: add support for hash-based UUIDsPhilip Prindeville2017-09-052-9/+162
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-053-5/+2Star
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* wipefs: cleanup offsets list usage, fix -t filterKarel Zak2017-08-311-110/+99Star
| | | | | | | | | | | * move list with offsets specified by -o to the wipe_control struct * don't clone the list of offsets, just keep it simple and stupid * apply all filters (-o and -t) in get_desc_for_probe() * always return offset and len by get_desc_for_probe() and apply always use libblkid hide & step-back Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1486777 Signed-off-by: Karel Zak <kzak@redhat.com>
* look: use WORDLIST environment variable to find word listSami Kerola2017-08-212-1/+10
| | | | | | | | | | The WORDLIST is the same hunspell(1) and ispell(1) uses to achieve the same. Apparently aspell(1) does not work with files like traditional dict lists. Reference: https://github.com/hunspell/hunspell/blob/master/man/hunspell.1#L388 Reference: http://www.skrenta.com/rt/man/ispell.1.html Reference: http://aspell.net/man-html/Creating-an-Individual-Word-List.html#Creating-an-Individual-Word-List Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidparse: nil uuid have all bits set to zeroSami Kerola2017-08-051-1/+4
| | | | | | | | The nil UUID is special form of UUID that is specified to have all 128 bits set to zero. Reference: https://tools.ietf.org/html/rfc4122#section-4.1.7 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build: use --runstatedir instead of --localstatedirAndreas Henriksson2017-07-314-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The util-linux code was previously aligned to use @localstatedir@ and the util-linux build system was set to override the default to use /run. Current GNU Coding Standards introduced the @runstatedir@ variable for this purpose. Lets use that instead. The GNU default for @runstatedir@ is ${localstatedir}/run so util-linux still override the default to be /run to preserve the status quo from before. The only difference is that you'll now pass --runstatedir to override the location on the command line instead of --localstatedir. (FWIW, Debhelper in compat 11 will automatically start passing --runstatedir=/run to all autotools configured builds. It already passes --localstatedir=/var (to avoid it ending up with the GNU default /usr/local/var) which breaks the util-linux build system code that tries to default it to /run. This change will thus allow util-linux and debhelper to work better together and avoid the need for a package-specific override.) Relevant historic commits: * commit 07a16b9d1e5a48550a0d19abb9a900853433ffa2 "build-sys: change --localstatedir to /run" * commit 80c51185d50f00a2701f9379f10fc48a0f885dfc "uuidd: use run configured state directory" * commit 01c5b787947aeaffc7e56000827e3edefa357c59 "agetty: use configured run state directory" [kzak@redhat.com: - add $runstatedir fallback for autoconf < 2.70 - check for unmodified $localstatedir] CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: include native multiarch path in lib search pathsAndreas Henriksson2017-07-311-0/+5
| | | | | | | | | | | | | | | | | This includes atleast the native multiarch path in the paths to search. (Maybe also other multiarch paths should also be searched? But atleast this is a first step.) Before this change (on Debian): $ whereis libc libc: /usr/share/man/man7/libc.7.gz After this change: $ whereis libc libc: /usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/libc.a /usr/share/man/man7/libc.7.gz Addresses: https://bugs.debian.org/856968 Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-2919-37/+37
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Merge branch 'path-fixes' of https://github.com/rudimeier/util-linuxKarel Zak2017-06-291-2/+1Star
|\ | | | | | | | | | | | | | | | | | | | | | | * 'path-fixes' of https://github.com/rudimeier/util-linux: hwclock: don't ifdef printf arguments setpriv: align --help tools: add segfault detection for checkusage.sh misc: avoid some dead initialization warnings lscpu: make clang analyzer happy lsmem: fix, using freed memory lib/path: add error handling to path_vcreate() lib/path: fix crash, pathbuf overflow
| * misc: avoid some dead initialization warningsRuediger Meier2017-06-291-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang analyzer warnings: Dead store, Dead initialization: lib/mbsedit.c:154:8: warning: Value stored to 'in' during its initialization is never read char *in = (char *) &c; ^~ ~~~~~~~~~~~ misc-utils/findmnt-verify.c:129:14: warning: Value stored to 'cn' during its initialization is never read const char *cn = tgt; ^~ ~~~ Dead store, Dead increment: sys-utils/hwclock.c:1461:2: warning: Value stored to 'argv' is never read argv += optind; ^ ~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | uuidgen: improve --helpKarel Zak2017-06-291-6/+4Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | wipefs: improve --helpKarel Zak2017-06-291-23/+19Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | wipefs: use libsmartcolsKarel Zak2017-06-293-48/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old output is horrible and useless when more devices specified. The old format is also too tricky if more signatures detected. The new output uses one line for each signature, prefixed by device name. For example my workstation: # wipefs /dev/sda* /dev/sdb* DEVICE OFFSET TYPE UUID LABEL sda 0x1fe PMBR sda 0x37e4895e00 gpt sda 0x200 gpt sda1 0x1fe vfat F2BC-BFEC EFI sda1 0x0 vfat F2BC-BFEC EFI sda1 0x36 vfat F2BC-BFEC EFI sda2 0x438 ext4 c5490147-2a6c-4c8a-aa1b-33492034f927 BOOT sda3 0x438 ext4 196972ad-3b13-4bba-ac54-4cb3f7b409a4 HOME sda4 0x438 ext4 d834bc84-0089-4be1-9013-cd8bf35d5ffa ROOT sda5 0x438 ext4 e8ce5375-29d4-4e2f-a688-d3bae4b8d162 WINE sda6 0xff6 swap 210337c6-f8b5-4d65-aab5-a0f343fa9ad4 SWAP sdb 0x200 gpt sdb 0x1fe dos sdb1 0x438 ext4 6467a684-0d10-4f61-a301-67bb26934d90 This patch add --noheadings, --json and --output. Signed-off-by: Karel Zak <kzak@redhat.com>
* | uuidparse: se JSON table name on -JKarel Zak2017-06-291-1/+4
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | wipefs: try another magic strings on -o and -tKarel Zak2017-06-281-4/+20
| | | | | | | | | | | | | | | | The commit 92296e9ba2bf95259520fa7537ff8edc2aa9edbc introduces "try all permutations for the same superblock". This feature has to be also available if -o and -t is specified. Signed-off-by: Karel Zak <kzak@redhat.com>
* | wipefs: add control structKarel Zak2017-06-281-66/+64Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | wipefs: don't do step-back if <type> does not matchKarel Zak2017-06-281-5/+14
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | wipefs: print all signature permutationsKarel Zak2017-06-282-8/+8
|/ | | | | | | | | | | | | The same FS/RAID/PT signature may be detected by more ways and on more places on the device. The libblkid returns only the first detected signature by default. This patch use blkid_probe_hide_range() to re-scan device for all possible permutations of the same signature. For example the default wipefs(8) output as well as --no-act output will contains primary as well as backup GPT signature now. Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'help-description' of https://github.com/rudimeier/util-linuxKarel Zak2017-06-2719-40/+21Star
|\ | | | | | | | | | | | | | | | | | | * 'help-description' of https://github.com/rudimeier/util-linux: misc: update --help content again login: add --help text blockdev: improve --help and man page misc: consolidate all --help option descriptions misc: introduce print_usage_help_options() misc: revert to the old USAGE_HELP strings
| * misc: consolidate all --help option descriptionsRuediger Meier2017-06-273-6/+4Star
| | | | | | | | | | | | | | | | Now we are always using the same text also for commands which had still hardcoded descriptions or where we can't use the standard print_usage_help_options macro. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * misc: introduce print_usage_help_options()Ruediger Meier2017-06-2717-34/+17Star
| | | | | | | | | | | | | | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | uuidparse: fix getopt crashRuediger Meier2017-06-261-0/+1
|/ | | | | | | | | $ ./uuidparse --unknownopt Segmentation fault (core dumped) Hehe, this is the first real bug found by 'make checkusage'. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Merge branch 'usage-part2' of https://github.com/rudimeier/util-linuxKarel Zak2017-06-2617-86/+104
|\ | | | | | | | | | | | | | | | | | | | | * 'usage-part2' of https://github.com/rudimeier/util-linux: misc: cosmetics, remove argument from usage(FILE*) misc: cosmetics, remove argument from usage(int) misc: never use usage(stderr) misc: never use usage(ERROR) misc: cleanup and fix --unknownopt issues flock, getopt: write --help to stdout and return 0 tools: add checkusage.sh
| * misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-269-27/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>