]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agolibmount: accept another flags on MS_REMOUNT|MS_BIND
Karel Zak [Mon, 28 May 2018 13:46:28 +0000 (15:46 +0200)] 
libmount: accept another flags on MS_REMOUNT|MS_BIND

The current libmount MS_REMOUNT|MS_BIND support is restricted to
MS_RDONLY (read-only bind mount). This is too restrictive as Linux
kernel supports bind-remount for arbitrary VFS flags.

After this update you can use

 # mount /dev/sdc1 /mnt/A
 # mount --bind -onosuid,noexec /mnt/A /mnt/B

 # findmnt /dev/sdc1 -oTARGET,SOURCE,FS-OPTIONS,VFS-OPTIONS
 TARGET SOURCE    FS-OPTIONS                 VFS-OPTIONS
 /mnt/A /dev/sdc1 rw,stripe=512,data=ordered rw,relatime
 /mnt/B /dev/sdc1 rw,stripe=512,data=ordered rw,nosuid,noexec,relatime

The "mount --bind" is composed from two syscalls of course (1st is
bind, 2nd is bind,remount,nosuid,noexec).

Addresses: https://github.com/karelzak/util-linux/issues/637
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomountpoint: simplify test condition [cppcheck]
Sami Kerola [Tue, 15 May 2018 19:14:05 +0000 (20:14 +0100)] 
mountpoint: simplify test condition [cppcheck]

[sys-utils/mountpoint.c:79]: (style) Redundant condition:
ctl->st.st_dev==pst.st_dev. 'A || (!A && B)' is equivalent to 'A || B'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoinclude/pt-mbr.h: fix integer overflow
Sami Kerola [Sat, 12 May 2018 21:45:58 +0000 (22:45 +0100)] 
include/pt-mbr.h: fix integer overflow

gcc -fsanitize=undefined gives following warning.

include/pt-mbr.h:27:51: runtime error: left shift of 248 by 24 places cannot
be represented in type 'int'

It looks like char is converted internally to int before bit-shift, and that
type overflows when char value is greater than 127.  Following code snippet
will show the effect what is stored when undefined behaviour happens.

    #include <stdio.h>
    #include <inttypes.h>
    int main(int argc, unsigned char **argv)
    {
        char p[] = { 170, 170, 170, 170 };
        unsigned int uint = p[3];
        uint64_t res = 0;
        /* overflow */
        res = p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
        printf("%" PRIu64 "\n", res);
        /* this is fine */
        res = 0;
        res = p[0] | (p[1] << 8) | (p[2] << 16) | (uint << 24);
        printf("%" PRIu64 "\n", res);
        return 0;
    }

I tested gcc 8.1.0, clang 6.0.0, and tcc 0.9.27 and they all printed the
same values.

    $ ./a.out
    18446744073709551530
    4294967210

Because output is result of undefined behavior what is stored may change in
future, and other compilers / version might do something different.  In the
case of what pt-mbr.h the destination data type size was commonly 32 bits in
size, that truncated excess rubbish from bitshift.  Needless to say that was
not very robust code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agonls: remove translation strings
Sami Kerola [Thu, 10 May 2018 20:18:53 +0000 (21:18 +0100)] 
nls: remove translation strings

While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file.  That inspired me to look if there are more
strings that does not need translation project attention.  This change
removes at least some of them, if not all.

Reference: e19cc7b65b31c57f0fe9cb73c9afad5197796f82
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: add swapon specifiers to completion
Sami Kerola [Thu, 10 May 2018 20:02:00 +0000 (21:02 +0100)] 
bash-completion: add swapon specifiers to completion

No space after device name is not entirely right, but that's better than
missing argument completions.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorev: move a global variable to local scope
Sami Kerola [Wed, 9 May 2018 20:54:22 +0000 (21:54 +0100)] 
rev: move a global variable to local scope

Mark also file names read-only.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agotests: move stderr redirection out from test expression
Sami Kerola [Fri, 4 May 2018 19:38:03 +0000 (20:38 +0100)] 
tests: move stderr redirection out from test expression

Fix shellcheck error.

