Commit Graph

11649 Commits

Author SHA1 Message Date
Karel Zak 258e74626d Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd images with blocksize 1024 and 4096 created by Linux mkudffs 1.3
  libblkid: udf: Fix detection of UDF images with block size 1024 and 4096
2017-06-21 11:54:51 +02:00
Karel Zak 4a679468ca travis: use --disable-makeinstall-chown everywhere
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-21 11:51:39 +02:00
Karel Zak 9e258f388a docs: add program-desc to howto-usage-function.txt and boilerplate.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-21 11:25:55 +02:00
Karel Zak 3d27fdba59 hwclock: remove unwanted space before description
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-21 11:25:16 +02:00
Karel Zak 8ad750bc3c Merge branch '170427' of github.com:jwpi/util-linux
* '170427' of github.com:jwpi/util-linux:
  hwclock: remove unused stdarg.h
  Docs: update howto-usage-function.txt
  hwclock: add --update-drift check
  hwclock: slice up the usage text
  hwclock: update --help content and grammar
  hwclock: use RTC in help output
  include: update pathnames.h
  hwclock: add usage() functions heading
  hwclock: update usage() FILE name
  hwclock: update usage() to util-linux style
  hwclock: remove dead code in usage()
2017-06-21 11:16:23 +02:00
Karel Zak a65041b5ae build-sys: make chown usage more robust
* add --disable-makeinstall-chown to travis non-root mode

* use "if MAKEINSTALL_DO_SETUID" for chown root:root

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-21 11:12:04 +02:00
Karel Zak 6f1507f135 wipefs: exit on failed erase
The current behavior is to report error and continue, it seems strange:

	# blockdev --setro /dev/sdc

	# wipefs -a /dev/sdc
	wipefs: /dev/sdc: failed to erase xfs magic string at offset 0x00000000: Operation not permitted
	/dev/sdc: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
                          ^^^^^^^^^^^
                           not true

The patch calls err() to exit.

Reported-by: Vratislav Podzimek <vpodzime@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-21 10:53:28 +02:00
J William Piggott ba2cdc0c66 hwclock: remove unused stdarg.h
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:56:39 -04:00
J William Piggott 2671bcd654 Docs: update howto-usage-function.txt
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:56:39 -04:00
J William Piggott 891b43432f hwclock: add --update-drift check
Only allow --update-drift for --set or --systohc

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:56:39 -04:00
J William Piggott d4affe81bb hwclock: slice up the usage text
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:56:39 -04:00
J William Piggott cc7cb070d9 hwclock: update --help content and grammar
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:55:08 -04:00
J William Piggott 36b2645405 hwclock: use RTC in help output
Switching between 'hardware clock' and 'RTC' is ambiguous.
RTC is used due to space constraints, so use it consistently.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:51:27 -04:00
J William Piggott 8493eedd15 include: update pathnames.h
* use /dev/rtc0 (/dev/rtc was for the 'old' driver)
* remove hwclock Award workaround and alpha cmos paths
* relocate _PATH_BTMP from hwclock to login-utils
* add a comment for _PATH_BTMP and fix other login-utils comments
* add a comment for proc/cpuinfo
* remove empty shutdown.c comment from 4d43977f

Review changes
* remove 'used in' comments
* white space fixes

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:51:26 -04:00
J William Piggott 513bfbefa2 hwclock: add usage() functions heading
Make a functions heading, similar to the existing options heading.

* include/c.h: define USAGE_FUNCTIONS
* Documentation/boilerplate.c: add USAGE_FUNCTIONS
* sys-utils/hwclock.c add functions header to usage()

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:50:38 -04:00
J William Piggott 7d9a866d1b hwclock: update usage() FILE name
Use the util-linux standard file name instead of 'usageto'.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:15:05 -04:00
J William Piggott 064f776c37 hwclock: update usage() to util-linux style
Update usage() according to:
  Documentation/howto-usage-function.txt
  Documentation/boilerplate.c

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:15:05 -04:00
J William Piggott ea298febb8 hwclock: remove dead code in usage()
Commit 677ec86 caused usage() to be called only by --help.

