]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 years agoagetty: Reload only if it is really needed
Stanislav Brabec [Wed, 10 Oct 2018 17:26:34 +0000 (19:26 +0200)] 
agetty: Reload only if it is really needed

If netlink event arrives and related escapes are part of issue, agetty
reloads and re-display the prompt. Reload is triggered not only by IP
address change, but also by IPv6 RAs. In some environments it causes
reload several times in a minute, and even complicates the login.

To prevent this, reload only if a real change appears.

This consists of:
split print_issue_file() to several functions:

eval_issue_file() prints issue to memory. It does not affect terminal in
any way.

print_issue_file() prints issue file from memory.

cmp_issue_file() compares the issue file and returns true, if reload is
needed.

The implementation requires additional change:

do_prompt() does not evaluate the issue file. It is responsibility of
calling function.

Test suite:

Use issue that contais \4 and/or \6 escape.

After installing new instance, restart agetty by typing a letter and then
Enter 6 times.

To check whether reload happens, type a letter. When reload happens,
letter disappears.

1. Unplug network cable. Wait a while and re-plug network cable.
You should see 2 reloads on single stack and 3 reloads on dual stack.

2. Run a loop
while : ; do
sed -i '$areload_test' /etc/issue
agetty --reload
sleep 3
sed -i '/reload_test/d' /etc/issue
agetty --reload
sleep 3
done
You should see regular reload every 3 seconds.

3. Run a loop
while : ; do
agetty --reload
sleep 3
done
Before: You see regular reload every 3 seconds.
After: No reloads.

4. Run a loop
while : ; do
ifconfig lo 127.0.0.1 netmask 255.0.0.0
sleep 3
ifconfig lo 127.0.0.2 netmask 255.0.0.0
sleep 3
done
Before: You see regular reload every 3 seconds.
After: No reloads.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agoagetty: Watch only protocol requested by issue escapes
Stanislav Brabec [Wed, 10 Oct 2018 17:26:27 +0000 (19:26 +0200)] 
agetty: Watch only protocol requested by issue escapes

To decrease number of reloads, watch only protocol requested by \4 and \6
escapes in issue file.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agoagetty: rename variable changed to triggered
Stanislav Brabec [Wed, 10 Oct 2018 17:26:21 +0000 (19:26 +0200)] 
agetty: rename variable changed to triggered

changed variable name is not correct. It does not say that network
interface changed its address. It just says that the netlink message
processing was triggered.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agobash-completion: cleanup mount and umount --namespace
Karel Zak [Fri, 5 Oct 2018 09:48:04 +0000 (11:48 +0200)] 
bash-completion: cleanup mount and umount --namespace

* use only PATHs rather than PIDs to namespaces

* add --namespace to umount too

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch '2018wk40' of https://github.com/kerolasa/util-linux
Karel Zak [Fri, 5 Oct 2018 09:42:59 +0000 (11:42 +0200)] 
Merge branch '2018wk40' of https://github.com/kerolasa/util-linux

* '2018wk40' of https://github.com/kerolasa/util-linux:
  bash-completion: catch up with option changes

5 years agolibmount: keep namespaces support optional
Karel Zak [Fri, 5 Oct 2018 09:04:04 +0000 (11:04 +0200)] 
libmount: keep namespaces support optional

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: add USE_LIBMOUNT_SUPPORT_NAMESPACES
Karel Zak [Fri, 5 Oct 2018 09:02:26 +0000 (11:02 +0200)] 
build-sys: add USE_LIBMOUNT_SUPPORT_NAMESPACES

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobash-completion: catch up with option changes
Sami Kerola [Thu, 4 Oct 2018 20:36:22 +0000 (21:36 +0100)] 
bash-completion: catch up with option changes

Check what has changed in usage functions in between v2.32..a77bd80d5 and
update bash-completion files accordingly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agosfdisk: disable --activate for Hybrid GPT/MBR
Karel Zak [Thu, 4 Oct 2018 12:06:45 +0000 (14:06 +0200)] 
sfdisk: disable --activate for Hybrid GPT/MBR

