Commit Graph

9577 Commits

Author SHA1 Message Date
Sami Kerola 71d95e92c1 rtcwake: add rtcwake_control and remove global variables
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 13:39:37 +02:00
Sami Kerola 14867b0f72 reset: deprecate the script, and remove reset.033c
Most distributions probably ship reset from ncurses, which means
util-linux reset(1) is unlikely to be in use anywhere.  Assuming the
previous being true it is almost unimaginable anyone one would be using
the alternative script, so remove it and mark the script deprecated.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 12:06:22 +02:00
Sami Kerola 694562e3b8 getopt: use $(...) command substitution in example script [shellcheck]
Reference: https://github.com/koalaman/shellcheck/wiki/SC2006
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 12:06:12 +02:00
Sami Kerola 55034ed00e docs: unify mkswap(8) with swapon(8) about holes warning
Reviewed-by: Dave Rutherford <dave@evilpettingzoo.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 12:06:00 +02:00
Sami Kerola b464fd6284 zramctl: add link to kernel documentation
The manual page does lacks explanation how to create zram with modprobe.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 12:05:50 +02:00
Sami Kerola 0688911ad4 last-deprecated: remove from source tree
The last/lastb(1) from sysvinit has been around for about two years,
and the better implementation is already part of releases 2.24 to 2.26.
It should be safe to remove the unused last code from the source tree.

