Commit Graph

13145 Commits

Author SHA1 Message Date
Karel Zak 9fcc893624 lib/loopdev: differentiate between setter()s and ioctl calls
Now the internal API uses loopcxt_set_...() to set context variables
as well as to call ioctls. This patch introduces loopcxt_ioctl_...()
to makes things more obvious to readers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 11:12:42 +01:00
Karel Zak 56c2d2904f swapon: be more explicit about BTRFS
It seems nocow and nodatasum attributes are required.
See btrfs_swap_activate() in  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ed46ff3d423780fa5173b38a844bf0fdb210a2a7

Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 10:18:12 +01:00
Karel Zak 1895c76f74 swapon: rewrite section about swapfiles
* don't duplicate info on two places -- let's keep only small note
  in mkswap(8) man page, suggest to read swapon(8) man page

* add info about kernel versions for XFS and Btrfs swapfiles support

* use subsection in the NOTES

Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 10:02:17 +01:00
Karel Zak 77983e4a21 swapon: (man) iomap for swapfile is already supported by kernel
... since commit 67482129cdabf7cede1301d2415ef4f0156d35cd (Linus'
tree).

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-21 17:01:25 +01:00
Karel Zak eebfa469fc swapon: (man) cleanup note about holes
Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-21 12:54:20 +01:00
Karel Zak c22fc04127 mount: (man) add note about --all to remount desc
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-21 11:56:27 +01:00
Karel Zak 6daf185c3c losetup: use offset in warn_size() calculation
# dd if=/dev/urandom of=dummy bs=513 count=1 2>/dev/null

 # losetup -f --show --offset 1 dummy
 /dev/loop0
 losetup: dummy: Warning: file does not fit into a 512-byte sector; the end of the file will be ignore

The warning is bogus as with offset the size of the file fits into
512-byte sector. Simple test that all is right:

 # dd if=dummy bs=1 skip=1 2>/dev/null | sha256sum - /dev/loop0
 da2ed0ade6ea518a802cd8a7a3c01c408ad8699ef6856b0b01f92b867d4ba9b5  -
 da2ed0ade6ea518a802cd8a7a3c01c408ad8699ef6856b0b01f92b867d4ba9b5  /dev/loop0

Addresses: https://github.com/karelzak/util-linux/issues/722
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-18 12:13:12 +01:00
Karel Zak 8a74df7f74 libfdisk: add comment to fdisk_set_first_lba()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-18 11:38:57 +01:00
Karel Zak 4644c7f3a3 docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-18 11:14:38 +01:00
Karel Zak 9ed2117897 whereis: search in /(s)bin before /usr/lib
Addresses: https://github.com/karelzak/util-linux/issues/741
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-17 11:19:27 +01:00
Karel Zak 189a1bf3b3 libmount: add support for MS_REMOUNT on --all
This patch add to support for remount-all operation to
libmount and mount(8).

For example:
	mount --all -o remount,ro -t vfat

to remount read-only all VFAT filesystems.