Addresses: https://github.com/karelzak/util-linux/issues/699
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: add getopt to TODO
Karel Zak [Thu, 4 Oct 2018 10:54:05 +0000 (12:54 +0200)] 
docs: add getopt to TODO

Addresses: https://github.com/karelzak/util-linux/issues/701
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: be more verbose about PMBR on --activate
Karel Zak [Thu, 4 Oct 2018 10:40:10 +0000 (12:40 +0200)] 
sfdisk: be more verbose about PMBR on --activate

Addresses: https://github.com/karelzak/util-linux/issues/699
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agorename: avoid undefined function prototype for `fpurge`
Patrick Steinhardt [Wed, 26 Sep 2018 06:23:09 +0000 (08:23 +0200)] 
rename: avoid undefined function prototype for `fpurge`

In case where the non-standard `fpurge` function is available, we
redefine `__fpurge` to `fpurge`. We can do so because the only
difference between both functions is that one returns an error code
while the other does not. But as we do not check the error code either
way, we do not care about which one of them we use.

The above redefinition happens unconditionally if we know that `fpurge`
exists. Most notably, we also redefine it if we already do have an
`__fpurge` function available that could be used. This causes problems
on musl-based platforms, where we detect availability of `fpurge` in
libc, but where no function declaration for it exists in "stdio_ext.h".
The compiler thus prints a warning due to an unknown function, even
though it will link just fine.

Avoid this warning by only redefining `__fpurge` to `fpurge` when
HAVE___FPURGE is not defined.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
5 years agolsblk: fix unknown type `stat` caused by missing header
Patrick Steinhardt [Wed, 26 Sep 2018 06:23:08 +0000 (08:23 +0200)] 
lsblk: fix unknown type `stat` caused by missing header

The structure `blkdev_cxt` has a `struct stat` member embedded, whose
size may not be known on some systems because of a missing include for
"sys/stat.h". On glibc-based systems, this header is included
transitively via "sys/statvfs.h", but on musl-based systems it is not.

Fix the resulting compile error due to unknown size of the struct by
including "sys/stat.h".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
5 years agolibfdisk: fix printf format modifier
Ruediger Meier [Tue, 25 Sep 2018 22:37:29 +0000 (00:37 +0200)] 
libfdisk: fix printf format modifier

libfdisk/src/script.c: In function ‘fdisk_script_read_context’:
libfdisk/src/script.c:452:33: error: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
   snprintf(buf, sizeof(buf), "%zu", fdisk_get_grain_size(cxt));
                                 ^

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
5 years agolibfdisk: fix OSX compiler warning
Ruediger Meier [Tue, 25 Sep 2018 22:37:28 +0000 (00:37 +0200)] 
libfdisk: fix OSX compiler warning

libfdisk/src/context.c:1354:54: error: unused parameter 'cxt' [-Werror,-Wunused-parameter]
const char *fdisk_get_devmodel(struct fdisk_context *cxt)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
5 years agoagetty: cleanup code to copy to log strings
Karel Zak [Wed, 3 Oct 2018 15:08:11 +0000 (17:08 +0200)] 
agetty: cleanup code to copy to log strings

man utmp:
  String fields are terminated by a null byte ('\0') if they are shorter
  than the size of the field.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosu: cleanup code to copy to log strings
Karel Zak [Wed, 3 Oct 2018 15:08:11 +0000 (17:08 +0200)] 
su: cleanup code to copy to log strings

man utmp:
  String fields are terminated by a null byte ('\0') if they are shorter
  than the size of the field.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agologin: cleanup code to copy to log strings
Karel Zak [Wed, 3 Oct 2018 15:08:11 +0000 (17:08 +0200)] 
login: cleanup code to copy to log strings

