Commit Graph

9447 Commits

Author SHA1 Message Date
Karel Zak 628a4efa27 docs: fix TODO typos
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-28 14:04:15 +02:00
Karel Zak f7fdd3da3f docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-28 14:00:28 +02:00
Karel Zak 658c089190 fsck: print errors on invalid -r argument
The patch also add support for -r 0.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-28 13:43:14 +02:00
Stanislav Brabec 07c09a29ea fsck: implement fsck -r {fd}
Make possible sending of statistics to a dedicated file descriptor.

Rationale: When UI is calling fsck from a remote terminal, fsck progress
needs to be sent to stdout. It is mixed there with output of statistics,
and it is impossible to parse the output to get the statistics.

Now it will be possible e. g. with "fsck -C -r 3 /dev/sda1"

Note: Code in if and else is intentionally partially duplicated. Current
human readable output of floats does not conform to locale conventions,
and may be changed in future. But we want to keep machine readable output
exactly same as it is now.

[kzak@redhat.com: - don't use report_stats_fd globally]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-28 13:16:41 +02:00
Benno Schulenberg dffd1f3f57 hwclock: fix spelling, punctuation and formatting mistakes in the man page
Also improve some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-04-28 12:40:41 +02:00
Karel Zak a6e5a415bd hwclock: clean up man page header
We already use .TQ in another man pages for years and nobody
complains, so I guess the fallback is unnecessary.

The patch also minimize in-header change-log. We have git for this
purpose.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-28 12:27:18 +02:00
Benno Schulenberg 0f9a4b029f hwclock: remove an untrue phrase from the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-04-28 12:19:07 +02:00
Karel Zak a03bdbcd20 fsck: use PATH or fallback to /sbin
It's overkill to support all the obscure paths like /sbin/fs.d. We
have PATH for customization, that's enough.

It still seems like a good idea to keep fsck robust, because it's used
by boot scripts/systemd. For this reason fsck fallbacks to "/sbin" if
PATH is undefined or empty.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-27 10:52:09 +02:00
Mike Frysinger f1bc59963f swapon: search for mkswap via PATH
Rather than hardcode /sbin/mkswap all the time, use a normal PATH search.
This matches the normal behavior of other tools, and makes local testing
easier.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-04-27 10:28:44 +02:00
Mike Frysinger 07b5156790 mkfs: drop hardcoded search path
Rather than maintain a hardcoded search path for looking up tools and
override the user's PATH env setting, respect whatever the user has.
This matches the convention of just about every other tool out there.

It might break on systems that don't have /sbin in their PATH and they
try to run /sbin/mkfs directly, but so be it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-04-27 10:28:44 +02:00
Alexey Galakhov ff22953890 hwclock: flush stdout in hwclock -c
This allows using hwclock -c in automated test scripts that parse
its output line-by-line. The standard output is flushed before
each 10 second delay.

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
2015-04-27 10:26:18 +02:00
J William Piggott 165ae38f0d hwclock: Remove TZUTC
commit d53f8ecfbf
introduced the TZUTC environment variable to
facilitate use of the zoneinfo 'right' database.
This was incorrect. Either the TZDIR environment
variable should be used or a system-wide
configuration for the 'right' database should be
used.

See hwclock(8) POSIX vs 'RIGHT' for more details.

TZUTC was undocumented and should be safe to remove.

The commit also caused a regression when using
musl libc, because when TZUTC is unset getenv()
returns a NULL pointer.
Reported-by: Isaac Dunham <ibid.ag@gmail.com>

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-04-27 10:00:15 +02:00
Karel Zak 28f47fd2e0 test_uuidd: add comment
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 17:09:17 +02:00
Karel Zak a539def589 test_uuidd: add pid, tid and idx back to object
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 15:53:28 +02:00
Karel Zak 032776e8b0 test_uuidd: make objdump more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 15:01:23 +02:00
Karel Zak adbc73eb61 test_uuidd: fix include
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 14:54:09 +02:00
Karel Zak cfa4171a14 test_uuidd: don't exit on failed pthread_create()
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 14:47:49 +02:00
Karel Zak 4d5241584f test_uuidd: don't exit on failed pthread_create()
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 14:47:09 +02:00
Karel Zak 1d27cd1193 test_uuidd: improve readability
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 14:25:30 +02:00
Karel Zak 179306122c test_uuidd: cleanup counters names
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 13:39:17 +02:00
Karel Zak 7eeb7e1d56 test_uuidd: cleanup pid usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 13:35:54 +02:00
Karel Zak f4be1406a3 test_uuidd: cleanup used types
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 13:28:12 +02:00
Karel Zak 0f2b00ce0a test_uuidd: err messages, argv[] parsing and another cleanups
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 12:40:51 +02:00
Huschaam Hussain 963f128cfa tests: add uuidd test program
References: https://bugzilla.redhat.com/show_bug.cgi?id=678306
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-24 11:30:49 +02:00
Karel Zak e2381bdac8 tests: fix sfdisk GPT test
The test uses too large last partition, libfdisk checks this problem
now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-23 15:08:26 +02:00
Karel Zak 9d9a1b8760 libfdisk: (gpt) add extra check for First/Last LBA
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-23 12:32:36 +02:00
Karel Zak fb966a7e1f tests: add sfdisk resize tests for GPT
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-23 11:37:00 +02:00
Karel Zak 7678505292 libfdisk: (gpt) fix end sector calculation on resize
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-23 11:34:05 +02:00
Karel Zak 9b4ffb4565 tests: add sfdisk resize regression tests for MBR
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 17:31:40 +02:00
Karel Zak a7c27ff297 libfdisk: fix scriptk parser to support alone signs
for example echo "- - - *" | sfdisk /dev/sda1 -N1

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 17:14:28 +02:00
Karel Zak 339ca8416c libfdisk: allow to move start to first usable LBA
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 17:13:48 +02:00
Karel Zak 8cf10fd08d libfdisk: add warning to resize function
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 12:21:19 +02:00
Karel Zak 98e15beb61 libfdisk: support resize operation in fdisk_set_partition()
Note that the resize is not exported by API yet, the only way to use
it is sfdisk-like scripts.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 12:21:19 +02:00
Karel Zak b17c1f1447 libfdisk: add fdisk_table_get_partition_by_partno()
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 12:21:19 +02:00
Karel Zak 6f16392937 libfdisk: fix script parser to support resize operations
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 12:21:19 +02:00
Karel Zak ee105ed6f3 libfdisk: don't resize in label drivers
The resize operation has to be implemented on upper layer.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 12:21:19 +02:00
Karel Zak 43a2b09426 libfdisk: (gpt) fix LE usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 11:52:24 +02:00
Karel Zak 40b175084f lib/strutils: fix string_add_to_idarray() int vs. size_t
The function uses "int" as argument, but for array size (and index) is better
to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk)
and "int" in lib/strutils.c then result is unexpected behavior on
ppc64.

	# sfdisk --list -o DEVICE,START,SIZE /dev/sdb
	Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors
	Units: sectors of 1 * 512 = 512 bytes
	Sector size (logical/physical): 512 bytes / 4096 bytes
	I/O size (minimum/optimal): 4096 bytes / 32768 bytes
	Disklabel type: gpt
	Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539
	lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed.

