Let's provide command line tool, man page with OOM description and
bash-completion. It seems better than force end-users to use "echo"
to /proc.
Addresses: https://github.com/karelzak/util-linux/issues/609
Signed-off-by: Karel Zak <kzak@redhat.com>
Make the option argument suggestion to match with what is allowed. In same
go tidy shell code a little bit.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Bash completion is proposing --cdspeed option argument from 'eject
--listspeed /dev/cdrom' output. Nowadays it is common not to have such
device, and this results to an unwanted error message to stderr merely
messing up command line. Lets stop that.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This is the same fix as in reference commit, and the same reason. Just
correct few files missed earlier.
Reference: abbcec4fc9
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
# mount /dev/sdc1 /mnt/test/foo\ bar
# umount <tab>
has to return "/mnt/test/foo\ bar".
Changes:
* don't use mount | awk output, we have findmnt
* force compgen use \n as entries separator
Addresses: https://github.com/karelzak/util-linux/issues/539
Signed-off-by: Karel Zak <kzak@redhat.com>
When the bash-completion for fsck runs `find -L /dev/ -type b` it
descends into /dev/fd after opening '.' as file descriptor 3. This
causes find to search through /dev/fd/3/ which includes everything below
the current directory, which can take a very long time.
To avoid this, prune /dev/fd in the find expression.
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
This patch extends the valid --output values with ZONES for the
lsmem bash-completion, and adds the --zone option for the chmem
bash-completion.
Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
This allows to conveniently kill the entire process tree
below the forked program, a common problem when scripting
tasks that need to reliably fully terminate without leaving
reparented subprocesses behind.
The example added to the man page shows the most common use.
Implemented using prctl(PR_SET_PDEATHSIG, ...).
uuidgen: Add hash-based UUIDs to bash-completion. These were added in
commit c6f1ec68a8.
wipefs: Command started to use libsmartcols, and it got some new options.
Commit d9921b2a12.
rename: New option was added in commit fabb90676a.
tunelp: The --trust-irq was removed it being years broken. Commit
d52eb4bd90.
setpriv: Add --ambient-caps option from commit 0c92194eee.
In same go fix 'bash set -u' issue, that is the same as mentioned commit
abbcec4fc9.
hwclock: For some reason --get has always been missing from this file.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Changing directory in subshell does not effect parent process, so this is
better and possibly quicker way to list pids.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The look(1) uses positional arguments, where first one is a word from
dictionary. It is reasonable to assume most of the time people search from
system word lists so propose completions from there. The second argument is
a dictionary file, that might invalidate the first input but that only
happens to users who have an idea what the want without bash-completion.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
User who want to avoid refering to none-existing variables got earlier the
following error.
$ set -u
$ findmnt --output <tab>bash: OUTPUT: unbound variable
Here is short explanation of this setting.
$ help set
-u Treat unset variables as an error when substituting.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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: 51410fc6de
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
scriptreplay:
Add --maxdelay option.
Commit: 7f1d483638
setterm:
Add --resize coption.
Commit: 5d79599951
write:
List only users who are online and determine tty based on given user
name.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fdformat:
Add --from, --to, and --repair options.
Commit: e0402441a1
fdisk:
Add --output [1], --bytes [2], --wipe [3], --wipe-partition [4], and
remove --geom- from from --cylinders, --heads, --sector options [5].
Commit [1]: fff8ad5882
Commit [2]: 354f8cc8cf
Commit [3]: cb9a4b0033
Commit [4]: ba465623d8
Commit [5]: 4b4e391a28
fsck.cramfs:
Broken since first commit.
Commit: bf60993cf2
mkswap:
Provide random uuid when completing --uuid argument.
partx:
Add --sector-size option. Fix also list of known partition types to
match with libblkid blkid_idinfo names. The fix is also applied to
manual page.
Commit: f8a4a0d4f2
Reference: git grep -A 4 blkid_idinfo libblkid/src/partitions | grep name
sfdisk:
Add --reoder, --delete, --mode-dataa, -no-tell-kernel, --wipe, and
--wipe-partitions options. In same go fix some option argument
completions.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
March 2017 is gone, it is time to remove this utility as scheduled in
earlier commit, and promised in manual page.
Reference: 3f8478a71c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Compare functionality was printing nonsense values. There is no knowledge
of anyone using this broken functionality. Instead of deprecating the code
for months, and removing it after few release, it is removed immediately.
Needless to say this is unusual removal.
Reference: http://marc.info/?l=util-linux-ng&m=148396210506652&w=2
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The --mtab output is merge from kernel and utab on all modern systems
(without classic /etc/mtab). It means we have all necessary information
to generate tree output.
For the backward compatibility --mtab is the list by default, the new
option --tree allows to override the default and enable tree always
when the table contains child-parent relations.
Signed-off-by: Karel Zak <kzak@redhat.com>
The wall command on AIX supports a "-g" option to limit the message
to a group of users by gid. Add compatibility to the Linux version.
Thanks to Sami Kerola <kerolasa@iki.fi> for an initial skeleton
implementation.
[kzak@redhat.com: - rename max to ngroups
- add free_group_workspace()
- some cosmetic changes]
Reference: http://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.cmds6/wall.htm
Signed-off-by: Jim Patterson <jimp@wegrok.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Add couple missing options, and make the completion overall work better.
That said completion is still incomplete, pardon the pun. After user has
specified policy then giving a hint what priority needs to be specified is
theoretically possible, but such hint is not given. There does not seem to
be easy way to know when user wants stops specifying options and move to
defining priority in: chrt [options] [prio] [command|pid].
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier completion suggested only options for the command, this changes
options to be proposed when first character of an argument is dash.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fstrim takes mountpoint as argument but the bash completion
was completing it to a device node.
Addresses: http://bugs.debian.org/804833
Reported-by: Ritesh Raj Sarraf <rrs@debian.org>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
This patch provides fix for bash-completion/fndmt script. There
is curly brace missed in the completion generation for the -M/--mountpoint
option.
In other way we will get following messages:
bash: /etc/bash_completion.d/findmnt: line 91: unexpected EOF while looking for matching `)'
bash: /etc/bash_completion.d/findmnt: line 141: syntax error: unexpected end of file
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Attempt to find and update all changes to command line options that has
not been reflected in bash-completion files in between versions v2.26 to
v2.27-rc1.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Commit ece44f19f4 missed freeze mode, which
to a simple patch adding the missing argument but Karel pointed out it
would be better to make the rtcwake to tell what arguments are supported
so that possible changes end up to be automatically correct in bash
completion.
Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This solution can become messy when you have too many options listed,
because it repeats all of them. For example, after invoking completion
with this input:
$ partx --output END,SECTORS,SCHEME,START,
You got these completions:
END,SECTORS,SCHEME,START,FLAGS, END,SECTORS,SCHEME,START,NR,
END,SECTORS,SCHEME,START,TYPE,
END,SECTORS,SCHEME,START,NAME, END,SECTORS,SCHEME,START,SIZE,
END,SECTORS,SCHEME,START,UUID,
Nevertheless, it works even with numbers (listed options properly
excluded from completion). Try to invoke completion after
'chcpu --disable ' or 'lsblk --exclude ' to see it in action.
Few issues remained:
* completion interrupts after encountering ':' in listed option,
like in 'MAJ:MIN' in lsblk, losetup.
* lscpu completion is broken: it inserts space after '--extended',
but lscpu assumes there is no space after this option. It also
doesn't complete '--parse' option.
* some completion options are outdated (for example, lscpu MMHZ). We
need to sync them with code. Fix for lscpu follows.
Signed-off-by: Boris Egorov <egorov@linux.com>
Empty log messages are generally considered useless. This option
enables to turn them off when processing files (including stdin).
[kzak@redhat.com: - rename --skip-empty-lines to --skip-empty,
- add the option to getopt_long(),
- add the option to bash-completion]
Signed-off-by: Karel Zak <kzak@redhat.com>
This is an important capability that has been specified in RFC5424.
However, messages larger than 1024 chars are being accepted for years
now by at least rsyslog and syslog-ng.
This patch adds the option --size to permit setting a new max
size, with 1024 being the default.
Note that the size limit is only approximative, as we do not take the
header size in account (RFC talks about total message length).
[[kzak@redhat.com: - add 'S' to getopt_long(),
- rename --message-size to --size
- add the option to bash-completion]
Signed-off-by: Karel Zak <kzak@redhat.com>
Various commands such as blkid, cfdisk, fdisk, delpart, and so on listed
only partitions and missed for example disks and volume groups. The
right thing to do is to list all block devices in all for all commands
performing operations with them. This might occasionally list unexpected
devices that I think is lesser bad than missing some.
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764488
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The runuser symlink used to depend on su being enabled, but a refactoring
broke that. So if you build with runuser enabled but not su, you end up
with a broken symlink. Rework the logic so it works in both cases.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Commit 3393c136 caused regression. The klogctl() logging range is 1-8,
but the value 0 is special according to setterm.1 manual page. It turns
on loging, same way as '-msg on' option.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
While the -version style options will work for next unknown number of
years start moving towards user interface that has way of invoking long
options as most of the other commands.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Assumption is there are not many who need this tool. Whom ever they
might be the recommendation is to use the command from old util-linux
release. Second reason to removal is difficulty to test hardware
specific command when none of the active project members does not seem to
have such. Basically the command has reached dead end what comes to
maintainability of it.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This feature is hopefully mostly used to give MESSAGE_ID labels for
messages coming from scripts, making search of messages easy. The
logger(1) manual page update should give enough information how to use
--journald option.
[kzak@redhat.com: - add missing #ifdefs
- use xalloc.h]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
This option tries to detect chunk of '\0's and punch a hole, making the file
sparse in-place.
[kzak@redhat.com: - fix coding style, use xalloc.h and err.h]
Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
Signed-off-by: Karel Zak <kzak@redhat.com>
Added week numbers both in ISO-6801 and North America numbering.
The mode is determined by first day of the week, Monday
for ISO and Sunday for North America mode.
ISO week numbers are defined as the first Thursday being part of week 1.
The North America numbering is defined, at least by gcal, as first Sunday
being in the first week.
Signed-off-by: Tommi Kyntola <kynde@iki.fi>
This reverts commit b1555acc2f.
It seems that the option is used by kernel guys to test kernel, so
let's keep the option in the blockdev(8) although it's almost useless
in userspace. All we need is to improve docs to make things more
obvious to end users.
Signed-off-by: Karel Zak <kzak@redhat.com>
This option has never worked. If you try setting the block size on a
block device, and then read it using --getbsz, you will see that the
block size never changes.
The reason for this is because the block size is specific to the
current file descriptor opening the block device, so the change of
block size only persists for as long as blockdev has the device open,
and is lost once blockdev exits.
Also the block size is not really used anywhere. Filesystems, for
example, have their own idea of block size and ignore this setting
completely.
(Thanks Masayoshi Mizuma for diagnosing the problem)
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
The bash completion for more(1) treats the space-separated pieces of
filenames as different files.
$ touch foo\ bar
$ more foo<TAB>
bar foo
Reported-by: Ángel González <ingenit@zoho.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
There is no "bfs" command. Change this file to match the other
mkfs files where we have a "mkfs." prefix.
Reported-by: Michał Górny <mgorny@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>