Reference: ce60272039
Signed-off-by: Sami Kerola <sami.kerola@lastminute.com>
2015-06-29 12:05:39 +02:00
Sami Kerola 0664d41dba script: fix variable initialization warning
term-utils/script.c:402:19: warning: obsolete use of designated
initializer without '=' [-Wpedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 12:05:25 +02:00
Karel Zak 9583461dea build-sys: make autogen.sh more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-29 12:03:43 +02:00
Karel Zak a3b69ccb1c build-sys: use REALTIME_LIBS for script
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-29 10:55:37 +02:00
Boris Egorov 13c551f259 cfdisk: fix condition logic [cppcheck]
[disk-utils/cfdisk.c:1181] -> [disk-utils/cfdisk.c:1181]: (warning)
Possible null pointer dereference: data - otherwise it is redundant to
check it against null.

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:53 +02:00
Boris Egorov 7508d991c5 libblkid/whereis: simplify some conditions [cppcheck]
[misc-utils/whereis.c:466]: (style) Redundant condition: uflag.
'A && (!A || B)' is equivalent to 'A || B'
[libblkid/src/tag.c:373]: (style) Redundant condition: dev.
'A && (!A || B)' is equivalent to 'A || B'

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:50 +02:00
Boris Egorov e3ca1312a2 sys-utils/disk-utils/lib: fix printf format types [cppcheck]
Fix 'invalidPrintfArgType' cppcheck warnings

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:45 +02:00
Andreas Henriksson 9fa6088aa9 rename: allow full-path renames
The command "touch b0;rename.ul -v ./b0 ./b1 ./b0" used to work
before "allow renaming in subdirectories" change.
(regression in commit bd9ced628b)

Addresses: https://bugs.debian.org/789240
Reported-by: gregrwm <bug-grub@whitleymott.net>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2015-06-25 12:01:36 +02:00
Andreas Henriksson be9308f743 tests: add fullpath tests to rename/subdir
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2015-06-25 12:01:33 +02:00
Benno Schulenberg e10f0d073f cal: correct the man page: the reformation eliminated eleven days, not ten
Also tweak some other wordings and formatting.

Reported-by: Felix Neumann <felix.neumann@inka.de>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-25 11:56:59 +02:00
Karel Zak b6ffab101a Merge branch 'script'
* script: (25 commits)
  script: add note to BUGS man page section
  script: fix EOF problems
  script: improve poll debugging
  script: cleanup signals usage
  script: debug poll() results
  script: add support for SCRIPT_DEBUG=
  script: remove magic constants from poll code
  script: rename control struct members
  script: close timingfp also when -e
  tests: add scriptreplay test
  script: move timing file opening close to use of it
  script: add noreturn function attributes
  script: use gettime_monotonic() to get timing file timestamps
  script: use correct input type, move comment, and so on
  script: replace strftime() workaround with CFLAGS = -Wno-format-y2k
  script: move do_io() content to small functions
  script: add 'Script started' line always to capture file
  script: remove io vs signal race
  script: merge doinput() and output() functions to do_io()
  script: use poll() rather than select()
  ...
2015-06-25 11:56:02 +02:00
Karel Zak 63ddc7ba1e script: add note to BUGS man page section
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-25 11:55:42 +02:00
Karel Zak 3c1a1bad73 logger: add note about kern->user conversion
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-24 12:17:32 +02:00
Karel Zak 4b7248c029 libfdisk: add GPT GUIDs for ARMs
Addresses: https://github.com/karelzak/util-linux/issues/203
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-22 11:56:43 +02:00
Karel Zak 7dc0f5c90e libmount: improve monitor to be usable for non-root users
The current implementation calls mkdir and open(O_CREATE) to
initialize /run/mount/utab.lock before it starts to monitor the file.
Unfortunately it makes the monitor useless for non-root processes
(e.g. systemd --user).

The new implementation adds inotify watch for the last existing
component in the path (/run/mount/utab.lock) and re-initialize
after a change. It makes the monitor robust enough for mkdir/rmdir
when monitor is already active.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-19 12:30:40 +02:00
Romain Bouvier c893f5e462 libuuid: return correct value for uuid_generate_time_safe
Make return value consistent for consecutive calls.  If you call
uuid_generate_time_safe, it should always return -1 if it can't guarantee
uniqueness.  Without this patch, on consecutive calls where it can't guarantee
uniqueness, the first call returns -1, but later calls return 0.

Reported-by: Romain Bouvier <skunnyk@alteroot.org>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2015-06-18 12:12:16 +02:00
Karel Zak acb7651f88 libfdisk: ignore misaligned optimal I/O size
For example:

 # modprobe scsi_debug dev_size_mb=1000 opt_blks=65535 physblk_exp=3

creates a disk with:

 Sector size (logical/physical): 512 bytes / 4096 bytes
 I/O size (minimum/optimal): 4096 bytes / 33553920 bytes

where 33553920 % 4096 != 0, it means that use Optimal I/O size to
align partition results that partition is not aligned to physical
sector boundary.

Reported-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-18 11:55:29 +02:00
Karel Zak 54c6611d6f script: fix EOF problems
* remove STDIN from poll() if:

  * STDIN already closed -- poll returns POLLHUP, for example:

		echo "date" | script

  * detect EOF as returned by read(), for example:

		script -c "echo Hello" < /dev/null

* don't write to master when there is still something to read from
  slave (it means shell is not initialized yet or busy)

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-17 15:48:50 +02:00
Karel Zak 2e9418b7cc script: improve poll debugging
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-17 13:33:35 +02:00
Karel Zak d35ffe808a script: cleanup signals usage
* don't call anything from assert()
 * fork() block cleanup to make it more readable
 * restore original signal mask in child (do_shell())
 * close signal FD in child (do_shell())

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-17 13:25:46 +02:00
Benno Schulenberg 7f5769182f sfdisk: improve some formatting and wording in the man page
The main fix is: giving -J, --json its own paragraph.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-17 11:01:38 +02:00
Benno Schulenberg 3f43f5d05e sfdisk: show that the command --verify optionally takes device names
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-17 11:01:33 +02:00
Ruediger Meier 1e2b75611d tests: always kill helper
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-06-16 16:22:49 +02:00
Ruediger Meier 4f4fc8c1d0 procutils: reset errno before readdir
readdir(3p): "When the end of the directory is encountered, a null
pointer shall be returned and errno is not changed"

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-06-16 16:22:26 +02:00
Karel Zak 1200cfbfbd script: debug poll() results
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-16 14:44:05 +02:00
Karel Zak a2b4dec553 script: add support for SCRIPT_DEBUG=
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-16 14:03:09 +02:00
Karel Zak da26af4ee1 script: remove magic constants from poll code
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-16 13:11:05 +02:00
Karel Zak 3f19b85f97 script: rename control struct members
Sorry, but it's really ugly manner to use "xflg" where "x" is a command
line option as program variable and use it in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-16 12:34:04 +02:00
Karel Zak 7e5796c916 script: close timingfp also when -e
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-16 12:26:00 +02:00
Karel Zak f3107d3ac4 Merge branch 'script3' of git://github.com/kerolasa/lelux-utiliteetit into script
* 'script3' of git://github.com/kerolasa/lelux-utiliteetit:
  tests: add scriptreplay test
  script: move timing file opening close to use of it
  script: add noreturn function attributes
  script: use gettime_monotonic() to get timing file timestamps
  script: use correct input type, move comment, and so on
  script: replace strftime() workaround with CFLAGS = -Wno-format-y2k
  script: move do_io() content to small functions
  script: add 'Script started' line always to capture file
  script: remove io vs signal race
  script: merge doinput() and output() functions to do_io()
  script: use poll() rather than select()
  script: use signalfd() to catch signals
  script: add struct script_control and remove global variables
  script: remove function prototypes
  tests: check script options work as expected
  tests: add script output buffering race check
2015-06-16 11:53:18 +02:00
Benno Schulenberg 9acbe2aa47 chrt: slice up the usage text and normalize its layout
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-15 15:06:36 +02:00
Benno Schulenberg 4e4bc0c801 chrt: make the usage synopsis clearer
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-15 15:06:35 +02:00
Karel Zak 2cde9865c2 losetup: be careful with errno
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-15 14:54:15 +02:00
Karel Zak 314ca59fbf tests: add JSON sfdisk dumps
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-15 14:02:36 +02:00
Karel Zak a592b4b580 sfdisk: add --json
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-15 13:23:36 +02:00
Karel Zak 3c7fde5f92 libfdisk: add JSON dump output
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-15 13:18:09 +02:00
Karel Zak 0baeca2aef libfdisk: rename script functions to improve readability
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-15 10:38:47 +02:00
Karel Zak 025f5c0a2b tests: update fdisk BSD
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-11 15:13:17 +02:00
Karel Zak 5989556ad3 libfdisk: add new API to read label specific data
* removes list() label operation from internal API

  The list() has been based on fdisk_info() it was useless for
  anything else than print on stdout...

* add a new get_item() label operation and fdisk_get_disklabel_item() public API

  The new API provides abstract and pretty simple way how to get label
  specific disk label information, for example

     fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ENTRIESLBA, &iterm);

  return LBA of the array with GPT entries.

  Note that this patch does not implement public functions to get
  data from the @item object.