man utmp:
  String fields are terminated by a null byte ('\0') if they are shorter
  than the size of the field.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agomkfs.cramfs: properly copy disk name
Karel Zak [Wed, 3 Oct 2018 15:07:37 +0000 (17:07 +0200)] 
mkfs.cramfs: properly copy disk name

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolast: make sure domain is zero terminated
Karel Zak [Wed, 3 Oct 2018 15:06:33 +0000 (17:06 +0200)] 
last: make sure domain is zero terminated

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agowall: make sure line is zero terminated
Karel Zak [Wed, 3 Oct 2018 15:06:12 +0000 (17:06 +0200)] 
wall: make sure line is zero terminated

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoinclude/c: add str2memcpy() and mem2strcpy()
Karel Zak [Wed, 3 Oct 2018 15:03:11 +0000 (17:03 +0200)] 
include/c: add str2memcpy() and mem2strcpy()

str2memcpy() - copy zero terminated string to optionally terminated buffer

mem2strcpy() - copy from buffer to zero terminated string

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoinclude/ttyutils: define values if missing.
Sevan Janiyan [Sat, 29 Sep 2018 13:49:02 +0000 (14:49 +0100)] 
include/ttyutils: define values if missing.

Upstreamed from pkgsrc.

Addresses: https://github.com/karelzak/util-linux/pull/695
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoinclude/c: add NAME_MAX compat
Sevan Janiyan [Sat, 29 Sep 2018 13:50:04 +0000 (14:50 +0100)] 
include/c: add NAME_MAX compat

Upstreamed from pkgsrc.

Addresses: https://github.com/karelzak/util-linux/pull/695
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: always use "part" as TYPE for partitions
Karel Zak [Wed, 3 Oct 2018 12:39:57 +0000 (14:39 +0200)] 
lsblk: always use "part" as TYPE for partitions

The current code uses "part" or "disk" only if nothing else is
possible to recognize. It means for example partitions on loops (or
RAIDs, etc) are marked as "loop" rather than "part".

Addresses: https://github.com/karelzak/util-linux/issues/700
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agomount: add note about MS_BIND and _netdev
Karel Zak [Tue, 2 Oct 2018 10:50:40 +0000 (12:50 +0200)] 
mount: add note about MS_BIND and _netdev

