Commit Graph

7801 Commits

Author SHA1 Message Date
Sami Kerola 506b499991 mkswap: remove legacy swap structure
If software archeolgists want to know how the old, and unused, swap
header looked they can dig it from the revision history.

[kzak@redhat.com: - use sizeof() for SWAP_HEADER_SIZE]

Reference: 4c85aa3a4c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 10:08:51 +02:00
Sami Kerola 8a101b1447 mkswap, swaplabel: move version number to header
Corrently only the swap version 1 is supported, which is a magic value so
move it to header.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-04 11:42:03 +01:00
Sami Kerola ff1aaf9966 include/c.h: add macro to print definitions as string
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-04 11:42:03 +01:00
Sami Kerola 0e5218acd9 last: fix is_phantom() detection
The /proc/<pid>/loginuid is not always available, and when so a running
session should not be determined to be gone.  This is a regression from
commit mentioned in reference.

Sessions that have started before previous system boot, and did not log
out meanwhile, will be marked as gone.  It is fair to say that these
sessions are most likely result of a wtmp corruption.

Reference: 404fa3f93c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-04 11:42:03 +01:00
Sami Kerola 929f939e6a dmesg: move get_boot_time() to lib/timeutils
In future the last(1) will use get_boot_time() as well.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-04 11:42:03 +01:00
Karel Zak edd2af005c uuidd: remove timeout from systemd service file
It seems that SAP does not like the timeout, for performance is
better to keep the daemon permanently running. This is no problem
because uuidd is used only on systems with very unusual requirements
to UUID.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1092039
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-29 10:37:26 +02:00
Karel Zak 7a1c980c68 tests: add kill_functions.sh to avoid duplicate code
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-28 12:01:37 +02:00
Karel Zak dade4ff7ae Merge branch 'kill-tests-v4' of git://github.com/kerolasa/lelux-utiliteetit
* 'kill-tests-v4' of git://github.com/kerolasa/lelux-utiliteetit:
  lib/procutils: notice setuid() process ownership changes
  lib/procutils: reset errno before strtol() call
  kill: add --verbose option to display what is killed
  tests: check kill all user processes
  tests: check kill print pid option
  tests: check various ways to specify kill signal
  tests: check kill is converting signals names correctly
  tests: add signal receiver program
  kill: remove unnecessary indirection
  kill: make options --pid and --queue mutually exclusive
2014-04-28 11:10:40 +02:00
Sami Kerola 1786a9ac2b lib/procutils: notice setuid() process ownership changes
Earlier the owner of a process was determined by owner of the
/proc/<pid>/stat file.  When changes user ID privileges with setuid() the
stat file ownership is not updated, that resulted kill(1) to consider
such processes where running using same uid as the present process.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola 5889fbe592 lib/procutils: reset errno before strtol() call
When going through /proc the last entry made readdir() to alter errno,
which made the strtol() to think something went wrong, resulting kill(1)
tests to fail when running in --parallel mode.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola d1fd774289 kill: add --verbose option to display what is killed
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola 2556c387aa tests: check kill all user processes
CC: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola 2d8aa0b704 tests: check kill print pid option
CC: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola 76bf54b8a4 tests: check various ways to specify kill signal
CC: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola d39182c1e0 tests: check kill is converting signals names correctly
CC: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:56 +01:00
Sami Kerola 6b93dcbee1 tests: add signal receiver program
Target to kill with a check that will be written later.

CC: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:52 +01:00
Sami Kerola 3665b07cd8 kill: remove unnecessary indirection
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 18:36:40 +01:00
Sami Kerola fe6b5e321f kill: make options --pid and --queue mutually exclusive
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 18:36:40 +01:00
Karel Zak 4593e07513 mount: note that -c unused for mount.<type> in man page
Addresses: https://github.com/karelzak/util-linux/issues/70
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-25 10:07:24 +02:00
Karel Zak 24ed078184 wipefs: don't erase nested partition tables by default
It's possible the partition contains a partition table (BSD, or hybrid
boot images). It could be unexpected for users that the lost all (or
another) partitions when work with non-whole disk device. Let's
require --force.

For example:

 # wipefs --all /dev/sdb

erases all including partition table, but on hybrid disk where the
first partition starts at first sector (so partition table is within
the first partition):

 # wipefs --all /dev/sdb1
 /dev/sdb1: ignore nested "dos" partition table on non-whole disk device
 wipefs: Use the --force option to force erase.

asks for --force.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1077310
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-24 13:42:54 +02:00
Karel Zak c425353570 docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-23 15:28:09 +02:00
Karel Zak bc56d837dd tests: update Py parse mountinfo test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-23 12:34:48 +02:00
Karel Zak e9c202cb4a tests: rely on ts_init_py only
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-23 12:34:24 +02:00
Karel Zak 816f5ccd12 tests: update fdisk sun test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-23 12:21:29 +02:00
Karel Zak 885717c63e Revert "dmesg: don't use brow/yellow in output"
It will be better to support colors customization than use
ugly blue color. BTW, for example git-log uses brow/yellow too
by default.