Addresses: https://github.com/karelzak/util-linux/issues/589
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-16 15:00:07 +01:00
Karel Zak 12d12102d6 fsck.cramfs: fix utimes() usage
The bug has been introduced by untested commit ad7ac3d598 ;-(

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-15 11:44:25 +01:00
Karel Zak f4609dee20 build-sys: use REALTIME_LIBS for hwclock due to monotonic.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-14 12:18:35 +01:00
Karel Zak 491f3693cb Merge branch 'time-fixes' of https://github.com/kerolasa/util-linux
* 'time-fixes' of https://github.com/kerolasa/util-linux:
  fsck.cramfs: use utimes() instead of utime() that is obsolete
  hwclock: use monotonic time to measure how long setting time takes
  include: add indirect monotonic clock id specifier
  timeutils: match today day and this year correctly
2019-01-14 12:04:04 +01:00
Karel Zak 5ae171e1f9 Merge branch 'asan-fixes' of https://github.com/kerolasa/util-linux 2019-01-14 11:58:06 +01:00
Sami Kerola cae9283ab1
readprofile: check input file is not empty [asan]
Addresses: https://github.com/karelzak/util-linux/issues/717
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-13 20:00:45 +00:00
Sami Kerola b22332dd4f
last: fix wtmp user name buffer overflow [asan]
Ensure utmp user name field is null terminated.  Without that getpwnam() can
buffer overflow, when wtmp file is malformed.

Addresses: https://github.com/karelzak/util-linux/issues/715
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-13 20:00:38 +00:00
Sami Kerola 3ebfc8d370
bash-completion: umount support relative path and ~ as home shorthands
Addresses: https://github.com/karelzak/util-linux/issues/703
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-12 19:29:37 +00:00
Sami Kerola ad7ac3d598
fsck.cramfs: use utimes() instead of utime() that is obsolete
Reference: http://man7.org/linux/man-pages/man3/utime.3p.html#APPLICATION_USAGE
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-12 08:46:54 +00:00
Sami Kerola f78a902174
hwclock: use monotonic time to measure how long setting time takes
Earlier gettimeofday() was affected by discontinuous jumps.  Measuring how
long time it takes to set time using function that effected by the very
thing being measured makes head spin.  Lets make this less confusing with
monotonic clock that ticks on without jumps.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-12 08:46:54 +00:00
Sami Kerola ee6e39305c
include: add indirect monotonic clock id specifier
Avoid repeated ifdef checks in code by adding a project specific
preprocessor definition.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-12 08:46:53 +00:00
Sami Kerola d393c00c6c
timeutils: match today day and this year correctly
Assumption all years since 1970 have been exactly 365 days long has it's
problems when leap years happen.  Lets use struct tm fields that are
provided by localtime_r(), making year and day to be correctly compared even
when it's late new years eve somewhere else than UTC-0.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-12 08:46:29 +00:00
Karel Zak 1a83c00d88 login: add support for login.defs(5) LASTLOG_UID_MAX
This new variable allows to keep lastlog file small and filter out
things like huge nfsnobody UIDs.

The variable is also supported by shadow-utils (adduser, etc.).

Addresses: https://github.com/shadow-maint/shadow/pull/142/
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-11 12:16:00 +01:00
Karel Zak 623427456e login-utils/logindefs: clenaup API
The default value should be unsigned if the result is also unsigned...

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-11 12:15:22 +01:00
Karel Zak fe7d63105d fstrim: check for read-only devices on -a/-A
to avoid "FITRIM ioctl failed: Remote I/O error"

Addresses: https://github.com/karelzak/util-linux/issues/738
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-11 10:44:14 +01:00
Stanislav Brabec 86f42e5a2a su-common.c: prefer ENV_SUPATH over ENV_ROOTPATH
ENV_SUPATH and ENV_ROOTPATH are equivalent and ENV_ROOTPATH takes
precedence in both login and su. It makes no sense. More logical would be
precedence of ENV_SUPATH in su and ENV_ROOTPATH in login.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2019-01-10 12:26:38 +01:00
Stanislav Brabec 15a191f6d3 su-common.c: prefer /etc/default/su over login.defs
su(1) documentation says:
       /etc/default/su  command specific logindef config file
       /etc/login.defs  global logindef config file

It indirectly indicates that /etc/default/su should take precedence
over /etc/login.defs.

But the reverse is true. It is not possible to define ENV_PATH in
/etc/login.defs and then make su specific customization in
/etc/default/su. We need to change read order to match the documented
behavior.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2019-01-10 12:26:38 +01:00
Karel Zak e6effcac61 fdisk: make partition types uses more robust
* report failed partition type parsing
* make sure partition types code (from user reply) for MBR is hex

Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-10 12:17:19 +01:00
Karel Zak 19e4cfef52 fdisk: support CTRL+C on change-partition-type dialog
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-10 11:26:05 +01:00
Carlos Santos 7a40136c2f utmpdump: fix word swapping in manual page
From
    The only binary version of the utmp(5) is standardised.
To
    Only the binary version of the utmp(5) is standardised.

Change-Id: I0033f6cf055d569c7dfca5e05e918f735ea72582
Signed-off-by: Carlos Santos <casantos@datacom.com.br>
2019-01-08 14:51:13 +01:00
Karel Zak 969e8cbeb1 libblkid: improve whole-disk detection when read /proc/partitions
blkid(8) in high-level mode checks partitions and unpartitioned
whole-disk devices from the file /proc/partitions.

The current heuristic assumes that partition name ends with a digit.
Unfortunately, this is not correct -- for example md0 or nvme0n1 are
whole-disk devices.

This commit uses sysfs_devno_is_wholedisk() to make sure the device is
a partition (according to kernel or DM). It's probably more expensive,
because this way requires more syscalls (to read stuff from /sys etc.).

The patch also adds more information to the blkid(8) man page.

Addresses: https://github.com/karelzak/util-linux/issues/728
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-08 12:07:18 +01:00
Khem Raj 963413a1ad ldattach: Check for value of _HAVE_STRUCT_TERMIOS_C_ISPEED
in glibc 2.29+ checking for just existence of _HAVE_STRUCT_TERMIOS_C_ISPEED
won't be enough, the value has to be checked

see
https://sourceware.org/git/?p=glibc.git;a=commit;h=e5a50db36eaa6e8c6427b3a971563240b633ca85

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-01-04 22:38:25 -08:00
Karel Zak 9b13b5602e libblkid: (ntfs) fix compiler warning [-Wpedantic]
libblkid/src/superblocks/ntfs.c:80:2: warning: ISO C restricts enumerator
values to range of 'int' (4294967295 is too large) [-Wpedantic]

Addressed: https://github.com/karelzak/util-linux/pull/732
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-02 14:47:25 +01:00
Sami Kerola 523de2ec6f chmem: add initilizer [clang]
warning: use of GNU empty initializer extension [-Wgnu-empty-initializer]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-02 14:40:40 +01:00
Sami Kerola 5837f08a50 libsmartcols: remove extra ';' outside of a function [-Wextra-semi]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-02 14:40:30 +01:00
Karel Zak 2d6cad08cf Merge branch 'master' of https://github.com/kvanals/util-linux
* 'master' of https://github.com/kvanals/util-linux:
  Removed BlueStore VERSION information as it is gibberish
  Updated BlueStore expected result
  Added BlueStore test image
2019-01-02 14:20:21 +01:00
Kenneth Van Alstyne 36b0530e12 Removed BlueStore VERSION information as it is gibberish 2018-12-17 20:21:32 -06:00
John W Higgins 24fa736d91
Remove duplicate entry for reset-env from usage
I assume the second entry was not desired in the original commit. Line 153-154 would appear to be a duplicate
2018-12-17 17:11:44 -08:00
Kenneth Van Alstyne c011711ad6 Updated BlueStore expected result 2018-12-17 12:07:14 -06:00
Kenneth Van Alstyne 6032c9f1f8 Added BlueStore test image 2018-12-17 11:05:24 -06:00
Karel Zak 200769b6c0 libblkid: (bluestore) terminate magic strings array
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-17 11:05:23 +01:00
Karel Zak be2762b862 Merge branch 'master' of https://github.com/kvanals/util-linux
* 'master' of https://github.com/kvanals/util-linux:
  Finished up BlueStore support
  Added support for detecting Ceph BlueStore Block Devices
2018-12-17 10:45:33 +01:00
Jean-Philippe ROMAIN 144f12959c dmesg: correct "-n, --console-level level" example in manual page
When providing an abbreviation of the level name with the option "-n, --console-level level",
it corresponds to the level (included) up to which messages are displayed on the console.
If a level number is given, this level is excluded.

So in the given example, "-n 1" is equivalent to "-n emerg".

Signed-off-by: Jean-Philippe Romain <jean-philippe.romain@st.com>
2018-12-17 10:16:26 +01:00
Sami Kerola be042335b8 docs: add link to mail list archive
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-12-17 10:16:22 +01:00
Tony Asleson ae62a1751f libblkid: stratis: correct byte order
Stratis superblock is little endian, ensure we retrieve the
number of sectors and initialization time correctly.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2018-12-17 10:16:11 +01:00
Kenneth Van Alstyne 4125497278 Finished up BlueStore support 2018-12-14 14:32:13 -06:00
Kenneth Van Alstyne bd301d459f Added support for detecting Ceph BlueStore Block Devices 2018-12-14 14:27:10 -06:00
Karel Zak 6bf071afa2 Merge branch 'aarch32_on_aarch64' of https://github.com/jlinton/util-linux
* 'aarch32_on_aarch64' of https://github.com/jlinton/util-linux:
  lscpu: Add aarch32 detection on aarch64
2018-12-12 14:25:22 +01:00
Karel Zak 4d09682b3c mkswap: use dd(1) in example rather than fallocate(1)
The man page warns against fallocate on some filesystems and recommends
dd(1) as the most portable solution. So, let's use dd(1) also in the
example used in the same man page.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1203378
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-12 12:14:39 +01:00
Jeremy Linton 32865bd5df lscpu: Add aarch32 detection on aarch64
aarch32 support is an optional feature of ARMv8, as CPUs
which don't support aarch32 become more common, lets make
sure that lscpu can tell a user quickly if they are on a
machine that only supports 64-bit.

Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
2018-12-11 12:27:29 -06:00