Commit Graph

13205 Commits

Author SHA1 Message Date
Karel Zak 07b94c9f32 lib/strutils: support two decimal places in size_to_human_string() output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-12 14:20:55 +01:00
Karel Zak 3b9dc305ee tests: (hardlink) update noregex
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 14:53:51 +01:00
Karel Zak 985421192d hardlink: add long options
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 14:01:55 +01:00
Karel Zak c8ca29beb2 hardlink: rename function
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:30:46 +01:00
Karel Zak bd7722af02 hardlink: make code more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:25:04 +01:00
Karel Zak 0b05aab402 hardlink: cleanup global variables
* remove NAMELEN, use PATH_MAX
* mark global variables as static
* move all global variables to the begin of the code

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:18:35 +01:00
Karel Zak 3807e71af4 hardlink: remove typedefs
- remove typedefs
- use long names for structs

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:00:18 +01:00
Karel Zak 5c8f6fce22 tests: (hardlink) update summary output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 10:37:42 +01:00
Sven Wiltink c2f6513c10 lsblk: use ID_SCSI_SERIAL when available
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 10:37:27 +01:00
Karel Zak d55db6724c hardlink: cleanup error messages, use xalloc.h
- do not use magical doexit(), just use err()
- print summary on exit

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-06 17:23:54 +01:00
Karel Zak c545e62c68 hardlink: cleanup verbose and warning messages
- use warn()
- use stdout rather than stderr

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-06 17:14:01 +01:00
Karel Zak bd9a35c6ce hardlink: (man) add AVAILABILITY
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-06 14:37:34 +01:00
Karel Zak 117f4d8bf4 Merge branch 'hardlink' of https://github.com/rudimeier/util-linux into hardlink
* 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits)
  hardlink: add first simple tests
  hardlink: util-linux usage
  hardlink: fix compiler warnings
  hardlink: style indentations and license header
  hardlink: enable build with and without pcre2
  fixes for the fixes
  temporal fix before re-patch (updates from Fedora repo)
  Update hardlink.1
  Fixed version number, added changelog about Todd Lewis' patch
  exclude files via pcre
  Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989)
  spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file
  Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file"
  spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file
  Mention -f option in the man page
  do not allow to hardlink files across filesystems by default (#786719) (use -f option to override)
  fix possible buffer overflows, integer overflows, update man page
  fix URL and remove mmap() (#676962, #672917)
  - update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816
  mostly spec cleanup
  ...
2019-02-06 13:55:20 +01:00
Stanislav Brabec 8487dbee9f mount: Do not call mnt_pretty_path() on net file systems.
Calling mnt_pretty_path() on network file systems can cause mangling of
the output:
root# mount | grep nfs
nfs.example.com:/home on /home type nfs4 ...
root# mkdir -p nfs.example.com:/home
root# mount | grep nfs
/root/nfs.example.com:/home on /home type nfs4 ...

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2019-02-06 11:56:47 +01:00
Karel Zak cc06250f11 col: improve error message, update regression test
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-05 18:07:26 +01:00
Karel Zak 9113d6c1e6 docs: add col(1) to TODO
Addresses: https://github.com/karelzak/util-linux/issues/749
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-05 12:13:46 +01:00
Karel Zak 004356f050 col: make flush_line() a little bit robust
The code is horrible. The core of the problem are signed integers
and no check for the limits.

This patch fixes c->c_column = cur_col; where c_column is "short"
and "cur_col" is int. Let's use "int" for all the variables. It's
really not perfect as for bigger lines it can segfault again...

The patch also removes some unnecessary static variables.

Addresses: https://github.com/karelzak/util-linux/issues/749
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-05 12:06:00 +01:00
Karel Zak f571d10d4a Merge branch 'patch-1' of https://github.com/edupont/util-linux
* 'patch-1' of https://github.com/edupont/util-linux:
  Typo in configuration help
2019-02-05 11:09:02 +01:00
Karel Zak 3a2bcd7dd2 Merge branch 'mount-nosuid' of https://github.com/Lekensteyn/util-linux
* 'mount-nosuid' of https://github.com/Lekensteyn/util-linux:
  mount.8: clarify (no)suid behavior on file capabilities
2019-02-05 11:07:32 +01:00
Icenowy Zheng 5d3a4aab64 libfdisk: (gpt) add HiFive Unleashed bootloader partition UUIDs
The HiFive Unleashed SBC's bootloader seeks for GPT partitions with
specific UUID for loading the next stage bootloader (ZSBL loads FSBL,
and FSBL loads BBL).

Add these partition type UUIDs.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
2019-02-04 15:06:19 +01:00
Karel Zak f90d8b8bcc cal: use standout mode on monochrome terminals
The function colors_init() checks for colors, it means it fails
on monochrome terminals, but cal(1) in this case still need to
highlight the current day.

Reported-by: Nuno Silva <nunojsilva@ist.utl.pt>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-04 14:20:03 +01:00
Karel Zak 5db5962339 lib/colors: force to "never" mode on non-terminal output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-04 14:14:37 +01:00
edupont 41f58b6030
Typo in configuration help 2019-02-01 22:57:34 +01:00
Peter Wu 9de7fe4a3d mount.8: clarify (no)suid behavior on file capabilities
Clarify that the nosuid option also affects file capabilities and that
it only limits execution of programs. (setgid on directories still
inherit the group regardless of the nosuid option.) The new text is
taken from the mount(2) manual page from the man-pages project.

Addresses: https://github.com/karelzak/util-linux/issues/482
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2019-02-01 15:44:20 +01:00
Karel Zak 167a2b520a sfdisk: fix logical partition resize when start specified
Addresses: https://github.com/karelzak/util-linux/issues/745
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-31 14:16:42 +01:00
Karel Zak 8fd512e932 logger: (man) add info about rewrite and authors
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-29 15:59:41 +01:00
Karel Zak bd0029f6be logger: (man) make more obvious that --server/socket is required
The options --tcp/udp specify only how, but no where.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-29 15:44:13 +01:00
Johannes Nixdorf 70c364b4db build-sys: fix crypt() detection without -lcrypt
The check tested whether code using crypt() links without -lcrypt, but
didn't set have_crypt to yes if it succeeded.

This fixes the check erroneously failing when compiling against musl
libc.

Signed-off-by: Johannes Nixdorf <mixi@shadowice.org>
2019-01-23 12:20:47 +01:00
Karel Zak 1c4a2600cc logger: concatenate multiple lines of MESSAGE into a single field.
this is deemed a useful special case since journalctl will only show
either the first or last element of the message array if the field
appears multiple times.

Based on patch from: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
https://github.com/karelzak/util-linux/pull/743

Addresses: https://github.com/karelzak/util-linux/issues/742
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-23 11:41:43 +01:00
Karel Zak c2435b946f libblkid: remove dependence on libuuid
Currently we use libuuid to print UUID only. This code is possible to replace
by one snprintf(). It seems better to duplicate this one snprintf than force
all distros to keep libuuid together with libblkid.

Note, this scenario has been already supported on --disable-libuuid.

Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 12:33:19 +01:00
Andreas Schwab 33e87bf152 setarch: don't return address of automatic variable
On architectures without special personalities setarch uses the contents
of a local variable with automatic storage duration after return from
the function, causing it to report a spurious error.

$ setarch m68k
setarch: Kernel cannot set architecture to m68k

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
2019-01-22 12:02:16 +01:00
Jeffrey Ferreira 014e7eb321 losetup: update an error message
Update an error message to add --partscan to the list of options
only allowed during loop device setup.

Signed-off-by: Jeffrey Ferreira <jeffpferreira@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 11:56:16 +01:00
Karel Zak 422f0e9f20 losetup: properly use --sector-size when create a new device
The --partscan functionality depends on sector size. Make sure
sector size is set before we force kernel to scan the device for
partitions. For example:

 losetup -f loopfile --sector-size 4KiB --partscan --show

where 'loopfile' contains GPT with 4096 sectors.

Reported-by: Jeffrey Ferreira <jeffpferreira@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 11:50:20 +01:00
Karel Zak 75d239ffd8 lib/loopdev: set blocksize when create a new device
The partition scanner in kernel depends on blocksize. We need to set
the blocksize before we call LOOP_SET_STATUS64 (this ioctl triggers
the scanner).

This patch extends the internal API to save blocksize into loopdev
context to be usable later for loopcxt_setup_device().

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 11:37:35 +01:00
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