if ! [ "$paraller_jobs" -ge 0 2>/dev/null ]; then
^-- SC1009: The mentioned parser error was in this if expression.
     ^-- SC1073: Couldn't parse this test expression.
                              ^-- SC1072: Expected test to end here (don't
                                  wrap commands in []/[[]]). Fix any
                                  mentioned problems and try again.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolib/strutils: fix strnlen() fallback
Karel Zak [Mon, 28 May 2018 10:30:34 +0000 (12:30 +0200)] 
lib/strutils: fix strnlen() fallback

Addresses: https://github.com/karelzak/util-linux/issues/643
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Mon, 28 May 2018 07:58:19 +0000 (09:58 +0200)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Fix reporting UDF 2.60 revision

7 years agolibblkid: (ntfs) fix cluster size check
Karel Zak [Fri, 25 May 2018 19:02:23 +0000 (21:02 +0200)] 
libblkid: (ntfs) fix cluster size check

Addresses: https://github.com/karelzak/util-linux/issues/641
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: udf: Fix reporting UDF 2.60 revision
Pali Rohár [Fri, 25 May 2018 15:52:31 +0000 (17:52 +0200)] 
libblkid: udf: Fix reporting UDF 2.60 revision

According to the UDF 2.60 specification, the Minimum UDF Read Revision
value shall be at most #0250 for all media with a UDF 2.60 file system.

So in this case use Minimum UDF Write Revision as ID_FS_VERSION to
distinguish between UDF 2.50 and UDF 2.60 discs.

This commit also adds a testing Blu-Ray Recordable image with UDF revision
2.60 created by Nero which really sets Minimum UDF Read Revision to 2.50.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
7 years agolibblkid: (ntfs) enlarge cluster limit to 2MB
Karel Zak [Fri, 25 May 2018 11:53:03 +0000 (13:53 +0200)] 
libblkid: (ntfs) enlarge cluster limit to 2MB

Windows 10 Creators edition has extended the ntfs cluster limit to
2MB. As a consequence blkid does not identify recent partitions with
clusters beyond 65K as ntfs ones.

Addresses: https://github.com/karelzak/util-linux/issues/641
Signed-off-by: Karel Zak <kzak@redhat.com>
Co-Author: Jean-Pierre André <jean-pierre.andre@wanadoo.fr>

