]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 years agotests: add sanitize_env() check
Sami Kerola [Sun, 12 Apr 2020 18:45:53 +0000 (19:45 +0100)] 
tests: add sanitize_env() check

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: fix moving backwards so that it can reach begining of the file
Sami Kerola [Sun, 29 Mar 2020 13:52:19 +0000 (14:52 +0100)] 
more: fix moving backwards so that it can reach begining of the file

Moving backwards has worked fine until reaching start of file.  At that
point more printout had one line too much in output causing more seemingly
never to be able to reach the start.  That is now fixed, with clean ups to
skip_backwards() making it less confusing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: use getopt_long() to parse options
Sami Kerola [Sat, 28 Mar 2020 15:09:00 +0000 (15:09 +0000)] 
more: use getopt_long() to parse options

This commit also includes fix to how initial skip lines and search are
instructed in the code.  Earlier version was pretty close impossible to make
work with getopt_long() and had minor flaw - if both initial skip lines and
search were defined at the same time the skipping did not happen.  That is
now corrected.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: remove underlining related code
Sami Kerola [Sat, 28 Mar 2020 11:08:13 +0000 (11:08 +0000)] 
more: remove underlining related code

Linux terminal handles underlining just fine without more executable needing
to do anything extra.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: fix SIGSTOP and SIGCONT handling
Sami Kerola [Sat, 28 Mar 2020 10:17:46 +0000 (10:17 +0000)] 
more: fix SIGSTOP and SIGCONT handling

When suspending only the more process.  Sending signal to process group
makes signal destination unnecessarily vague.  After the suspend is over
SIGCONT is expected, and it needs to ensure output terminal settings are
what more needs.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: make execute() more robust and timely
Sami Kerola [Sat, 28 Mar 2020 10:00:08 +0000 (10:00 +0000)] 
more: make execute() more robust and timely

The wait() is now a little more robust by being more tolerate rogue SIGCHLDs
and unblocked signals.  The repeated fork() and sleep() is removed, if first
try does not success give up without delay to provide user timely feedback.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: target all standard streams when calling fflush()
Sami Kerola [Sat, 21 Mar 2020 17:45:47 +0000 (17:45 +0000)] 
more: target all standard streams when calling fflush()

If streams need to be flushed do not try to be clever, just flush all of
them.  That lead to finding unnecessary print out in run_shell() that is
removed in this commit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: remove kill_line() in favor of erase_prompt()
Sami Kerola [Sat, 21 Mar 2020 16:53:15 +0000 (16:53 +0000)] 
more: remove kill_line() in favor of erase_prompt()

These functions did similar things, so there is no need for both of them.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: avoid defining special characters locally
Sami Kerola [Sat, 21 Mar 2020 15:59:04 +0000 (15:59 +0000)] 
more: avoid defining special characters locally

The sys/ttydefaults.h can be used for CTRL() and rubout that is CERASE.  For
alarm it's best to keep things simple and call printf() alarm modifier.
QUIT was not in use, so it is just deleted.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: use off_t and cc_t to clarify what variables attempt to represent
Sami Kerola [Sat, 21 Mar 2020 13:15:19 +0000 (13:15 +0000)] 
more: use off_t and cc_t to clarify what variables attempt to represent

As a minor robustness improvement use ftello() to find out file position
rather than add and substract from old value.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: do not reset parent process terminal in execute()
Sami Kerola [Sat, 21 Mar 2020 12:34:15 +0000 (12:34 +0000)] 
more: do not reset parent process terminal in execute()

Only the terminal of the child process, that is the command being executed,
needs the reset.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: use single exit path to ensure resource freeing is unified
Sami Kerola [Sat, 21 Mar 2020 09:30:57 +0000 (09:30 +0000)] 
more: use single exit path to ensure resource freeing is unified

And be a little more complete all the allocations that can be released are,
but there is a small catch.  As mentioned in ncurses FAQ some leaks are
intentional, and that's the way they are.

Reference: https://invisible-island.net/ncurses/ncurses.faq.html#config_leaks
Reference: http://man7.org/linux/man-pages/man3/_nc_free_tinfo.3x.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agotests: add zonefs blkid test
Karel Zak [Mon, 6 Apr 2020 13:33:23 +0000 (15:33 +0200)] 
tests: add zonefs blkid test