This reverts commit 0b6fbc2599.
2014-04-23 11:09:44 +02:00
Karel Zak 63ed346eca tests: add fdisk 'f' command MBR test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-23 09:27:13 +02:00
Karel Zak c1156d8564 libfdisk: (dos) improve logical partition reorder command
- use qsort to sort by EBR offsets
 - sort by EBR data partition start sectors

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-22 21:11:03 +02:00
Karel Zak 6c64adeeb6 libfdisk: (mbr) fix logical chain termination
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-22 14:54:44 +02:00
Karel Zak bd1485a66f Merge branch 'test-fdisk' of https://github.com/rudimeier/util-linux 2014-04-22 13:11:23 +02:00
Bjarni Ingi Gislason 46b11619a1 swaplabel: Improve the typesetting of the manual
Change macro 'IR' to 'I' if it has only one (italic) argument

  Remove space at end of lines

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-04-22 12:14:38 +02:00
Bjarni Ingi Gislason 2ad6d4fefe sfdisk: Improve the typesetting of the manual
FIXME
  Units KB, MB, GB, etc. are ambiguous (not necessarily used here)
  Prefixes kilo, mega, giga, etc. are ambiguous with the unit byte (ditto)

  Change ' \- ' to ' \(en ' (an en-dash), if it is a dash (pause,
separation)

  Change ' - ' to ' \(en ' (an en-dash), if it is a dash (pause,
separation)

  Change '\-' to '-' (code "hyphen-minus", rendered with the glyph
hyphen in troff), if it is a part of a compound name.
  A minus is not used in words.  People using UTF-8 and copy-and-paste
can(?) (may?) use "info", "man --ascii" or the command "man" should
have an option to display the '-' ("hyphen-minus") in names of options
with the code (character name) "hyphen-minus" (u002D) instead of
"u2010" (code (character) name "hyphen").

  Change '-' to '\-', if it indicates an option

  Protect a full stop (.), that begins or ends a string, with \&

  Correct space between sentences to two space characters (or begin
each sentence on a new line).

  Change '--' to '\-\-', if it indicates an option

  Add \~ (no-break space) around '|' (means "or")

  Change ' -- ' to ' \(en ' (an en-dash), if it is a dash (pause,
separation)

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-04-22 12:14:28 +02:00
Bjarni Ingi Gislason 930f40e319 raw: Improve the typesetting of the manual
Remove space at end of lines

  Change '-' to '\-', if it indicates an option

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-04-22 12:14:17 +02:00
Bjarni Ingi Gislason b4261b5eda partx: Improve the typesetting of the manual
Add a space character around '|' (means "or")

  Add "(hyphen-minus)" after "\-" to show character name for input

  Change '\-\-' to '\en', when it is used as a dash (pause, separation)

  Add a comma before "or" in a series of words (3 or more)

  Change '-' to '\(en' (an en-dash), if it means a range

  Protect a full stop (.), that begins or ends a string, with \&

  Change '--' to '\-\-', if it indicates an option

  Change '-' to '\-', if it indicates an option

  Change '-' to '\-', if means a minus

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-04-22 12:14:10 +02:00
Ruediger Meier dadc509986 tests: fdisk added a partitions order message (8b60872e)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-04-18 18:31:10 +02:00
Karel Zak 9348ef2511 libfdisk: (gpt) implement 'fix order' commnad
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 14:00:39 +02:00
Karel Zak dd7ba60463 libfdisk: add partitions reorder operation to label API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 13:26:08 +02:00
Karel Zak 4a94144136 nsenter: add + to getopt_long()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 13:12:24 +02:00
Karel Zak a9a4af9030 unshare: add + to getopt_long()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 13:12:13 +02:00
Lukas Czerner 1fd4f609ee fallocate: add FALLOC_FL_ZERO_RANGE support
Recent Linux kernel supports FALLOC_FL_ZERO_RANGE in fallocate(2).
This patch adds FALLOC_FL_ZERO_RANGE support to fallocate utility,
by introducing a new option -z|--zero-range.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
2014-04-18 12:49:42 +02:00
Dongsu Park 83cc932d74 fallocate: introduce an option -c to support COLLAPSE_RANGE
Introduce a new option -c (or --collapse-range) to support a new flag
FALLOC_FL_COLLAPSE_RANGE for fallocate(2). It will nullify a particular
range [offset, offset+len] by shifting extents beyond the range to the
beginning of the hole.

Cc: Lukas Czerner <lczerner@redhat.com>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Cc: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Dongsu Park <dongsu.park@profitbricks.com>
2014-04-18 12:49:39 +02:00
Karel Zak 2dc0c6283b libsmartcols: fix buffer usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 12:01:59 +02:00
Karel Zak 8a2c2dab26 libblkid: make new_partition() more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 12:01:42 +02:00
Karel Zak a60087aa32 libfdisk: fix logical partition reorder command
Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 11:48:53 +02:00
Karel Zak 8b60872ec0 libfdisk: add generic function to check partitions order
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-16 12:51:08 +02:00
Karel Zak ee75308c31 libsmartcols: don't colorize tree ascii art
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 15:25:45 +02:00
Karel Zak 0c33fcbf23 lib/mbalign: report also size in bytes
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 15:25:18 +02:00
Karel Zak 47329bbcf9 libsmartcols: don't mix width (in cells) and size (in bytes)
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 14:23:34 +02:00
Karel Zak d6303e28ec libsmartcols: resuse buffer for encoded data
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 13:59:46 +02:00
Karel Zak c426f70fd4 lib/mbsalign: split mbs_safe_encode()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 13:58:34 +02:00
Karel Zak a61618987a libblkid: fix return codes from PART_ENTRY_* probing
The partitions prober does two step:

1) probe the assigned device for partition table

2) probe whole-disk device for partition table if the assigned device is a
   partition (this generates PART_ENTRY_* results for blkid -p -o udev))

The step 2) is optional and the return code from this probing should
not override success (rc=0) from the step 1) -- except situations when
the step 2) ends with I/O error or when the step 1) found nothing, but
2) was successful.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 13:09:20 +02:00