7 years agocfdisk: fix compiler warnings, follow-up 7085f1e4 (#636)
Ruediger Meier [Thu, 24 May 2018 13:52:01 +0000 (15:52 +0200)] 
cfdisk: fix compiler warnings, follow-up 7085f1e4 (#636)

Seen on OSX 10.13, xcode 9.3.

 disk-utils/cfdisk.c:1860:45: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
         DBG(UI, ul_debug("get_size (default=%ju)", *res));
                                             ~~~    ^~~~
                                             %llu
 disk-utils/cfdisk.c:267:60: note: expanded from macro 'DBG'
 #define DBG(m, x)       __UL_DBG(cfdisk, CFDISK_DEBUG_, m, x)
                                                           ^
 ./include/debug.h:67:4: note: expanded from macro '__UL_DBG'
                         x; \
                         ^
 disk-utils/cfdisk.c:1889:25: error: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter of type 'uintmax_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
                         rc = parse_size(buf, &user, &pwr);      /* parse */
                                              ^~~~~
 ./include/strutils.h:15:51: note: passing argument to parameter 'res' here
 extern int parse_size(const char *str, uintmax_t *res, int *power);
                                                   ^
 2 errors generated.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
7 years agocfdisk: use uint64_t to avoid compiler warnings
Karel Zak [Thu, 24 May 2018 07:19:28 +0000 (09:19 +0200)] 
cfdisk: use uint64_t to avoid compiler warnings

Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslogins: add -o+<COLNAME> support
Karel Zak [Wed, 23 May 2018 14:44:42 +0000 (16:44 +0200)] 
lslogins: add -o+<COLNAME> support

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslogins: add PWD-METHOD column
Karel Zak [Wed, 23 May 2018 14:32:32 +0000 (16:32 +0200)] 
lslogins: add PWD-METHOD column

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslogins: fix password verification
Karel Zak [Wed, 23 May 2018 10:43:26 +0000 (12:43 +0200)] 
lslogins: fix password verification

Let's follow the standard $id$salt$encrypted password format in
verification code.

The current code is useless and for example PWD-LOCK column is always
FALSE.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1581611
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoman: Change the only argument to two for the two-fonts macros
Bjarni Ingi Gislason [Sat, 19 May 2018 00:09:56 +0000 (00:09 +0000)] 
man: Change the only argument to two for the two-fonts macros

  Punctuation marks have been left in the only argument of two-fonts
macros, instead of being separated from it to make the second one.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
7 years agoman: choom.1: Use the correct macro for the font change of one argument
Bjarni Ingi Gislason [Sat, 19 May 2018 00:08:50 +0000 (00:08 +0000)] 
man: choom.1: Use the correct macro for the font change of one argument

  Use the correct macro "I" for one argument, instead of the
two-fonts macro "IR".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
7 years agoman: Use the correct macro for a font change of one argument
Bjarni Ingi Gislason [Fri, 18 May 2018 19:21:42 +0000 (19:21 +0000)] 
man: Use the correct macro for a font change of one argument

  Use the correct macro (I, B) for the font change of one argument, not
those that are used for alternating two fonts, like "BR", "IR", "RB",
or "RI".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
7 years agomore: reorder global declarations
Sami Kerola [Thu, 19 Apr 2018 21:46:27 +0000 (22:46 +0100)] 
more: reorder global declarations

Group include, defines and such together, and move items inbetween functions
on top of the source file so that everything can be seen easily.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agomore: remove function prototypes
Sami Kerola [Thu, 19 Apr 2018 21:46:26 +0000 (22:46 +0100)] 
more: remove function prototypes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolsns: remove unnecessary include
Karel Zak [Thu, 17 May 2018 10:42:16 +0000 (12:42 +0200)] 
lsns: remove unnecessary include

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: fix printf format specifiers
Ruediger Meier [Wed, 16 May 2018 10:37:17 +0000 (12:37 +0200)] 
script: fix printf format specifiers

Noticed on 32bit builds. Types changed in 0da73643.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
7 years agolsblk: fix notes about RAM disks
Karel Zak [Tue, 15 May 2018 08:51:15 +0000 (10:51 +0200)] 
lsblk: fix notes about RAM disks

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: don't exclude RAM disks on --all
Karel Zak [Tue, 15 May 2018 08:29:22 +0000 (10:29 +0200)] 
lsblk: don't exclude RAM disks on --all

Reported-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoiscript: s/COLS/COLUMNS/ in start message
Karel Zak [Mon, 14 May 2018 11:59:52 +0000 (13:59 +0200)] 
iscript: s/COLS/COLUMNS/ in start message

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: update script done messages
Karel Zak [Mon, 14 May 2018 11:54:23 +0000 (13:54 +0200)] 
tests: update script done messages

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: record exit code
Karel Zak [Mon, 14 May 2018 11:51:01 +0000 (13:51 +0200)] 
script: record exit code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: update script headers
Karel Zak [Mon, 14 May 2018 10:57:39 +0000 (12:57 +0200)] 
tests: update script headers

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: add more info to script header
Karel Zak [Mon, 14 May 2018 10:51:50 +0000 (12:51 +0200)] 
script: add more info to script header

This patch introduces [...] to store extra information about terminal
to the typescript header. For example:

  Script started on 2018-05-14 12:52:32+02:00 [TERM="xterm-256color" TTY="/dev/pts/3" COLS="190" LINES="53"]

or

  Script started on 2018-05-14 12:54:01+02:00 [<not executed on terminal>]

if stdout is not terminal.

Addresses: https://github.com/karelzak/util-linux/issues/583
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: add hint about script
Karel Zak [Mon, 14 May 2018 10:05:20 +0000 (12:05 +0200)] 
docs: add hint about script

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: cleanup done timestamp message
Karel Zak [Mon, 14 May 2018 10:01:15 +0000 (12:01 +0200)] 
script: cleanup done timestamp message

* always save "done" timestamp to typescript (use done() for this)
* use FORMAT_TIMESTAMP_MAX as buffer size

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: remove debug stuff from ts/script/options
Karel Zak [Mon, 14 May 2018 09:56:46 +0000 (11:56 +0200)] 
tests: remove debug stuff from ts/script/options

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: use uint64_t for file sizes
Karel Zak [Mon, 14 May 2018 09:35:37 +0000 (11:35 +0200)] 
script: use uint64_t for file sizes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: add the -o/--output-limit option. Fix race test.
Fred Mora [Mon, 14 May 2018 09:20:06 +0000 (11:20 +0200)] 
script: add the -o/--output-limit option. Fix race test.

When script is used on a host with a relatively small free disk space, it
is sometimes desirable to limit the size of the captured output. This
can now be enforced with the --output-limit option.

The --output-limit option lets the user specify a maximum size. The program
uses the size parsing from strutils and thus supports the usual
multiplicative suffixes (kiB, KB, MiB, MB, etc.). After the specified
number of bytes have been written to the output file, the script program
will terminate the child process.

Due to buffering, the size of the output file might exceed the specified
limit. This limit also does not include the start and done messages.

The race test was throwing an error dur to a variable being "" in some cases.
Quoting the variable in the equal test took care of that test.

[kzak@redhat.com: - use done() to stop script
                  - count also timing file
                  - remove unnamed member initialization in ctl struct
                  - add to bash-completion]

Signed-off-by: Fred Mora <fmora@datto.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobash-completion: add findmnt --real --pseudo
Karel Zak [Fri, 11 May 2018 08:50:19 +0000 (10:50 +0200)] 
bash-completion: add findmnt --real --pseudo

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomisc-utils/findmnt.8: add --pseudo and --real options
sluidfoe [Thu, 10 May 2018 16:53:03 +0000 (11:53 -0500)] 
misc-utils/findmnt.8: add --pseudo and --real options

7 years agomisc-tools/findmnt: a few whitespace fixes
sluidfoe [Tue, 8 May 2018 18:10:06 +0000 (13:10 -0500)] 
misc-tools/findmnt: a few whitespace fixes

7 years agomisc-tools/findmnt: add --pseudo, --real filters
sluidfoe [Tue, 8 May 2018 18:08:47 +0000 (13:08 -0500)] 
misc-tools/findmnt: add --pseudo, --real filters

7 years agoMerge branch 'output-all' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Thu, 10 May 2018 10:15:32 +0000 (12:15 +0200)] 
Merge branch 'output-all' of https://github.com/kerolasa/lelux-utiliteetit

* 'output-all' of https://github.com/kerolasa/lelux-utiliteetit:
  zramctl: add --output-all option
  swapon: add --output-all option
  rfkill: add --output-all option
  partx: add --output-all option
  lsns: add --output-all option
  lsmem: add --output-all option
  lslogins: add --output-all option
  lslocks: add --output-all option
  lscpu: add --output-all option
  losetup: add --output-all option
  findmnt: add --output-all option

7 years agoMerge branch 'fixes' of https://github.com/yontalcar/util-linux
Karel Zak [Thu, 10 May 2018 09:59:41 +0000 (11:59 +0200)] 
Merge branch 'fixes' of https://github.com/yontalcar/util-linux

* 'fixes' of https://github.com/yontalcar/util-linux:
  libfdisk: fix list_del after partition reset
  choom: set oom_score_adj before exec
  fdisk: fix typo in debug string

7 years agochcpu: Fix maximal number of CPUs
Stanislav Brabec [Wed, 9 May 2018 20:13:07 +0000 (22:13 +0200)] 
chcpu: Fix maximal number of CPUs

chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit
mask). It effectively limits number of CPUs to 1/8 of the supported
amount.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Michael Matz <matz@suse.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
7 years agolscpu, chcpu: Avoid use of the old CPU macros
Stanislav Brabec [Wed, 9 May 2018 16:08:32 +0000 (18:08 +0200)] 
lscpu, chcpu: Avoid use of the old CPU macros

