summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
...
* misc: consolidate usage() "Available columns"Karel Zak2017-06-263-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '170622' of github.com:jwpi/util-linuxKarel Zak2017-06-261-2/+1Star
|\ | | | | | | | | | | | | | | * '170622' of github.com:jwpi/util-linux: Docs: move option naming to howto-contribute.txt Docs: update howto-usage-function.txt Docs: add a comment for constants to boilerplate.c include/c.h: add USAGE_COMMANDS and USAGE_COLUMNS
| * include/c.h: add USAGE_COMMANDS and USAGE_COLUMNSJ William Piggott2017-06-241-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | * login-utils/lslogins.c: all uses changed * misc-utils/findmnt.c: likewise * sys-utils/blkzone.c: likewise * disk-utils/sfdisk.c: likewise * sys-utils/lscpu.c: likewise * sys-utils/lsmem.c: likewise * sys-utils/wdctl.c: likewise Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | Merge branch 'fix-exit-codes' of https://github.com/rudimeier/util-linuxKarel Zak2017-06-262-3/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * 'fix-exit-codes' of https://github.com/rudimeier/util-linux: misc: fix optutils.h related exit codes misc: fix xalloc.h related exit codes misc: fix more strutils related exit codes lib: fix strutils.h, remove STRTOXX_EXIT_CODE misc: fix some broken exit codes
| * | misc: fix xalloc.h related exit codesRuediger Meier2017-06-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Found by: grep -L "XALLOC_EXIT_CODE" $(grep -l "xalloc\.h" \ $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * | lib: fix strutils.h, remove STRTOXX_EXIT_CODERuediger Meier2017-06-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed on the mailing list. We fix all places where the non-working define STRTOXX_EXIT_CODE was used. Regarding tunelp, also see 7e3c80a7. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * | misc: fix some broken exit codesRuediger Meier2017-06-221-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tools have special exit codes. They got changed mistakenly. See: findfs 0e1fa6b6 fsck 658c0891 fsck.cramfs 922ec175 mkfs.cramfs 16154b1f tunelp 2ab428f6 FIXME: STRTOXX_EXIT_CODE doesn't work as it should. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | misc: no more errtryh()Ruediger Meier2017-06-251-11/+14
| | | | | | | | | | | | | | Nowadays all our regular commands have --help options. test_uuidd does not use translations anyways. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | whereis: add --help and --versionRuediger Meier2017-06-222-13/+41
| | | | | | | | | | | | | | We can use errtryhelp() now and never print usage to stderr. One may improve all these "bad usage" messages. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | blkid: use errtryhelp instead of errtryhRuediger Meier2017-06-221-4/+4
| | | | | | | | | | | | We have a --help option and this is preferred. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | uuidd: remove unused defineRuediger Meier2017-06-221-6/+0Star
|/ | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* wipefs: exit on failed eraseKarel Zak2017-06-211-1/+1
| | | | | | | | | | | | | | | | | The current behavior is to report error and continue, it seems strange: # blockdev --setro /dev/sdc # wipefs -a /dev/sdc wipefs: /dev/sdc: failed to erase xfs magic string at offset 0x00000000: Operation not permitted /dev/sdc: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42 ^^^^^^^^^^^ not true The patch calls err() to exit. Reported-by: Vratislav Podzimek <vpodzime@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: remove stray semicolonsSami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-142-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidgen: slice up the usage textSami Kerola2017-06-141-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rename: notice when expression and replacement are the same stringSami Kerola2017-06-141-0/+3
| | | | | | | | The rename(1) can exit early when replace expression and replacement are identical string. It is also appropriate to change return value in this case to 'nothing was renamed'. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix ggc-7 fallthrough warningsSami Kerola2017-06-142-3/+2Star
| | | | | | | | | | | | | | | | | | | (Original patch and commit message edited by Rudi.) gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra. This warning can be silenced by using comment /* fallthrough */ which is also recognized by other tools like coverity. There are also other valid comments (see man gcc-7) but we consolidate this style now. We could have also used __attribute__((fallthrough)) but the comment looks nice and does not need to be ifdef'ed for compatibility. Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652 Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl> Suggested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: add option --treeKarel Zak2017-06-092-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now lsblk uses --list when --sort <column> is specified. This patch allows to specify --tree to overwrite this default behavior add to force tree-like output. In this case tree branches are sorted by the <column>. $ lsblk --sort SIZE NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda2 8:2 0 200M 0 part /boot sda1 8:1 0 200M 0 part /boot/efi sda6 8:6 0 7.8G 0 part [SWAP] sda5 8:5 0 35.1G 0 part /home/misc sda4 8:4 0 50G 0 part / sdb1 8:17 0 74.5G 0 part /home/archive sdb 8:16 0 74.5G 0 disk sda3 8:3 0 130.3G 0 part /home sda 8:0 0 223.6G 0 disk $ lsblk --sort SIZE --tree NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 74.5G 0 disk └─sdb1 8:17 0 74.5G 0 part /home/archive sda 8:0 0 223.6G 0 disk ├─sda2 8:2 0 200M 0 part /boot ├─sda1 8:1 0 200M 0 part /boot/efi ├─sda6 8:6 0 7.8G 0 part [SWAP] ├─sda5 8:5 0 35.1G 0 part /home/misc ├─sda4 8:4 0 50G 0 part / └─sda3 8:3 0 130.3G 0 part /home Signed-off-by: Karel Zak <kzak@redhat.com>
* rename: add -o to the man pageKarel Zak2017-06-061-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'rename-nooverride' of https://github.com/dov/util-linuxKarel Zak2017-06-061-16/+37
|\ | | | | | | | | | | * 'rename-nooverride' of https://github.com/dov/util-linux: Changed "override" to "overwrite" rename option. Added --no-override option to rename.
| * Changed "override" to "overwrite" rename option.Dov Grobgeld2017-06-031-13/+13
| |
| * Added --no-override option to rename.Dov Grobgeld2017-05-271-16/+37
| |
* | Merge branch 'master' of https://github.com/yurchor/util-linuxKarel Zak2017-06-021-2/+2
|\ \ | | | | | | | | | | | | * 'master' of https://github.com/yurchor/util-linux: Fix minor typos
| * | Fix minor typosYuri Chornoivan2017-05-231-2/+2
| |/
* | misc: fix some warningsRuediger Meier2017-06-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sys-utils/prlimit.c: In function 'do_prlimit': sys-utils/prlimit.c:367:16: warning: format '%ju' expects argument of type 'uintmax_t', but argument 2 has type 'rlim_t {aka long long unsigned int}' [-Wformat=] printf("<%ju", new->rlim_cur); lib/plymouth-ctrl.c: In function 'open_un_socket_and_connect': lib/plymouth-ctrl.c:88:20: warning: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types] ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1)); ^ In file included from lib/plymouth-ctrl.c:35:0: /usr/include/sys/socket.h:314:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *' int connect (int, const struct sockaddr *, socklen_t); login-utils/last.c: In function 'list': login-utils/last.c:506:54: warning: pointer targets in passing argument 4 of 'dns_lookup' differ in signedness [-Wpointer-sign] r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6); ^ login-utils/last.c:291:12: note: expected 'int32_t * {aka int *}' but argument is of type 'unsigned int *' static int dns_lookup(char *result, int size, int useip, int32_t *a) ^~~~~~~~~~ In file included from sys-utils/hwclock-cmos.c:92:0: sys-utils/hwclock.h:67:32: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration extern double time_diff(struct timeval subtrahend, struct timeval subtractor); misc-utils/test_uuidd.c: In function 'create_nthreads': misc-utils/test_uuidd.c:187:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] proc->pid, (int) th->tid, th->index)); Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | build-sys: ncurses headers cleanupKarel Zak2017-05-311-4/+4
| | | | | | | | | | | | | | | | | | * assume ncursesw headers in ncursesw/ directory only * prefer long paths, <term.h> and <ncurses.h> should be last possibility * fix typos Signed-off-by: Karel Zak <kzak@redhat.com>
* | cal: ncurses cleanupKarel Zak2017-05-302-9/+20
| | | | | | | | | | | | | | | | | | * use proper paths to term.h * keep ncurses support optional * link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses) * don't include unnecessary ncurses.h (term.h is enough) Signed-off-by: Karel Zak <kzak@redhat.com>
* | test_uuidd: don't use error.hKarel Zak2017-05-301-5/+8
|/ | | | | | | The header file is not provided by musl-libc. Reported-by: Assaf Gordon <assafgordon@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* rename: make --no-act to imply --verboseSami Kerola2017-05-191-3/+3
| | | | | | | | It is reasonable to assume use of --no-act means one wants to always see what would have happen if rename is done. To say same slightly differently, if there is sn use case for silent rename --no-act run I cannot think one. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lslocks: remove dead codeKarel Zak2017-05-181-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate smartcols error messagesKarel Zak2017-05-184-36/+32Star
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: check rc from smartcols stuff [coverity scan]Karel Zak2017-05-171-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getops: make --a-long option work againSami Kerola2017-05-161-1/+1
| | | | | | | Add back a character lost in earlier change. Regression-from: d27f5fe770025e456fbd33b87a96968f34c455ed Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wipefs: add note about no-act to the man pageKarel Zak2017-05-111-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2017wk16' of git://github.com/kerolasa/lelux-utiliteetitKarel Zak2017-05-094-110/+138
|\ | | | | | | | | | | | | | | | | | | | | | | | | * '2017wk16' of git://github.com/kerolasa/lelux-utiliteetit: chfn, chsh: use readline(3) to receive user input findfs: use getopt_long() to parse options logger: make month names, login name, and tag read-only objects sulogin: reduce vulnerability surface partx: add --list-types option libblkid: add blkid_partitions_get_name() docs: try to convince open(2) O_DIRECT rather than using raw device blkid: add long options lsipc: fix options parsing and sync with man page
| * findfs: use getopt_long() to parse optionsSami Kerola2017-05-031-9/+17
| | | | | | | | | | | | | | This change makes the findfs(8) more coherent with other commands in the project source tree. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * logger: make month names, login name, and tag read-only objectsSami Kerola2017-05-031-6/+6
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * blkid: add long optionsSami Kerola2017-05-032-95/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | This change attempts to make tab completion more reasonable by alloging memorizable option names. That also has positive impact to manual page, in which referrals to other options are now easier to understand. All short options are kept exactly as they were to avoid ABI breakage. The only exception is -f option that getopt(3) recognized, but was not found from anywhere else. The -f has been part of blkid since the initial commit. Commit: 51410fc6deb29cae54a2669aafabae6c49f964fc Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | blkid: fix return code when display the versionAlexey Gladkov2017-05-051-0/+1
|/ | | | Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
* lsblk: don't duplicate columnsKarel Zak2017-04-191-49/+55
| | | | | | | | | | | | | | | | | | | | | | $ lsblk --discard --perms NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO NAME SIZE OWNER GROUP MODE sdb 0 0B 0B 0 sdb 74.5G root disk brw-rw---- └─sdb1 0 0B 0B 0 └─sdb1 74.5G root disk brw-rw---- sda 0 512B 2G 0 sda 223.6G root disk brw-rw---- ├─sda4 0 512B 2G 0 ├─sda4 50G root disk brw-rw---- ├─sda2 0 512B 2G 0 ├─sda2 200M root disk brw-rw---- ├─sda5 0 512B 2G 0 ├─sda5 35.1G root disk brw-rw---- ├─sda3 0 512B 2G 0 ├─sda3 130.3G root disk brw-rw---- ├─sda1 0 512B 2G 0 ├─sda1 200M root disk brw-rw---- └─sda6 0 512B 2G 0 └─sda6 7.8G root disk brw-rw---- ... see NAME column. It's fine to support duplicated columns when requested by user (e.g. -o NAME,NAME,SIZE), but it does not make sense for the default output when multiple command options specified. Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: add ZONED columnDamien Le Moal2017-04-192-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the column "ZONED" to the output to display block devices zone model information. Example output: > lsblk -o+ZONED NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT ZONED sda 8:0 0 111.8G 0 disk none ├─sda1 8:1 0 500M 0 part /boot none ├─sda2 8:2 0 87.3G 0 part / none └─sda3 8:3 0 24G 0 part [SWAP] none sdb 8:16 0 12.8T 0 disk host-managed sdc 8:32 0 5.5T 0 disk host-managed or: > lsblk --zoned NAME ZONED sda none ├─sda1 none ├─sda2 none └─sda3 none sdb host-managed sdc host-managed Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
* lsblk: fix --inverse --listKarel Zak2017-04-132-1/+9
| | | | | | | Let's follow --inverse dependencies although --list output requested. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1441175 Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: move scols_flags to lsblk control structKarel Zak2017-04-131-18/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: fix file descriptor leakSami Kerola2017-04-101-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fincore: use size_t everywhereKarel Zak2017-04-061-3/+3
| | | | | | | It seems better to avoid "int" at all from sizes calculations to make the code more robust for future changes. Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: fix multiplication overflowRuediger Meier2017-04-061-1/+1
| | | | | | This failed on ppc64 with page size 64k. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fincore: add column RESKarel Zak2017-03-272-6/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: fix compiler warning [-Wdiscarded-qualifiers]Karel Zak2017-03-241-5/+5
| | | | | | Let's also hide the show[] array in has_item(). Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2017wk11' of git://github.com/kerolasa/lelux-utiliteetitKarel Zak2017-03-242-96/+95Star
|\ | | | | | | | | | | | | | | | | * '2017wk11' of git://github.com/kerolasa/lelux-utiliteetit: blkid: add control struct blkid: simplify version option handling tests: add static keyword where needed [smatch scan] tests: do not use plain 0 as NULL [smatch scan] libsmartcols: fix test variable shadowing
| * blkid: add control structSami Kerola2017-03-171-83/+88
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>