Thanks to Damien Le Moal for the image.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: renice(1): Add chrt(1) to SEE ALSO
Jann Horn [Sun, 5 Apr 2020 05:55:14 +0000 (07:55 +0200)] 
docs: renice(1): Add chrt(1) to SEE ALSO

A user who wants to change the niceness of a process is likely to also be
interested in changing the scheduler class and/or RT priority.

Signed-off-by: Jann Horn <jannh@google.com>
5 years agolibmount: use mnt_stat_mountpoint() on more places
Karel Zak [Mon, 6 Apr 2020 09:58:29 +0000 (11:58 +0200)] 
libmount: use mnt_stat_mountpoint() on more places

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: Avoid triggering autofs in lookup_umount_fs_by_statfs
Fabian Vogt [Wed, 1 Apr 2020 11:15:13 +0000 (13:15 +0200)] 
libmount: Avoid triggering autofs in lookup_umount_fs_by_statfs

Currently, umount /foo results in a statfs("/foo") call, which triggers
autofs. This can create another mountpoint on /foo, which is then unmounted
later instead of the actual /foo at the time umount was called.

This is especially an issue for umount -R /bar, which just fails with
-EBUSY as the accidental mountpoint is never accounted for and so it tries
to umount /bar before /bar/someautofs.

Replace the direct statfs call with open(path, O_PATH) + fstatfs, which sees
the autofs mount directly, without triggering it.

5 years agolibuuid: remove function alias
Karel Zak [Wed, 1 Apr 2020 08:21:58 +0000 (10:21 +0200)] 
libuuid: remove function alias

It seems the 'alias' attribute is not portable enough.

libuuid/src/unparse.c:72:17: error: only weak aliases are supported on darwin
        __attribute__((alias("uuid_unparse_lower")));

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agocal: correctly set the week width
Aurelien LAJOIE [Sat, 28 Mar 2020 22:33:41 +0000 (23:33 +0100)] 
cal: correctly set the week width

There is seven values but only 6 spaces between them, that why the -1
The value is always used with a minus one, just set it correctly instead
of always fix when used

Signed-off-by: Aurelien LAJOIE <orel@melix.net>
5 years agocal: Correctly center the year
Aurelien LAJOIE [Sat, 28 Mar 2020 22:33:40 +0000 (23:33 +0100)] 
cal: Correctly center the year

Signed-off-by: Aurelien LAJOIE <orel@melix.net>
5 years agocal: use a const char*
Aurelien LAJOIE [Sat, 28 Mar 2020 22:33:39 +0000 (23:33 +0100)] 
cal: use a const char*

A put string function should not modify the char*

Signed-off-by: Aurelien LAJOIE <orel@melix.net>
5 years agolibuuid: improve uuid_unparse() performance
Aurelien LAJOIE [Thu, 26 Mar 2020 14:38:27 +0000 (15:38 +0100)] 
libuuid: improve uuid_unparse() performance

There is 2 improvements:

 * remove useless uuid_unpack,
 * directly print the hexa format from memory without using printf
   we can do this as the bytes order is the network byte order
   https://tools.ietf.org/html/rfc4122#section-4.1.2
   even the spatially unique node identifier(the last 6 bytes)

The improvement is important, some results for 1000000 uuid_unparse calls:

Little Endian Ubuntu:
before took 382623 us
after  took  36740 us

Big Endian OpenBSD:
before took 3138172 us
after  took  180116 us

Signed-off-by: Aurelien LAJOIE <orel@melix.net>
5 years agoMerge branch 'more' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 31 Mar 2020 11:17:20 +0000 (13:17 +0200)] 
Merge branch 'more' of https://github.com/kerolasa/util-linux

* 'more' of https://github.com/kerolasa/util-linux:
  more: refactor and clarify code
  more: add display_file() to show files and stdin
  more: simplify initterm()
  more: move currently open file to control structure
  more: move code blocks from more_key_command() to functions
  more: move runtime usage output to a function
  more: restructure print_buf() if-else with continue
  more: tell in run time help what the 'v' will execute as editor
  more: drop setuid permissions before executing anything
  more: do not allocate shell command buffer from stack
  more: replace siglongjmp() and signal() calls with signalfd()