The old CPU macros are limited to 1024 cores. As a result, lscpu cannot
count sockets on large systems. Use new scalable macros.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Michael Matz <matz@suse.de>
7 years agolast: fix false positive compiler warning
Sami Kerola [Thu, 3 May 2018 21:57:59 +0000 (22:57 +0100)] 
last: fix false positive compiler warning

login-utils/last.c: In function ‘list’:
login-utils/last.c:398:36: warning: argument to ‘sizeof’ in ‘strncat’ call
is the same expression as the source; did you mean to use the size of the
destination?  [-Wsizeof-pointer-memaccess]
  strncat(utline, p->ut_line, sizeof(p->ut_line));

The sizeof(utline) is defined as sizeof(p->ut_line) + 1, so the compiler got
that wrong.  Lets truncate strncat() otherway around to keep gcc 8.1 happy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agozramctl: fix truncation warning
Sami Kerola [Thu, 3 May 2018 21:57:58 +0000 (22:57 +0100)] 
zramctl: fix truncation warning

sys-utils/zramctl.c: In function ‘zram_get_sysfs’:
sys-utils/zramctl.c:220:52: warning: ‘%s’ directive output may be truncated
writing up to 4095 bytes into a region of size 27 [-Wformat-truncation=]
     snprintf(z->devname, sizeof(z->devname), "/dev/%s", name);