* removes get_id() label operation -- it's subset of the new get_item()

* the new internal API is also used to implement backwardly compatible
  fdisk_list_disklabel() and fdisk_get_disklabel_id()

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-11 14:19:47 +02:00
Karel Zak 535748a617 libfdisk: (dos) fix cylinders calculation
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-10 16:55:29 +02:00
Karel Zak 8dd51c1833 fstrim: de-duplicate by mount source too
Now fstrim de-duplicates by target (mountpoint). This patch adds
de-duplication according to mount source (device) to avoid bind mounts
or devices mounted more than once. Note that the patch also check FS
root, the different FS roots of the same multi-root FS (e.g. btrfs)
maybe mounted on different places.

  # mount --bind /home/wine /mnt/test

old version:

  # fstrim -av
  /mnt/test: 0 B (0 bytes) trimmed            <---
  /home/wine: 0 B (0 bytes) trimmed           <---
  /boot: 0 B (0 bytes) trimmed
  /home: 0 B (0 bytes) trimmed
  /: 0 B (0 bytes) trimmed

new version:

  # fstrim -av
  /mnt/test: 0 B (0 bytes) trimmed            <---
  /boot: 0 B (0 bytes) trimmed
  /home: 171.8 MiB (180113408 bytes) trimmed
  /: 0 B (0 bytes) trimmed

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1162213
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-10 14:19:45 +02:00
Karel Zak 8c73e5096d fdisk: differentiate between +<sector> and +<size>{M,G,...}
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-10 13:06:15 +02:00
Karel Zak 85ccc1d425 libblkid: (nilfs2) check size for backup superblock only
The size of the device seems irrelevant for the primary superblock.
The primary superblock is stored on fixed offset, possible collision
between last partition and whole-disk is possible only for backup
superblock only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-09 16:01:16 +02:00
Karel Zak 3fabc3637c chrt: fix --help inconsistency
Reported-by: Martin Steigerwald <ms@teamix.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-09 11:16:45 +02:00
Karel Zak 00817742ce libblkid: (nilfs2) check devise size
Unfortunately, nilfs2 have the same problem like many RAIDs. It uses
the end of the device to store (backup) superblock. The end of the
last partition is the same location as the end of the whole-disk. It
means that the superblock seems valid for the last partitions as well
as for whole-device.

Fortunately, nilfs2 superblock contains size of the device, so we can
distinguish between whole-disk and partition device.

Reported-by: Heinz Diehl <htd+ml@fritha.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-09 10:37:11 +02:00