The patch cleanup all code to use size_t everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 11:08:05 +02:00
Karel Zak 622be27845 fdisk, sfdisk: fix -o <list> backend
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 10:20:31 +02:00
Karel Zak 6f13d7a1b2 Merge branch 'tests-refactor-loop-cleanup' of https://github.com/rudimeier/util-linux
* 'tests-refactor-loop-cleanup' of https://github.com/rudimeier/util-linux:
  tests: never use -o pipefail
  tests: loop tests, don't call ts_die() with DEVICE parameter
  tests: scsi_debug tests, don't call ts_die() with DEVICE parameter
  tests: introduce TS_LOOP_DEVS for cleanup
  tests: introduce ts_cleanup_on_exit()
2015-04-22 10:03:12 +02:00
Karel Zak 66f0c7bb67 Merge branch 'test-fix' of https://github.com/rudimeier/util-linux 2015-04-22 09:56:47 +02:00
Ruediger Meier aac448a80b tests: config.h lives in build directory
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-04-22 09:01:18 +02:00
J William Piggott 9fb890c3c5 hwclock: remove dead code
Removes never used #ifdef dead code.

Reported-by: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-04-21 16:46:23 -04:00
J William Piggott efc4eaf422 hwclock: regression fix
Commit ab8f402952 regression
where synchronize_to_clock_tick_rtc() only returns the correct
value for a select() time out if using debug mode. This caused
hwclock to have invalid output when select() timed out in
normal mode.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-04-21 16:43:41 -04:00
Ruediger Meier fffe5f7c72 tests: never use -o pipefail
It was hard to find out that pipefail was the reason why our
test-suite could have random failures for aribtrary tests,
for example the ones which are using ts_device_has_uuid() or
ts_mount().

Bash's pipefall option is evil! It may return error for such a
simple line like this one
$ echo -e "xxx\nyyy" | grep -q "xxx"
because the left echo command will get SIGPIPE when grep exits after
the first match. So the command line above could return an error
eventhough it does exactly what we want.

This patch removes any pipefail from our tests. The funny thing is
that I couldn't find any case where we relied on this feature anyway.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-04-21 14:58:30 +02:00
Karel Zak a53e37f9d4 sfdisk: don't use BLKRRPART to check loopdev usage
It seesm that kernel always returns EINVAL for BLKRRPART on loop
devices, we call the ioctl to check if nobody else uses the device.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-17 10:32:48 +02:00
Karel Zak 2daf61b734 tests: add old dump for sfdisk
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-16 18:01:32 +02:00
Karel Zak 2928068a3c sfdisk: accept empty partitions from dump
Old sfdisk uses:
  dev/sdc2 : start=        0, size=        0, Id= 0

for undefined MBR partitions. Let's follow this behaviour.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-16 17:51:18 +02:00
Ruediger Meier 1d2dfb9c30 tests: fix logger device pathname too long
$TS_OUTDIR may be too long for sockaddr_un.sun_path. Noticed on travis
in distcheck.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-04-14 15:00:52 +02:00
Ruediger Meier f1849be96a tests: loop tests, don't call ts_die() with DEVICE parameter
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-04-14 13:18:43 +02:00