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>
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>
[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>
[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>
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>
Also tweak some other wordings and formatting.
Reported-by: Felix Neumann <felix.neumann@inka.de>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* 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()
...
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>
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>
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>
* 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>
* 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>
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>
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>
* '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
* 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>
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>
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>