As an additional good thing zramctl will no longer allocate 4096 bytes from
stack when just 23 bytes is enough.

[kzak@redhat.com: - use macro rather than hardcoded string for the path]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/canonicalize: fix truncation warning
Sami Kerola [Thu, 3 May 2018 21:57:57 +0000 (22:57 +0100)] 
lib/canonicalize: fix truncation warning

lib/canonicalize.c: In function ‘canonicalize_dm_name’:
lib/canonicalize.c:42:45: warning: ‘%s’ directive output may be truncated
writing up to 255 bytes into a region of size 244 [-Wformat-truncation=]
   snprintf(path, sizeof(path), "/dev/mapper/%s", name);

Notice that this warnign fix does not improve code enormously.  The earlier
snprintf() truncation will not happen a bit earlier when fgets() is called.
In that sense this change merely makes one easy to silence warning to
disappear, and therefore improve change of noticing useful messaging as such
crops up.

[kzak@redhat.com: - use macro rather than hardcoded string for mapper path]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: fix list_del after partition reset
Vaclav Dolezal [Wed, 9 May 2018 14:35:38 +0000 (16:35 +0200)] 
libfdisk: fix list_del after partition reset

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agochoom: set oom_score_adj before exec
Vaclav Dolezal [Tue, 17 Apr 2018 17:03:17 +0000 (19:03 +0200)] 
choom: set oom_score_adj before exec

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agofdisk: fix typo in debug string
Vaclav Dolezal [Tue, 29 Aug 2017 13:29:27 +0000 (15:29 +0200)] 
fdisk: fix typo in debug string

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agozramctl: add --output-all option
Sami Kerola [Tue, 24 Apr 2018 21:18:54 +0000 (22:18 +0100)] 
zramctl: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoswapon: add --output-all option
Sami Kerola [Tue, 24 Apr 2018 20:59:23 +0000 (21:59 +0100)] 
swapon: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: add --output-all option
Sami Kerola [Tue, 24 Apr 2018 20:47:26 +0000 (21:47 +0100)] 
rfkill: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agopartx: add --output-all option
Sami Kerola [Tue, 24 Apr 2018 20:32:42 +0000 (21:32 +0100)] 
partx: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolsns: add --output-all option
Sami Kerola [Tue, 24 Apr 2018 20:27:04 +0000 (21:27 +0100)] 
lsns: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolsmem: add --output-all option
Sami Kerola [Tue, 24 Apr 2018 20:26:39 +0000 (21:26 +0100)] 
lsmem: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolslogins: add --output-all option
Sami Kerola [Mon, 23 Apr 2018 21:11:47 +0000 (22:11 +0100)] 
lslogins: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolslocks: add --output-all option
Sami Kerola [Mon, 23 Apr 2018 21:02:48 +0000 (22:02 +0100)] 
lslocks: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolscpu: add --output-all option
Sami Kerola [Mon, 23 Apr 2018 20:34:49 +0000 (21:34 +0100)] 
lscpu: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolosetup: add --output-all option
Sami Kerola [Mon, 23 Apr 2018 20:19:35 +0000 (21:19 +0100)] 
losetup: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agofindmnt: add --output-all option
Sami Kerola [Mon, 23 Apr 2018 20:02:44 +0000 (21:02 +0100)] 
findmnt: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agodmesg: link together with syslog(2) manual page
Sami Kerola [Thu, 26 Apr 2018 20:44:08 +0000 (21:44 +0100)] 
dmesg: link together with syslog(2) manual page