5 years agolslogins: remove unnecessary brackets
Karel Zak [Tue, 31 Mar 2020 11:12:11 +0000 (13:12 +0200)] 
lslogins: remove unnecessary brackets

Just to be consistent with the rest of the code.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch '2020wk12' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 31 Mar 2020 11:05:53 +0000 (13:05 +0200)] 
Merge branch '2020wk12' of https://github.com/kerolasa/util-linux

* '2020wk12' of https://github.com/kerolasa/util-linux:
  lslogins: use lastlog as wtmp fallback
  login: avoid lseek() with pread() and pwrite()
  libuuid: ensure variable is initialized [cppcheck]
  ctrlaltdel: display error message indicated by errno

5 years agoMerge branch 'mips' of https://github.com/FlyGoat/util-linux
Karel Zak [Tue, 31 Mar 2020 10:54:58 +0000 (12:54 +0200)] 
Merge branch 'mips' of https://github.com/FlyGoat/util-linux

* 'mips' of https://github.com/FlyGoat/util-linux:
  lscpu: Adapt MIPS cpuinfo

5 years agofstrim: rename --quite to --quite-unsupported
Karel Zak [Tue, 31 Mar 2020 10:26:54 +0000 (12:26 +0200)] 
fstrim: rename --quite to --quite-unsupported

We use --verbose together with --quite in service files. It seems
confusing, let's make the option more descriptive.

Addresses: https://github.com/karelzak/util-linux/issues/1001
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolslogins: use lastlog as wtmp fallback
Sami Kerola [Sun, 29 Mar 2020 19:40:48 +0000 (20:40 +0100)] 
lslogins: use lastlog as wtmp fallback

The wtmp file tends to rotate higher rate than lastlog, so use the later as
fallback in when wtmp tells nothing in LAST-LOGIN column.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agologin: avoid lseek() with pread() and pwrite()
Sami Kerola [Sun, 22 Mar 2020 20:54:00 +0000 (20:54 +0000)] 
login: avoid lseek() with pread() and pwrite()

This makes code a little less complicated by avoiding couple system calls.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolibuuid: ensure variable is initialized [cppcheck]
Sami Kerola [Sat, 29 Feb 2020 08:51:53 +0000 (08:51 +0000)] 
libuuid: ensure variable is initialized [cppcheck]

This fix has a little bit of a feel of making a static analyzer to be happy
instead of real progress.  If I read the preprocessor directives correctly
it should be impossible hit uninitialized variable.  Then again if a bug
creeps into these ifdef's in that case it is nice to have robust code that
doesn't immediately go wrong.

    libuuid/src/gen_uuid.c:200:20: error: Uninitialized variable: a [uninitvar]
       memcpy(node_id, a, 6);
                       ^
    libuuid/src/gen_uuid.c:197:8: error: Uninitialized variable: a [uninitvar]
      if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
           ^

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agoctrlaltdel: display error message indicated by errno
Sami Kerola [Tue, 25 Feb 2020 21:30:19 +0000 (21:30 +0000)] 
ctrlaltdel: display error message indicated by errno

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: refactor and clarify code
Sami Kerola [Wed, 18 Mar 2020 20:13:16 +0000 (20:13 +0000)] 
more: refactor and clarify code

Use the backspace provided dy terminfo, and if that is not possible use
fallback.

Simplify entering and exiting standard mode.  Now when these std_enter and
std_exit variables are initialized correctly they do not need to be checked
quite as complex way as earlier.

Do not call prepare_line_buffer() unnecessarily.  The line buffer needs only
to be prepared only at times of more(1) initialization and when terminal
size changes.

Add a function to print various separators, that is better than static
strings.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: add display_file() to show files and stdin
Sami Kerola [Sat, 28 Mar 2020 07:50:43 +0000 (07:50 +0000)] 
more: add display_file() to show files and stdin

Earlier main() inline code implemented input files and stdin displaying
separately.  With small restructuring this code can be shared.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: simplify initterm()
Sami Kerola [Wed, 18 Mar 2020 20:13:10 +0000 (20:13 +0000)] 
more: simplify initterm()

