Commit Graph

9469 Commits

Author SHA1 Message Date
Karel Zak bffc9174b8 zramctl: add MEM-LIMIT, MEM-USED and MIGRATED columns
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-18 11:30:56 +02:00
Karel Zak 5388c86260 zramctl: support /sys/block/zram<id>/mm_stat
Linux >= 4.1 provides all memory related statistics by one file.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-18 11:13:44 +02:00
Karel Zak 548b9714e8 lib/strv: add new functions (from systemd)
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-15 14:57:04 +02:00
Stanislav Brabec 8fdc064ac3 script: Fix mangled EOF and hang on big endian
On s390 and other big endian machines, doinput() sends NUL instead of
EOF to the tty master. NUL does not even reach the slave, and it is
waiting for more data forever.

If STDIN is not a tty, the bug caused "^@" being into the log, and since
commit 032228c it also causes hang.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2015-05-15 12:56:46 +02:00
Karel Zak a19876310e Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux
* 'test-fixes' of https://github.com/rudimeier/util-linux:
  tests: fix kill/all_processes
  tests: add $top_builddir to $PATH
2015-05-13 15:08:04 +02:00
Karel Zak 9200391d41 tests: update lscpu tests (due to CPU flags in output)
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-13 15:06:22 +02:00
WANG Chao ee1f1057e2 lscpu: add cpu flags entry to summary output
It'd be convenient to have unified cpu "Flags: " entry in the summary
output.

Signed-off-by: WANG Chao <wcwxyz@gmail.com>
2015-05-13 11:27:16 +02:00
Karel Zak c1be496a93 libfdisk: keep FDISK_FIELD_CYLINDERS independent on context mode
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-11 13:01:26 +02:00
Karel Zak 6360bccad5 fdisk: provide more information by 'i'nfo command
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-11 12:45:21 +02:00
Karel Zak 31ea7fa6d4 libfdisk: add fdisk_label_get_fields_ids_all()
The current fdisk_label_get_fields_ids() is too smart as it
differentiate between details mode etc. It's useful for default
output, but in some cases it's better to provide all output fields.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-11 12:42:24 +02:00
Jean-Loup 'clippix' Bogalho 3e3b51b3b1 fdisk: add the 'i'nfo command
Add the 'i'nfo command to fdisk that prints details about a specific partition.
Details are everything the function 'fdisk_label_get_field' can return.

Signed-off-by: Jean-Loup 'clippix' Bogalho <clippix@lse.epita.fr>
2015-05-11 12:26:30 +02:00
Karel Zak 71af1c7239 tests: add hexdump from GPT
* use hardcoded UUIDs for partitions in sfdisk GPT test
* output hexdump of the GPT header (it would be possible to use MD5
  sum, but from hexdump it's more obvious where is problem)

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-11 12:18:12 +02:00
Ruediger Meier 159652d937 libfdisk: (gpt) fix attributes endianess
The new libfdisk/gpt test (4a4a0927) discovered that we read and write
partition attributes wrongly on BE systems.

Our temporarily used char[8] bits are always LE and do not need to be
converted.

CC: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-05-11 10:51:15 +02:00
Ruediger Meier be8d50fe35 tests: fix kill/all_processes
We have to wait for the killed helper.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-05-08 15:12:00 +02:00
Ruediger Meier 4ba0bfbb51 tests: add $top_builddir to $PATH
Since we have dropped some more hardcoded search paths we should
make sure that our tested binaries would use the right helpers
from our build directory.

See 07b51567 and follow-up commits.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-05-08 15:11:56 +02:00
Karel Zak b3f5d0bc28 Revert "travise: try to add coverity_scan"
This reverts commit 3053e14997.
2015-05-06 16:43:35 +02:00
Karel Zak 3053e14997 travise: try to add coverity_scan
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-06 16:16:17 +02:00
Brad Forschinger b5575bc08c flock: NULL deref
cmd_argv[2] will be initialised only if it's specificed with -c.  NULL
deref otherwise resulting in crash.

Signed-off-by: Brad Forschinger <bnjf@bnjf.id.au>
2015-05-05 12:42:52 +02:00
Mike Frysinger 1eb1911893 build-sys: fix parallel builds w/setarch links
The symlink generation tries to write to the sys-utils/ subdir but does
not make sure that dir exists.  This can sometimes lead to parallel build
failures when building out-of-tree like:
...
echo ".so man8/setarch.8" > sys-utils/linux64.8
/bin/bash: sys-utils/linux64.8: No such file or directory
Makefile:11503: recipe for target 'sys-utils/linux64.8' failed
make: *** [sys-utils/linux64.8] Error 1

References: https://bugs.gentoo.org/511812
Signed-off-by: Mike Frysinger <vapier@chromium.org>
2015-05-05 12:40:54 +02:00
Michael Marineau 4a4a0927c6 libfdisk: (gpt) add API for raw partition attributes
The existing APIs can only toggle individual bits or get and set bits in
a complex text representation, making it impractical to use libfdisk for
manipulating the GPT partition attribute field in more complex ways such
as updating a value that is multiple bits wide. For example priority
based partition selection originally designed for ChromeOS includes two
integer values that are 4-bits wide.

http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format#TOC-Trusting-the-GPT

[kzak@redhat.com: - add new symbols to .sym file and docs
                  - remove unused variables from test program]

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-05 12:39:36 +02:00
Michael Marineau c6bf5c094d libfdisk: (gpt) fix check for beginning of protective partition
Search for the protective partition before attempting to validate that
it covers the GPT header. Some hybrid MBRs list partitions out of order.
For example, CoreOS images ship with a hybrid MBR that lists the boot
partition first and the protective partition second in order to maintain
compatibility with old versions of Xen's PV-GRUB.

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
2015-05-05 12:28:52 +02:00
Stanislav Brabec d60d5b74d2 fsck: Fix parsing of -r
Fix regression introduced by commit 658c089: -r cannot be used as a last
option:

fsck -r /dev/sda1
fsck: invalid argument -r: '/dev/sda1'

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2015-05-05 12:28:41 +02:00
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