Addresses: https://github.com/karelzak/util-linux/issues/697
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: release++ (v2.33-rc1) v2.33-rc1
Karel Zak [Tue, 25 Sep 2018 09:26:58 +0000 (11:26 +0200)] 
build-sys: release++ (v2.33-rc1)

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add choom to build-sys test
Karel Zak [Mon, 24 Sep 2018 09:37:13 +0000 (11:37 +0200)] 
tests: add choom to build-sys test

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: fix gtkdoc warning
Karel Zak [Mon, 24 Sep 2018 09:21:09 +0000 (11:21 +0200)] 
docs: fix gtkdoc warning

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: update v2.33-ReleaseNotes
Karel Zak [Thu, 20 Sep 2018 12:27:55 +0000 (14:27 +0200)] 
docs: update v2.33-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: update AUTHORS file
Karel Zak [Thu, 20 Sep 2018 10:19:06 +0000 (12:19 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agopo: merge changes
Karel Zak [Wed, 19 Sep 2018 10:54:05 +0000 (12:54 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Wed, 19 Sep 2018 10:49:46 +0000 (12:49 +0200)] 
po: update sv.po (from translationproject.org)

5 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Wed, 19 Sep 2018 10:49:46 +0000 (12:49 +0200)] 
po: update pt_BR.po (from translationproject.org)

5 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Wed, 19 Sep 2018 10:49:46 +0000 (12:49 +0200)] 
po: update ja.po (from translationproject.org)

5 years agolibfdisk: (docs) add missing function
Karel Zak [Wed, 19 Sep 2018 10:00:59 +0000 (12:00 +0200)] 
libfdisk: (docs) add missing function

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: move udev and blkid stuff to lsblk-properties.c
Karel Zak [Wed, 19 Sep 2018 09:25:08 +0000 (11:25 +0200)] 
lsblk: move udev and blkid stuff to lsblk-properties.c

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: cleanup udev/blkid properties code
Karel Zak [Wed, 19 Sep 2018 09:04:35 +0000 (11:04 +0200)] 
lsblk: cleanup udev/blkid properties code

* split properties to separate struct which is allocated only when
  udev or blkid provides some information

* use separate function for udev and blkid and hide details in generic
  get_device_properties()

* make sure we do not overwrite stuff udev and blkid (but this is only
  theoretic issue as we do not call get_properties_by_blkid() directly
  from code)

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: update sfdisk resize
Karel Zak [Mon, 17 Sep 2018 14:22:14 +0000 (16:22 +0200)] 
tests: update sfdisk resize

due to 2f35c1ead621f42f32f7777232568cb03185b473

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: count gaps to possible size when resize
Karel Zak [Mon, 17 Sep 2018 09:58:50 +0000 (11:58 +0200)] 
libfdisk: count gaps to possible size when resize

The current code counts only partition sizes when it counts possible
space, but we have gaps between the partitions. It seems better to
count all based on offsets rather than sizes.

Addresses: https://github.com/karelzak/util-linux/issues/693
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: encapsulate stat() usage
Karel Zak [Fri, 14 Sep 2018 14:27:26 +0000 (16:27 +0200)] 
lsblk: encapsulate stat() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/strutils: return from xstrmode()
Karel Zak [Fri, 14 Sep 2018 14:26:38 +0000 (16:26 +0200)] 
lib/strutils: return from xstrmode()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: differentiate between swap and mount
Karel Zak [Fri, 14 Sep 2018 13:57:45 +0000 (15:57 +0200)] 
lsblk: differentiate between swap and mount

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: use lsblk_ prefix mountpoint getter
Karel Zak [Fri, 14 Sep 2018 13:49:00 +0000 (15:49 +0200)] 
lsblk: use lsblk_ prefix mountpoint getter

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: init/deinit libmount stuff
Karel Zak [Fri, 14 Sep 2018 13:45:53 +0000 (15:45 +0200)] 
lsblk: init/deinit libmount stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: move mount stuff to lsblk-mnt.c
Karel Zak [Fri, 14 Sep 2018 13:41:39 +0000 (15:41 +0200)] 
lsblk: move mount stuff to lsblk-mnt.c

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: add lsblk.h
Karel Zak [Fri, 14 Sep 2018 13:36:59 +0000 (15:36 +0200)] 
lsblk: add lsblk.h

* move core struct to the header file
* move debug stuff to the header file

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: add columns FSAVAIL,FSSIZE,FSUSED,FSUSE%
Karel Zak [Thu, 13 Sep 2018 10:11:06 +0000 (12:11 +0200)] 
lsblk: add columns FSAVAIL,FSSIZE,FSUSED,FSUSE%

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: accept grain script header
Karel Zak [Wed, 12 Sep 2018 11:18:08 +0000 (13:18 +0200)] 
libfdisk: accept grain script header

The "grain" variable is used to calculate partitions alignment. The
default is 1MiB (or minimal I/O size). The libfdisk provides API to overwrite
this default, but this feature has been nowhere accessible for
end-user.

This patch support for "grain: <size>" in libfdisk scripts.

Addresses: https://github.com/karelzak/util-linux/issues/688
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: document script GPT headers
Karel Zak [Wed, 12 Sep 2018 10:26:06 +0000 (12:26 +0200)] 
sfdisk: document script GPT headers

Add first-lba, last-lba and table-length to the sfdisk man page.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'more' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 11 Sep 2018 11:42:52 +0000 (13:42 +0200)] 
Merge branch 'more' of https://github.com/kerolasa/util-linux