Return rather than use long 'else' statement.  Also unwind some overly
compact variable set and test code, that can be best observed how
underlining settings are now handled.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: move currently open file to control structure
Sami Kerola [Wed, 18 Mar 2020 20:13:08 +0000 (20:13 +0000)] 
more: move currently open file to control structure

Currently open file is needed a bit here and there.  Move it to control
structure to avoid passing it around.  This also makes fixing memory leak at
more_exit() very easy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: move code blocks from more_key_command() to functions
Sami Kerola [Wed, 18 Mar 2020 20:13:06 +0000 (20:13 +0000)] 
more: move code blocks from more_key_command() to functions

The more_key_command() was overly long.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: move runtime usage output to a function
Sami Kerola [Wed, 18 Mar 2020 20:13:02 +0000 (20:13 +0000)] 
more: move runtime usage output to a function

This change also removes a ghost prompt that was left in place when printing
help.  When looking old commits the output fluke has been around at least
since util-linux v2.2.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: restructure print_buf() if-else with continue
Sami Kerola [Wed, 18 Mar 2020 20:13:00 +0000 (20:13 +0000)] 
more: restructure print_buf() if-else with continue

Replacing long 'else' with 'continue' allows dropping one level of
indentation.  Main aim is to improve code readability by reducing
complexity one needs to keep track while looking the code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: tell in run time help what the 'v' will execute as editor
Sami Kerola [Wed, 18 Mar 2020 20:12:59 +0000 (20:12 +0000)] 
more: tell in run time help what the 'v' will execute as editor

In same go use well known paths from system include file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: drop setuid permissions before executing anything
Sami Kerola [Wed, 18 Mar 2020 20:12:57 +0000 (20:12 +0000)] 
more: drop setuid permissions before executing anything

Pagers are not expected to have setuid or setgid bits, but assuming such
mistake has taken place try to avoid privilege escalation.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolscpu: Adapt MIPS cpuinfo
Jiaxun Yang [Sat, 28 Mar 2020 04:19:42 +0000 (12:19 +0800)] 
lscpu: Adapt MIPS cpuinfo

MIPS have slightly different layout of cpuinfo.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
5 years agomore: do not allocate shell command buffer from stack
Sami Kerola [Wed, 18 Mar 2020 20:12:54 +0000 (20:12 +0000)] 
more: do not allocate shell command buffer from stack

This change has three possitive effects:  Avoid expansion code when it is
not needed.  Stop wasting memory from stack for something rarely needed.
When command buffer is needed stop limiting it's size artificially.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: replace siglongjmp() and signal() calls with signalfd()
Sami Kerola [Wed, 18 Mar 2020 20:12:51 +0000 (20:12 +0000)] 
more: replace siglongjmp() and signal() calls with signalfd()

From man siglongjmp(3) 'longjmp() and siglongjmp() make programs hard to
understand and maintain.  If possible, an alternative should be used.'  That
manual page remark summarizes quite well why more(1) needs to move away from
jumping around.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolibmount: make mnt_context_find_umount_fs() more extendable
Karel Zak [Fri, 27 Mar 2020 10:34:12 +0000 (11:34 +0100)] 
libmount: make mnt_context_find_umount_fs() more extendable

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: (umount) FS lookup refactoring
Karel Zak [Fri, 27 Mar 2020 10:10:26 +0000 (11:10 +0100)] 
libmount: (umount) FS lookup refactoring

Let's split lookup to more function to make it easy to add another
lookup method.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoblkzone: ioctl related code refactoring
Damien Le Moal [Thu, 26 Mar 2020 10:27:50 +0000 (11:27 +0100)] 
blkzone: ioctl related code refactoring

[kzak@redhat.com: - generate patch from Damien's v3
                  - make commands[] initialization more robust]

Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoblkzone: add open/close/finish commands
Aravind Ramesh [Tue, 24 Mar 2020 10:02:17 +0000 (19:02 +0900)] 
blkzone: add open/close/finish commands

Introduce blkzone open, close and finish commands, issuing BLKOPENZONE,
BLKCLOSEZONE and BLKFINISHZONE ioctl commands to open, close or finish
a range of zones of a zoned block device.

Since these three commands are similar to the existing zone reset
command, the existing zone reset command implementation is changed into
the generic blkzone_action() internal handler function for processing
all zone actions.

The BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl commands codes are
defined in linux/blkzoned.h starting with kernel version 5.5. To ensure
that the blkzone utility compiles even with older blkzoned.h kernel
header versions, these ioctl commands are internally defined if the
blkzoned.h header definition is not present. Execution of these commands
on kernels older than 5.5 will result in a -ENOTTY error (missing
ioctl).

Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Reviewed-by: Hans Holmberg <Hans.Holmberg@wdc.com>
5 years agotests: cleanup fdisk based stuff
Karel Zak [Tue, 24 Mar 2020 13:30:16 +0000 (14:30 +0100)] 
tests: cleanup fdisk based stuff

* use fdisk --noauto-pt to avoid re-creation of the default architecture specific PT
* use more verbose "Created a new" messages in the output

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofdisk: make sure label defined for some menu entries
Karel Zak [Tue, 24 Mar 2020 11:00:28 +0000 (12:00 +0100)] 
fdisk: make sure label defined for some menu entries

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofdisk: add --noauto-pt
Karel Zak [Tue, 24 Mar 2020 10:17:34 +0000 (11:17 +0100)] 
fdisk: add --noauto-pt

The default partition table depends on system arch, for example on
Sparc it's SUN and on x86_64 it's MBR. This option forces fdisk to
keep the device empty and allow user to create non-default PT in more
elegant way.

Addresses: https://github.com/karelzak/util-linux/pull/994
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: remove unwanted assert()
Karel Zak [Tue, 24 Mar 2020 09:52:54 +0000 (10:52 +0100)] 
libfdisk: remove unwanted assert()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoRevert "tests: fixes fdisk/align-512-* tests"
Karel Zak [Tue, 24 Mar 2020 09:48:55 +0000 (10:48 +0100)] 
Revert "tests: fixes fdisk/align-512-* tests"

This reverts commit 25f5c514b95e1bf55d5f4bb1717fe2ec7e09d63b.

5 years agoMerge branch 'fdisk-sparc' of https://github.com/mator/util-linux
Karel Zak [Mon, 23 Mar 2020 15:35:32 +0000 (16:35 +0100)] 
Merge branch 'fdisk-sparc' of https://github.com/mator/util-linux

* 'fdisk-sparc' of https://github.com/mator/util-linux:
  tests: fixes fdisk/align-512-* tests

5 years agotests: fixes fdisk/align-512-* tests
Anatoly Pugachev [Mon, 23 Mar 2020 14:23:01 +0000 (17:23 +0300)] 
tests: fixes fdisk/align-512-* tests

write 'MSDOS' partition table before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
5 years agolibblkid: remove unnecessary uuid.h
Karel Zak [Mon, 23 Mar 2020 14:21:48 +0000 (15:21 +0100)] 
libblkid: remove unnecessary uuid.h

Addresses: https://github.com/karelzak/util-linux/issues/993
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'eject-sparc' of https://github.com/mator/util-linux
Karel Zak [Mon, 23 Mar 2020 11:14:57 +0000 (12:14 +0100)] 
Merge branch 'eject-sparc' of https://github.com/mator/util-linux

* 'eject-sparc' of https://github.com/mator/util-linux:
  tests: fixes mount tests on SPARC
  tests: fixes libmount/ on SPARC
  tests: fixes eject/umount on SPARC

5 years agolibblkid: Add support for zonefs
Damien Le Moal [Fri, 20 Mar 2020 04:55:43 +0000 (13:55 +0900)] 
libblkid: Add support for zonefs

The zonefs filesystem was added to upstream linux kernel 5.6. This
patch add support for probing zonefs formatted zoned block devices so
that other file system formatting tool can detect its presence on a
device.

[kzak@redhat.com: - use standard integer types]

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'man-kill' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 23 Mar 2020 09:28:16 +0000 (10:28 +0100)] 
Merge branch 'man-kill' of https://github.com/kerolasa/util-linux

* 'man-kill' of https://github.com/kerolasa/util-linux:
  docs: kill.1 add note about shell-internal kill implementations

5 years agoMerge branch 'libfdisk-script-fix-segmentation-fault' of https://github.com/gportay...
Karel Zak [Mon, 23 Mar 2020 09:27:53 +0000 (10:27 +0100)] 
Merge branch 'libfdisk-script-fix-segmentation-fault' of https://github.com/gportay/util-linux