The dmesg may require capabilities(7) when /proc/sys/kernel/dmesg_restrict
has none zero value.  This is explained in detail in syslog(2) manual page.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibfdisk: fix compiler warning [-Wunused-parameter]
Karel Zak [Thu, 3 May 2018 08:30:51 +0000 (10:30 +0200)] 
libfdisk: fix compiler warning [-Wunused-parameter]

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: fix compiler warning [-Wunused-parameter]
Karel Zak [Thu, 3 May 2018 08:30:51 +0000 (10:30 +0200)] 
libmount: fix compiler warning [-Wunused-parameter]

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: (zfs) fix compiler warning [-Wmaybe-uninitialized]
Karel Zak [Thu, 3 May 2018 08:30:51 +0000 (10:30 +0200)] 
libblkid: (zfs) fix compiler warning [-Wmaybe-uninitialized]

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: fix compiler warning [-Wmaybe-uninitialized]
Karel Zak [Thu, 3 May 2018 08:30:51 +0000 (10:30 +0200)] 
fdisk: fix compiler warning [-Wmaybe-uninitialized]

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: cleanup --with/--without help strings
Karel Zak [Thu, 3 May 2018 08:16:11 +0000 (10:16 +0200)] 
build-sys: cleanup --with/--without help strings

--with-     means disabled by default or modify any default path
--without-  means enabled by default

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: --without-systemd disables --with-systemdsystemunitdir
Karel Zak [Thu, 3 May 2018 07:56:35 +0000 (09:56 +0200)] 
build-sys: --without-systemd disables --with-systemdsystemunitdir

Make sure --without-systemd disables also --with-systemdsystemunitdir.

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'fix-pt_BR-trans' of https://github.com/luizluca/util-linux
Karel Zak [Mon, 30 Apr 2018 09:26:16 +0000 (11:26 +0200)] 
Merge branch 'fix-pt_BR-trans' of https://github.com/luizluca/util-linux

7 years agoblkid: (man) add note about udev encoding
Karel Zak [Mon, 30 Apr 2018 08:52:53 +0000 (10:52 +0200)] 
blkid: (man) add note about udev encoding

Addresses: https://github.com/karelzak/util-linux/issues/632
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: extend "Could not locate the pkg-config" error message
Karel Zak [Mon, 30 Apr 2018 07:41:26 +0000 (09:41 +0200)] 
build-sys: extend "Could not locate the pkg-config" error message

Addresses: https://github.com/karelzak/util-linux/issues/631
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: improve bison version detection
Karel Zak [Mon, 30 Apr 2018 07:37:14 +0000 (09:37 +0200)] 
build-sys: improve bison version detection

Addresses: https://github.com/karelzak/util-linux/issues/630
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: improve docs about mnt_context_mount() return codes
Karel Zak [Thu, 26 Apr 2018 09:04:07 +0000 (11:04 +0200)] 
libmount: improve docs about mnt_context_mount() return codes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agopo: pt_BR: fix fallocate '-l' help msg
Luiz Angelo Daros de Luca [Tue, 24 Apr 2018 17:40:02 +0000 (14:40 -0300)] 
po: pt_BR: fix fallocate '-l' help msg

Translation was using '-n' instead of '-l'

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
7 years agolibblkid: add BitLocker detection
Karel Zak [Tue, 24 Apr 2018 08:57:48 +0000 (10:57 +0200)] 
libblkid: add BitLocker detection

Supported:
* WinVista version
* Win7 and later versions (based on NTFS)
* BitLockerToGo (for removable media; based on FAT32)

Unfortunately, it's without LABEL and UUID. It seems BitLocker does
not use volume_label and volume_serial stuff from NTFS header.

Addresses: https://github.com/karelzak/util-linux/issues/617
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Fri, 20 Apr 2018 08:06:41 +0000 (10:06 +0200)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  Update information about udf in mount manpage