So remove the now dead code from usage().

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-20 19:15:04 -04:00
Karel Zak 8c1979948c build-sys: chown before chmod for SUIDs
Make sure SUIDs are really owned by root.

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-20 13:12:43 +02:00
Karel Zak 9b76b0e98b libmount: ignore "bind" from fstab on command line "remount"
The current code always apply all flags from /etc/fstab on remount.
Unfortunately remount+bind has special semantic and it's impossible
from command line to avoid interaction with the "bind" from fstab.

Example, fstab:

	/dev/sda1 /bar ext4 defaults 0 1
	/bar /foo none bind 0 0

Command line:

    # mount /foo -o remount,rw

produces:

    mount(... MS_REMOUNT|MS_BIND ) syscall

This changes the per-mountpoint (VFS) ro flag to rw, but doesn't
change the filesystem itself.

This patch forces libmount to ignore "bind" from fstab when "-o
remount" specified on command line. If you need remount+bind semantic
you have to specify the "bind" flag on command line. This allow to
differentiate between

    # mount /foo -o remount,bind,rw  --> mount(MS_REMOUNT|MS_BIND)
and

    # mount /foo -o remount,rw       --> mount(MS_REMOUNT)

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-20 12:46:02 +02:00
Vinnie Magro 22eb2f0190 dmesg: fragment concatenation
When extended console is enabled, the kernel doesn't internally
concatenate message fragments, this change adds log fragment
concatenation to dmesg: instead of being printed as separate messages,
fragments are combined onto one line and printed with the timestamp of
the first line.

This doesn't work in all cases - such as if another message is logged in
between two fragment lines, but in this case the behavior matches the
previous output format (printed on the separate lines).

[kzak@redhat.com: - rename kmsg_read_buf to kmsg_saved_size,
                  - minor coding style fixes]

Signed-off-by: Vinnie Magro <vmagro@fb.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-20 11:26:23 +02:00
Karel Zak eba71dd06c Merge branch '170424' of github.com:jwpi/util-linux
* '170424' of github.com:jwpi/util-linux:
  parse-date: time_zone_hhmm() bug fixes
  parse-date: remove unused ordinal_day_seen
  parse-date: remove unused year_seen
  parse-date: refactor tm_diff()
  parse-date: use to_uchar() instead of assignment.
  parse-date: use uintmax_t where appropriate
  parse-date: use int where appropriate
  parse-date: use intmax_t where appropriate
  parse-date: remove unused EPOCH_YEAR
  parse-date: replace ISDIGIT with c_isdigit