* 'libfdisk-script-fix-segmentation-fault' of https://github.com/gportay/util-linux:
  lib/mangle: check for the NULL string argument
  libfdisk: (script) fix segmentation fault

5 years agodocs: kill.1 add note about shell-internal kill implementations
Sami Kerola [Sun, 22 Mar 2020 09:37:41 +0000 (09:37 +0000)] 
docs: kill.1 add note about shell-internal kill implementations

Requested-by: Ilia Baryshnikov <qwelias@gmail.com>
Reference: https://github.com/karelzak/util-linux/issues/991#issuecomment-602108648
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolib/mangle: check for the NULL string argument
Gaël PORTAY [Fri, 20 Mar 2020 20:21:58 +0000 (16:21 -0400)] 
lib/mangle: check for the NULL string argument

This patch prevents to call the function strlen() with a NULL string
argument that leads to a segmentation fault.

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
5 years agolibfdisk: (script) fix segmentation fault
Gaël PORTAY [Fri, 20 Mar 2020 20:10:35 +0000 (16:10 -0400)] 
libfdisk: (script) fix segmentation fault

This patch fixes a segmentation fault that occurs if the name value is
empty (i.e. name=).

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
5 years agoFix typo in the mount (8) man page
Mark Barbone [Thu, 19 Mar 2020 22:13:46 +0000 (18:13 -0400)] 
Fix typo in the mount (8) man page

5 years agobuild-sys: fix chfn-chsh configure help text
Karel Zak [Mon, 16 Mar 2020 09:53:55 +0000 (10:53 +0100)] 
build-sys: fix chfn-chsh configure help text

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: smb2 is unsupported alias
Karel Zak [Wed, 11 Mar 2020 17:38:09 +0000 (18:38 +0100)] 
libmount: smb2 is unsupported alias

Kenneth D'souza wrote:
 # grep -w MODULE_ALIAS_FS fs/cifs/cifsfs.c
 MODULE_ALIAS_FS("cifs");
 112/112│MODULE_ALIAS_FS("smb3");

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: fixes mount tests on SPARC
Anatoly Pugachev [Tue, 10 Mar 2020 22:05:50 +0000 (01:05 +0300)] 
tests: fixes mount tests on SPARC

fdisk partition table fix for writting "msdos" label before the test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
5 years agotests: fixes libmount/ on SPARC
Anatoly Pugachev [Tue, 10 Mar 2020 17:24:40 +0000 (20:24 +0300)] 
tests: fixes libmount/ on SPARC

fdisk partition table fix for writting "msdos" label before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
5 years agotests: fixes eject/umount on SPARC
Anatoly Pugachev [Tue, 10 Mar 2020 16:16:01 +0000 (19:16 +0300)] 
tests: fixes eject/umount on SPARC

Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
5 years agolibmount: improve smb{2,3} support
Karel Zak [Wed, 11 Mar 2020 09:38:37 +0000 (10:38 +0100)] 
libmount: improve smb{2,3} support

It seems kernel can use smb3 as fstype in mountinfo.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoagetty: (man) fix typo
Karel Zak [Tue, 10 Mar 2020 19:55:00 +0000 (20:55 +0100)] 
agetty: (man) fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoagetty: (man) add "white" color name
Karel Zak [Tue, 10 Mar 2020 11:33:35 +0000 (12:33 +0100)] 
agetty: (man) add "white" color name

Addresses: https://github.com/karelzak/util-linux/issues/979
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoinclude: cleanup pidfd inckudes
Karel Zak [Tue, 10 Mar 2020 10:43:16 +0000 (11:43 +0100)] 
include: cleanup pidfd inckudes

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofsck.cramfs: fix macro usage
Zbigniew Jędrzejewski-Szmek [Tue, 25 Feb 2020 12:29:08 +0000 (13:29 +0100)] 
fsck.cramfs: fix macro usage

Autotoolz does not define HAVE_LCHOWN when the condition is false,
so it is appropriate to use #ifdef/#ifndef as everywhere else.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: rename automake variable to match define name
Zbigniew Jędrzejewski-Szmek [Sat, 22 Feb 2020 20:19:26 +0000 (21:19 +0100)] 
build-sys: rename automake variable to match define name