* 'more' of https://github.com/kerolasa/util-linux:
  more: rename functions
  more: rename variable names
  more: remove unnecessary ifdef preprosessor directives
  more: do not call fileno() for std{in,out,err} streams
  more: remove 'register' keywords
  more: remove pointless functions
  more: return is statement not a function
  more: remove dead code and useless comments

5 years agounshare: remove -s from --help output
Karel Zak [Tue, 11 Sep 2018 10:43:03 +0000 (12:43 +0200)] 
unshare: remove -s from --help output

The code and man page do not assume -s to be short alias to
--setgroups.

This commit also a little bit change --help output formatting to make
it more readable and structured.

Addresses: https://github.com/karelzak/util-linux/pull/692
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: don't ask udev when --sysroot specified
Karel Zak [Tue, 11 Sep 2018 07:53:18 +0000 (09:53 +0200)] 
lsblk: don't ask udev when --sysroot specified

We use --sysroot to get information about block devices from /proc and
/sys dumps. In this case does not make sense to read anything from
udev as udevd is about the current system devices.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofallocate: add missing semicolon
Matti Niemenmaa [Mon, 10 Sep 2018 12:21:31 +0000 (15:21 +0300)] 
fallocate: add missing semicolon

This broke compilation when HAVE_POSIX_FALLOCATE was undefined. The typo
dates to the original posix_fallocate support added in commit
833f9a7aae713278eec5f85266597482f18c7370.

Signed-off-by: Matti Niemenmaa <matti.niemenmaa+git@iki.fi>
5 years agoMerge branch 'motd' of https://github.com/lnussel/util-linux
Karel Zak [Mon, 10 Sep 2018 08:35:32 +0000 (10:35 +0200)] 
Merge branch 'motd' of https://github.com/lnussel/util-linux

5 years agolsblk: prefer MODEL from udev DB
Karel Zak [Mon, 10 Sep 2018 08:29:37 +0000 (10:29 +0200)] 
lsblk: prefer MODEL from udev DB

sysfs device model is truncated to 16 characters:

> cat /sys/block/sda/device/model
Crucial_CT128MX1
> udevadm info --query=property /dev/sda | grep MODEL=
ID_MODEL=Crucial_CT128MX100SSD1

sysfs uses INQUARY response which has the 16 characters limitation and
udev uses something else.

Addresses: https://github.com/karelzak/util-linux/issues/690
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoAdd built in fallbacks for motd file
Ludwig Nussel [Fri, 7 Sep 2018 07:47:25 +0000 (09:47 +0200)] 
Add built in fallbacks for motd file

Use several locations for built in default for motd to allow for
e.g. run time generated motd without having to modify config files.
login.c already splits by colon.

/usr/share/misc/motd
  - chould be shipped by distributions
/run/motd
  - potentially run time created file with dynamic information
/etc/motd
  - for the admin fill with local information

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
5 years agoscript: be sensitive to another SIGCHLD ssi_codes
Karel Zak [Wed, 5 Sep 2018 09:51:22 +0000 (11:51 +0200)] 
script: be sensitive to another SIGCHLD ssi_codes

The current signalfd handler cares on CLD_EXITED only. It's pretty
insufficient as there is more situations (and codes) when child no
more running.

Addresses: https://github.com/karelzak/util-linux/issues/686
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolscpu: use the first VM from /proc/sysinfo
Karel Zak [Tue, 4 Sep 2018 12:30:37 +0000 (14:30 +0200)] 
lscpu: use the first VM from /proc/sysinfo

Addresses: https://github.com/karelzak/util-linux/issues/685
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolscpu: make xasprintf call more robust
Karel Zak [Tue, 4 Sep 2018 11:12:34 +0000 (13:12 +0200)] 
lscpu: make xasprintf call more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: default to /lib64 for ${exec_prefix}/lib64
Karel Zak [Tue, 4 Sep 2018 09:42:19 +0000 (11:42 +0200)] 
build-sys: default to /lib64 for ${exec_prefix}/lib64