7 years agoumount: add note about --lazy
Karel Zak [Fri, 20 Apr 2018 07:50:04 +0000 (09:50 +0200)] 
umount: add note about --lazy

Unfortunately, it's pretty common that users on production systems use
lazy umount to fix some FS issues. The usual result is unwanted system
reboot, because -l is not the right way how to fix unreachable NFS or
mess with local FS with submounts.

Note that after lazy umount /proc/self/mountinfo does not contain the
FS entry, but kernel still references the FS. It makes it very
difficult to debug.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1566674
Suggested-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoUpdate information about udf in mount manpage
Pali Rohár [Thu, 19 Apr 2018 15:22:49 +0000 (17:22 +0200)] 
Update information about udf in mount manpage

7 years agorfkill: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 14:08:15 +0000 (16:08 +0200)] 
rfkill: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsns: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 14:03:52 +0000 (16:03 +0200)] 
lsns: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsipc: cleanup columns[] usage
Karel Zak [Wed, 18 Apr 2018 13:51:17 +0000 (15:51 +0200)] 
lsipc: cleanup columns[] usage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolosetup: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 13:25:20 +0000 (15:25 +0200)] 
losetup: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agowipefs: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 13:12:46 +0000 (15:12 +0200)] 
wipefs: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslocks: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 13:07:31 +0000 (15:07 +0200)] 
lslocks: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslocks: add --bytes cleanup SIZE usage
Karel Zak [Wed, 18 Apr 2018 12:54:49 +0000 (14:54 +0200)] 
lslocks: add --bytes cleanup SIZE usage

The new command line option --bytes disables human readable output for
the SIZE and keep size in bytes. We use the same concept for all our
utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofindmnt: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 12:45:21 +0000 (14:45 +0200)] 
findmnt: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: use scols_column_set_json_type()
Karel Zak [Wed, 18 Apr 2018 12:32:39 +0000 (14:32 +0200)] 
fincore: use scols_column_set_json_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.
NeilBrown [Wed, 18 Apr 2018 03:31:38 +0000 (13:31 +1000)] 
libmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.

When you bind-mount a subdirectory of a local filesystem, the
path to that subdirectory appears as the fourth field in mountinfo.

For nfs mounts, the fourth field is always "/", and the subdirectory
part is appended to the "special" (aka "device") field.  This is
consistent with historical NFS usage which always includes a path in
the fs_spec field.

libmount needs to know about this when "mount -a" checks to see if
a filesystem is already mounted.

Without this fix, fstab lines like:

 server::/path /dir nfs defaults 0 0
 /dir/subdir /mnt/test none bind 0 0

result in a new mount at /mnt/test every time "mount -a" is run.

[kzak@redhat.com: - use strappend() rather than asprintf()]

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobugfix: fix possible segfault during umount -a
Richard Fuchs [Tue, 17 Apr 2018 13:40:20 +0000 (09:40 -0400)] 
bugfix: fix possible segfault during umount -a

mnt_context_get_mtab() doesn't set its return **tb argument on error,
and so in mnt_context_next_umount() mtab will remain uninitialized on
error, later resulting in cxt->mtab containing garbage, possibly
resulting in segfault on exit.

7 years agochoom: fix build, remove unnecessary include
Karel Zak [Mon, 16 Apr 2018 11:48:11 +0000 (13:48 +0200)] 
choom: fix build, remove unnecessary include

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'choom'
Karel Zak [Mon, 16 Apr 2018 11:03:25 +0000 (13:03 +0200)] 
Merge branch 'choom'

7 years agochoom: new command to adjust OOM-killer score value
Karel Zak [Mon, 16 Apr 2018 10:53:39 +0000 (12:53 +0200)] 
choom: new command to adjust OOM-killer score value

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>
7 years agoMerge branch 'rename-interactive' of https://github.com/g-raud/util-linux
Karel Zak [Mon, 16 Apr 2018 08:37:31 +0000 (10:37 +0200)] 
Merge branch 'rename-interactive' of https://github.com/g-raud/util-linux