Just to make things a bit more consistent.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: remove unneeded include of generated file
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jan 2020 06:44:36 +0000 (07:44 +0100)] 
build-sys: remove unneeded include of generated file

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/color-names: add "white" between human-readable
Karel Zak [Tue, 10 Mar 2020 08:45:33 +0000 (09:45 +0100)] 
lib/color-names: add "white" between human-readable

Addresses: https://github.com/karelzak/util-linux/issues/979
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'nsenter' of https://github.com/adrianreber/util-linux
Karel Zak [Tue, 10 Mar 2020 08:40:34 +0000 (09:40 +0100)] 
Merge branch 'nsenter' of https://github.com/adrianreber/util-linux

5 years agonsenter: add support for the time namespace
Adrian Reber [Mon, 9 Mar 2020 13:02:45 +0000 (13:02 +0000)] 
nsenter: add support for the time namespace

Just as with unshare and lsns this adds time namespace support to
nsenter.

In contrast to unshare nsenter does not have the options '--boottime'
and '--monotonic' as that offset can only be set as long as there have
no processes being started in the corresponding time namespace.

Signed-off-by: Adrian Reber <areber@redhat.com>
5 years agounshare: use '-T' for time namespace instead of '-t'
Adrian Reber [Mon, 9 Mar 2020 12:20:51 +0000 (12:20 +0000)] 
unshare: use '-T' for time namespace instead of '-t'

While working on getting time namespace support into 'nsenter' it was
not possible to use '-t' to enter a time namespace as '-t' is the short
option for '--target'. Fortunately '-T' is still available in 'nsenter'
and 'unshare' and therefore let's change 'unshare' to use the same flag
for the time namespace as 'nsenter'.

Signed-off-by: Adrian Reber <areber@redhat.com>
5 years agodocs: add rev(1) to TODO
Karel Zak [Mon, 9 Mar 2020 10:07:48 +0000 (11:07 +0100)] 
docs: add rev(1) to TODO

Addresses: https://github.com/karelzak/util-linux/issues/972
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agorev: (man) add note about limitations
Karel Zak [Mon, 9 Mar 2020 10:03:30 +0000 (11:03 +0100)] 
rev: (man) add note about limitations

Addresses: https://github.com/karelzak/util-linux/issues/972
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohexdump: fix typo, dcl instead of dc1
Karel Zak [Mon, 9 Mar 2020 09:54:28 +0000 (10:54 +0100)] 
hexdump: fix typo, dcl instead of dc1

Addresses: https://github.com/karelzak/util-linux/issues/976
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'time-namespace' of https://github.com/adrianreber/util-linux
Karel Zak [Mon, 9 Mar 2020 09:31:45 +0000 (10:31 +0100)] 
Merge branch 'time-namespace' of https://github.com/adrianreber/util-linux

* 'time-namespace' of https://github.com/adrianreber/util-linux:
  unshare: support the time namespace
  unshare: fix help message indentation

5 years agoMerge branch 'lsns' of https://github.com/adrianreber/util-linux
Karel Zak [Mon, 9 Mar 2020 09:29:32 +0000 (10:29 +0100)] 
Merge branch 'lsns' of https://github.com/adrianreber/util-linux

* 'lsns' of https://github.com/adrianreber/util-linux:
  lsns: add time namespace support

5 years agoMerge branch 'topic/irq'
Karel Zak [Mon, 9 Mar 2020 09:25:48 +0000 (10:25 +0100)] 
Merge branch 'topic/irq'

5 years agolsns: add time namespace support
Adrian Reber [Mon, 9 Mar 2020 09:16:07 +0000 (09:16 +0000)] 
lsns: add time namespace support

 # ./lsns -t time
         NS TYPE  NPROCS   PID USER COMMAND
 4026531834 time     102     1 root /usr/lib/systemd/systemd --switched-root --system --deserialize 29
 4026532246 time       1 54797 root sleep 1000

Signed-off-by: Adrian Reber <areber@redhat.com>
5 years agounshare: support the time namespace
Adrian Reber [Fri, 6 Mar 2020 11:05:00 +0000 (12:05 +0100)] 
unshare: support the time namespace