We already default to /lib for the default $exec_prefix, but the current
configure does not care about /lib64 although the use-case is exactly
same as for /lib.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: remove obsolete entry from TODO
Karel Zak [Mon, 3 Sep 2018 13:53:41 +0000 (15:53 +0200)] 
docs: remove obsolete entry from TODO

Already implemented by commit cf654e1c3ec8f6f9ac93bf4f6981d560249868d9.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agomore: rename functions
Sami Kerola [Mon, 28 May 2018 08:49:26 +0000 (09:49 +0100)] 
more: rename functions

This clarifies what various function calls are doing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: rename variable names
Sami Kerola [Sun, 27 May 2018 16:29:09 +0000 (17:29 +0100)] 
more: rename variable names

Try to make variable names to tell what they do.  Earlier names have been in
more(1) since the command was first wrote, and it looks like coding
practices has changed since late 70's.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: remove unnecessary ifdef preprosessor directives
Sami Kerola [Sat, 26 May 2018 22:02:51 +0000 (23:02 +0100)] 
more: remove unnecessary ifdef preprosessor directives

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: do not call fileno() for std{in,out,err} streams
Sami Kerola [Sat, 26 May 2018 20:36:17 +0000 (21:36 +0100)] 
more: do not call fileno() for std{in,out,err} streams

These file descriptor numbers are well known, use them from unistd.h

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: remove 'register' keywords
Sami Kerola [Sat, 26 May 2018 20:24:31 +0000 (21:24 +0100)] 
more: remove 'register' keywords

One can only assume someone tried to make more(1) to run quicker.  More up
to date assumption is that compilers are fully capable optimizing binaries
without these sort of hints.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: remove pointless functions
Sami Kerola [Sat, 26 May 2018 20:16:07 +0000 (21:16 +0100)] 
more: remove pointless functions

The curs_terminfo(3X) defines putp() as tputs(str, 1, putchar), so all of
these five functions can be replaced with putp().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: return is statement not a function
Sami Kerola [Sat, 26 May 2018 19:55:32 +0000 (20:55 +0100)] 
more: return is statement not a function

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agomore: remove dead code and useless comments
Sami Kerola [Sat, 26 May 2018 19:08:34 +0000 (20:08 +0100)] 
more: remove dead code and useless comments

Removal of STOP requires explanation.  Looking unix-history-repo getline()
function in first BSD-3 version could return STOP.  By next tag BSD-4 the
return STOP had disappeared.  If I read this correctly that was a partial
removal, and second part has waited to be completed since 1980-11-16 when
BSD-4 was released.

Reference: https://github.com/dspinellis/unix-history-repo/blob/BSD-3-Snapshot-Development/usr/src/cmd/more.c#L501
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agotest: update UUID v5 tests
Karel Zak [Fri, 31 Aug 2018 10:48:46 +0000 (12:48 +0200)] 
test: update UUID v5 tests

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibuuid: fix name-based UUIDs
Karel Zak [Fri, 31 Aug 2018 10:27:32 +0000 (12:27 +0200)] 
libuuid: fix name-based UUIDs

The current version is not fully compatible with RFC4122. It
incorrectly encodes UUID variant

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

where M is UUID version and N is UUID variant.

 $ python -c "import uuid ; print(uuid.uuid5(uuid.UUID(int=0), 'foo'))"
 aa752cea-8222-5bc8-acd9-555b090c0ccb
                    ^^

Old version:

 $ uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1
 aa752cea-8222-5bc8-8cd9-555b090c0ccb
                    ^^

Fixed version:
 ./uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1;
 aa752cea-8222-5bc8-acd9-555b090c0ccb
                    ^^

The patch uses uuid_unpack and uuid_pack. It makes code more readable
and allow to access proper octens. The same way we already use for
time and random based UUIDs.