* 'rename-interactive' of https://github.com/g-raud/util-linux:
  rename: fixup & style (no functional changes)
  rename: test availability of __fpurge() and fpurge()
  rename: ask(): call __fpurge() to cater for multi-byte characters
  rename.1: describe interactive mode
  rename: ask(): print n when EOF on input
  rename: detect tty in cbreak mode to make ask() read a single byte
  rename.1: fix warning section
  rename: add option --interactive to ask before overwriting
  rename: skip faccessat() failure if AT_SYMLINK_NOFOLLOW is not a valid flag
  rename: check source file access early

7 years agolslocks: fix memory leak
Karel Zak [Mon, 16 Apr 2018 08:27:29 +0000 (10:27 +0200)] 
lslocks: fix memory leak

Addresses: https://github.com/karelzak/util-linux/pull/618
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslocks: add info about OFD
Karel Zak [Fri, 13 Apr 2018 09:22:21 +0000 (11:22 +0200)] 
lslocks: add info about OFD

It seems users are confused by PID -1 and missing path. This patch add
more information about OFD locks to the man page and "undefined" to
the COMMAND column.

References: http://austingroupbugs.net/view.php?id=768
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1527102
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: (hfs) check allocation size
Karel Zak [Thu, 12 Apr 2018 12:21:47 +0000 (14:21 +0200)] 
libblkid: (hfs) check allocation size

The current prober is based on signature only (two bytes!). It seems
pretty fragile. Linux kernel also checks for allocation size in the
superblock, let's use it too... it's better than nothing.

Reported-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolscpu: Cortex-A12 merged into Cortex-A17
Karel Zak [Thu, 12 Apr 2018 09:32:17 +0000 (11:32 +0200)] 
lscpu: Cortex-A12 merged into Cortex-A17

References: https://community.arm.com/processors/b/blog/posts/arm-cortex-a17-cortex-a12-processor-update
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: include <poll.h> instead of <sys/poll.h>
Patrick Steinhardt [Tue, 10 Apr 2018 12:36:32 +0000 (13:36 +0100)] 
rfkill: include <poll.h> instead of <sys/poll.h>

The POSIX standard states that poll(3P) is being made available by
<poll.h>, not <sys/poll.h>. Most commands already include the correct
header, with the exception of rfkill. Fix that to avoid a warning on
musl-based systems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
7 years agocfdisk: fix missing prototype for `get_wch`
Patrick Steinhardt [Tue, 10 Apr 2018 12:36:31 +0000 (13:36 +0100)] 
cfdisk: fix missing prototype for `get_wch`

The header <ncursesw/ncurses.h> defines the get_wch(3) function only
when `NCURSES_WIDECHAR` is defined. This define is actually getting set
in the same header file, but only in case `_XOPEN_SOURCE` is defined and
has a value of 500 or higher. As we already have the precedence of
defining `_XOPEN_SOURCE` to a value of 600 in some other files, simply
define it to the minimum required value of 500 in "cfdisk.c". This
silences a warning for `get_wch` being unknown.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
7 years agosetpriv: implement option to set parent death signal
Patrick Steinhardt [Tue, 10 Apr 2018 11:08:21 +0000 (12:08 +0100)] 
setpriv: implement option to set parent death signal

When a process uses the syscall `prctl(PR_SET_PDEATHSIG, ...)`, it will
get notified with a process-defined signal as soon as its parent process
dies. This is for example being used by unshare(1)'s recently added
"--kill-child" option, causing the forked child to be killed as soon as
unshare itself dies.

Unfortunately, some LSMs will cause the parent death signal to be reset
when a process changes credentials, with the most important ones being
SELinux and AppArmor. The following command will thus not work as
expected:

    unshare --fork --kill-child setpriv --reuid user <executable>

As soon as setpriv changes UID, the parent death signal is cleared and
the child will never get signalled when unshare gets killed.

Add a new option "--pdeathsig keep|clear|<signal>". Setting this flag
will cause us to either

- restore the previously active parent death signal as soon as the
  setpriv has applied all credential changes
- clear the parent death signal
- set the parent death signal to "<signal>"

Furthermore, print out the currently set signal when dumping process
state.

[kzak@redhat.com: - small changes in codding style]

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karel Zak <kzak@redhat.com>