This adds support to unshare for time namespaces. With the newly added
options '-t, --time' and '--monotonic' and '--boottime' it is now
possible to change CLOCK_MONOTONIC and CLOCK_BOOTTIME in a new time
namespace.

The time namespace has been merged in kernel version 5.6 and an easy way
to test it is using CLOCK_BOOTTIME and the uptime command:

 # uptime
 11:08:26 up 20:28,  1 user,  load average: 0.00, 0.00, 0.00
 # ./unshare --fork --time --boottime 100000000 uptime
 11:08:29 up 1158 days,  6:15,  1 user,  load average: 0.00, 0.00, 0.00

Signed-off-by: Adrian Reber <areber@redhat.com>
5 years agounshare: fix help message indentation
Adrian Reber [Fri, 6 Mar 2020 11:03:50 +0000 (12:03 +0100)] 
unshare: fix help message indentation

A few lines of the help message were unaligned in the output because of
mixes use of tabs and space. This removes all tabs and replaces them
with spaces.

Signed-off-by: Adrian Reber <areber@redhat.com>
5 years agodocs: fix spacing in irqtop and lsirq manual pages
Sami Kerola [Fri, 6 Mar 2020 20:34:06 +0000 (20:34 +0000)] 
docs: fix spacing in irqtop and lsirq manual pages

And convert font changing macros to ones used in howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolsirq: mark --json and --pairs options mutually exclusive
Sami Kerola [Fri, 6 Mar 2020 20:14:06 +0000 (20:14 +0000)] 
lsirq: mark --json and --pairs options mutually exclusive

Before this change --pairs option would always win over --json.  That is
unnecessarily confusing, it is much better to disallow combination that does
not make sense.

Notice that the --noheadings in combination with --json or --pairs will not
cause any effect.  In strictest possible understanding --noheadings should
also be exclusive.  Looking from more relaxed point of view neither --json
nor --pairs has heading, so excluding is not necessary because --noheading
is happening already.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agobash-completion: update irqtop and lsirq completions
Sami Kerola [Fri, 6 Mar 2020 19:49:34 +0000 (19:49 +0000)] 
bash-completion: update irqtop and lsirq completions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolsirq: add -P option
Karel Zak [Fri, 6 Mar 2020 15:34:51 +0000 (16:34 +0100)] 
lsirq: add -P option

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsirq: add -n option
Karel Zak [Fri, 6 Mar 2020 15:26:06 +0000 (16:26 +0100)] 
lsirq: add -n option

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsirq: add new command
Karel Zak [Fri, 6 Mar 2020 15:21:10 +0000 (16:21 +0100)] 
lsirq: add new command

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoirqtop: cleanup man page
Karel Zak [Fri, 6 Mar 2020 15:16:38 +0000 (16:16 +0100)] 
irqtop: cleanup man page

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoirqtop: cleanup sort stuff
Karel Zak [Fri, 6 Mar 2020 14:28:57 +0000 (15:28 +0100)] 
irqtop: cleanup sort stuff

* user "cmp" in the function names (it does not sort)
* keep all in irq-common.c
* use column names on command line (e.g. --sort NAME)
* hardcode default to sort_result()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoirqtop: small cleanup in main()
Karel Zak [Fri, 6 Mar 2020 13:55:19 +0000 (14:55 +0100)] 
irqtop: small cleanup in main()

5 years agoirqtop: cleanup struct irq_stat use
Karel Zak [Fri, 6 Mar 2020 13:49:53 +0000 (14:49 +0100)] 
irqtop: cleanup struct irq_stat use

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoirqtop: move WINDOW back to control struct
Karel Zak [Fri, 6 Mar 2020 13:21:46 +0000 (14:21 +0100)] 
irqtop: move WINDOW back to control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoirqtop: minor cleanup
Karel Zak [Fri, 6 Mar 2020 13:11:30 +0000 (14:11 +0100)] 
irqtop: minor cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoirqtop: move independent code to irq-common.c
Karel Zak [Fri, 6 Mar 2020 13:04:33 +0000 (14:04 +0100)] 
irqtop: move independent code to irq-common.c

Signed-off-by: Karel Zak <kzak@redhat.com>