Addresses: https://github.com/karelzak/util-linux/issues/683
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibuuid: add note about RFC4122 UUID layout
Karel Zak [Fri, 31 Aug 2018 08:08:46 +0000 (10:08 +0200)] 
libuuid: add note about RFC4122 UUID layout

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: update fdisk output
Karel Zak [Thu, 30 Aug 2018 13:24:41 +0000 (15:24 +0200)] 
tests: update fdisk output

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofdisk: add "Disk model:" to the print output
Karel Zak [Thu, 30 Aug 2018 12:01:54 +0000 (14:01 +0200)] 
fdisk: add "Disk model:" to the print output

Addresses: https://github.com/karelzak/util-linux/issues/682
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: add fdisk_get_devmodel() and fdisk_get_devno()
Karel Zak [Thu, 30 Aug 2018 12:01:46 +0000 (14:01 +0200)] 
libfdisk: add fdisk_get_devmodel() and fdisk_get_devno()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: add note about lsblk usage/free cols
Karel Zak [Fri, 24 Aug 2018 10:04:24 +0000 (12:04 +0200)] 
docs: add note about lsblk usage/free cols

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: cleanup TODO
Karel Zak [Fri, 24 Aug 2018 09:28:43 +0000 (11:28 +0200)] 
docs: cleanup TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobash-completion: update column
Karel Zak [Thu, 23 Aug 2018 12:14:29 +0000 (14:14 +0200)] 
bash-completion: update column

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add column --table-empty-lines test
Karel Zak [Thu, 23 Aug 2018 11:41:05 +0000 (13:41 +0200)] 
tests: add column --table-empty-lines test

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agocolumn: add --table-empty-lines
Karel Zak [Thu, 23 Aug 2018 11:31:29 +0000 (13:31 +0200)] 
column: add --table-empty-lines

The option allows to add empty line to the table. The default behavior
is to ignore empty lines at all.

echo -e "A\nAA\nAAA\n\nAAAA" | ./column --table
A
AA
AAA
AAAA

$ echo -e "A\nAA\nAAA\n\nAAAA" | ./column --table --table-empty-lines
A
AA
AAA

AAAA

Addresses: https://github.com/karelzak/util-linux/issues/593
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibsmartcols: don't mark as extreme where average is zero
Karel Zak [Thu, 23 Aug 2018 08:13:17 +0000 (10:13 +0200)] 
libsmartcols: don't mark as extreme where average is zero

The columns with NOEXTREME flag are internally marked as extreme
(=contains extreme width) if maximal with is greater than 2 *
average_width. This detection has to sure that the average is non-zero
otherwise the column is always "extreme".

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibsmartcols: allow to add line to table without columns
Karel Zak [Thu, 23 Aug 2018 08:02:49 +0000 (10:02 +0200)] 
libsmartcols: allow to add line to table without columns

The table allows to add columns on the fly when lines already exist.
So, it does not make sense to reject request to add line to table
without columns.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosetpriv: add --reset-env
Karel Zak [Wed, 22 Aug 2018 09:43:32 +0000 (11:43 +0200)] 
setpriv: add --reset-env

Clear environment in way like su(1), but PATH is set to hard-coded
defaults and /etc/login.defs is not used at all (I guess we want to
keep setpriv(1) simple).

If you need anything more advanced than use env(1).

Addresses: https://github.com/karelzak/util-linux/issues/325
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosu: add note about merged /usr
Karel Zak [Wed, 22 Aug 2018 09:39:13 +0000 (11:39 +0200)] 
su: add note about merged /usr

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosetpriv: add user/group names to usage()
Karel Zak [Wed, 22 Aug 2018 08:35:51 +0000 (10:35 +0200)] 
setpriv: add user/group names to usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosetpriv: allow to use group name for --groups
Karel Zak [Wed, 22 Aug 2018 08:29:09 +0000 (10:29 +0200)] 
setpriv: allow to use group name for --groups