2017-06-20 10:20:49 +02:00
Karel Zak e0bb63d84c tests: add MBR resize tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 16:25:46 +02:00
Karel Zak c134c8b101 libfdisk: support logical partition resize
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 16:03:41 +02:00
Karel Zak 5ec4400dec libfdisk: allow to resize container
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 15:32:02 +02:00
Karel Zak 22f4c4641a libfdisk: add more debug messages to get-last-possible resize space
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 15:27:05 +02:00
Karel Zak 53625d1ae9 libfdisk: (dos) be more verbose on partno -ERANGE error
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 14:32:59 +02:00
Karel Zak 417234cb93 mount: fix man page typo (--bind,ro)
Addresses: https://github.com/karelzak/util-linux/issues/464
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 11:49:51 +02:00
Karel Zak ee9ba4fa5e libfdisk: (dos) fix primary/logical logic when follow template
This stupid bug has been introduced by e1cfb304 (v2.30) and it
disables to create extended partition by cfdisk :-(

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-19 11:41:02 +02:00
Karel Zak 998ae28704 Merge branch 'some-fixes' of https://github.com/rudimeier/util-linux
* 'some-fixes' of https://github.com/rudimeier/util-linux:
  travis: minor cosmetics
  lib: style cosmetics plymouth-ctrl.c
  libmount: fix warning "set but not used"
  more: remove unused variable
  tests: split partx in root and non-root
  tests: fix and refactor partx
2017-06-16 10:50:24 +02:00
J William Piggott 480d6bd80a parse-date: time_zone_hhmm() bug fixes
* fix incorrect arg type used for abs().
* prevent integer arithmetic overflow by limiting offset to 4 digits.
* don't accept malformed offset values like:
    -4:3
    +12:719
    +0000001:23
    -9:00000001
    +0000001123

Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:03:04 -04:00
J William Piggott dc65dd64ae parse-date: remove unused ordinal_day_seen
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:03:04 -04:00
J William Piggott cf4b385c35 parse-date: remove unused year_seen
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:03:04 -04:00
J William Piggott 1d6702edfd parse-date: refactor tm_diff()
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:02:58 -04:00
J William Piggott bfbace763c parse-date: use to_uchar() instead of assignment.
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:02:49 -04:00
J William Piggott 07668cd1fa parse-date: use uintmax_t where appropriate
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:02:41 -04:00
J William Piggott 75f8be9eb6 parse-date: use int where appropriate
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:02:32 -04:00
J William Piggott 960f98c97a parse-date: use intmax_t where appropriate
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:02:21 -04:00
J William Piggott 36a5afd8e8 parse-date: remove unused EPOCH_YEAR
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:02:07 -04:00
J William Piggott 6fc1d48d3d parse-date: replace ISDIGIT with c_isdigit
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-15 15:00:33 -04:00
Karel Zak c0b0748544 fstrim: remove obsolete comment
We do not de-duplicate by FS root (since afa382f2e0).

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-15 11:49:09 +02:00
Alex Ivanov 155d48f590 fstrim: prefer earlier mounted filesystems
fstrim --all is broken in a way that if there is a bind mount for some filesystem,
that filesystem will not be trimmed. This is especially critical for e.g.
NixOS distribution, which needs bind mount within root fs:
https://github.com/NixOS/nixos/blob/master/modules/system/boot/stage-2-init.sh#L55

Currently for a given filesystem during "de-duplication by source and root" phase,
an early mounted fs path is filtered (e.g. "/"), while later mounted fs path is kept
(e.g. "/nix/store") though anyway discarded later (since it's an overlaying mount).
This leads to skipped trimming.

So flip this behaviour. Should also help for other types of overlaying mounts.

Reference:
https://github.com/karelzak/util-linux/blob/stable/v2.29/libmount/src/tab.c#L715

Signed-off-by: Alex Ivanov <yourbestfriend@openmailbox.org>
2017-06-15 11:45:35 +02:00
Ruediger Meier cf76bbae48 travis: minor cosmetics
This is just to make the diff to my private travis script a bit smaller.

Now we always use $CC _after_ the install script which makes it possible
to install/update the compiler in the install section.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 09:13:14 +02:00
Ruediger Meier db981e3e0d lib: style cosmetics plymouth-ctrl.c
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 09:13:04 +02:00
Ruediger Meier 0b5f75e412 libmount: fix warning "set but not used"
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 08:56:01 +02:00
Ruediger Meier d0c5e5c241 more: remove unused variable
slow_tty is at least unused since util-linux 2.2.

FYI here is another derived more.c where slow_tty is still used:
https://github.com/sergev/LiteBSD/blob/master/old/more/more.c

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 08:55:40 +02:00
Ruediger Meier fd3c280594 tests: split partx in root and non-root
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 08:47:09 +02:00
Ruediger Meier 3a951379a7 tests: fix and refactor partx
Subtest delete-non-existent was broken because since 2d47fa39
option --nr was missing. It wasn't noticed because we did not
check stderr. Now we check all return values and output.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 08:46:46 +02:00
Pali Rohár dd3856ffec tests: Add UDF hdd images with blocksize 1024 and 4096 created by Linux mkudffs 1.3
$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-4.img bs=1M count=10
$ mkudffs -l Label -b 1024 udf-hdd-mkudffs-1.3-4.img

$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-5.img bs=1M count=10
$ mkudffs -l Label -b 4096 udf-hdd-mkudffs-1.3-5.img
2017-06-14 23:29:03 +02:00
Pali Rohár 501aeb60a4 libblkid: udf: Fix detection of UDF images with block size 1024 and 4096
When detecting block size of UDF filesystem, try to use also block size
512, 1024, 2048 and 4096. This would allow blkid to detect UDF filesystem
in image file created from 4K hard disk (which should have UDF block size
4096).

Before this patch only UDF images with block size of 512 and 2048 were
detected as only block size from blkid_probe_get_sectorsize() and 2048 were
used (blkid_probe_get_sectorsize() returns for disk images 512).
2017-06-14 23:15:14 +02:00