Addresses: https://github.com/karelzak/util-linux/issues/325
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosulogin: restore signals after failed exec() only
Karel Zak [Thu, 16 Aug 2018 14:16:40 +0000 (16:16 +0200)] 
sulogin: restore signals after failed exec() only

* removes unnecessary variable

* the current code restores signals always when shell has not been
  executed -- this is correct as function sushell() modify signal
  mask, but in all another cases we do not need touch the mask.
  Especially when we ask for the  password in endless while() loop...

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosulogin: do not use plain 0 as NULL
Karel Zak [Thu, 16 Aug 2018 13:58:20 +0000 (15:58 +0200)] 
sulogin: do not use plain 0 as NULL

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: cleanup licenses sections in the files
Karel Zak [Thu, 16 Aug 2018 13:43:53 +0000 (15:43 +0200)] 
libmount: cleanup licenses sections in the files

* add SPDX-License-Identifier (see https://spdx.org/licenses/)
* add "This file part of libmount from util-linux project."
* use proper text for LGPL-2.1-or-later
* use the same texts everywhere

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: use SPDX license names
Karel Zak [Thu, 16 Aug 2018 12:47:21 +0000 (14:47 +0200)] 
docs: use SPDX license names

Let's use standardized names for licenses. The names used by SPDX
makes things more obvious at first glance. For complete list see:
https://spdx.org/licenses/

Note, this commit does not change any license or so...

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofstrim: use -n shortcut for --dry-run
Karel Zak [Thu, 16 Aug 2018 12:00:45 +0000 (14:00 +0200)] 
fstrim: use -n shortcut for --dry-run

It seems 'n' is more common than 'd'. The patch also cleanup
getopt_long() options string.

Addresses: https://github.com/karelzak/util-linux/commit/fda0e2cf043994c77c29a2d109c03ce8957b1d38#commitcomment-30097920
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Thu, 16 Aug 2018 11:47:51 +0000 (13:47 +0200)] 
Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux

* 'spelling' of https://github.com/jwilk-forks/util-linux:
  Fix man page typos

5 years agoFix man page typos
Jakub Wilk [Thu, 16 Aug 2018 09:08:42 +0000 (11:08 +0200)] 
Fix man page typos

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
5 years agofincore.1: add missing space
Jakub Wilk [Thu, 16 Aug 2018 08:34:56 +0000 (10:34 +0200)] 
fincore.1: add missing space

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
5 years agosu: add --whitelist-environment
Karel Zak [Fri, 10 Aug 2018 08:49:15 +0000 (10:49 +0200)] 
su: add --whitelist-environment

* usable with --login to whitelist specified environment variables

* the list is ignored for the core variables like HOME, SHELL, USER,
  LOGNAME and PATH (su --login always resets these variables)

Note that su(1) requires password and after successful authentication
user has full control over the session, so he can set arbitrary
environment variables. The whitelist makes things more user friendly
only.

The patch removes unnecessary optimization when allocate environ[]. It
seems better to keep all in glibc hands and just reset the environment
array only.

Addresses: https://github.com/karelzak/util-linux/issues/221
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: fix typo in man install
Karel Zak [Wed, 15 Aug 2018 09:47:17 +0000 (11:47 +0200)] 
build-sys: fix typo in man install

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: report context paths on debug
Karel Zak [Tue, 14 Aug 2018 19:03:42 +0000 (21:03 +0200)] 
libmount: report context paths on debug

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: add adjtime_config(5) man page
Karel Zak [Tue, 14 Aug 2018 12:53:14 +0000 (14:53 +0200)] 
docs: add adjtime_config(5) man page

The file is pretty common, but undocumented by individual man page.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolscpu: fixed part ID for ARM Cortex-M7
Mark Sheppard [Mon, 13 Aug 2018 15:45:01 +0000 (16:45 +0100)] 
lscpu: fixed part ID for ARM Cortex-M7