This if() condition checks the result of seek, write, flush
and fsync. The first three are methods on QFile, so return
a truthy value on success. write() returns number of bytes
written while seek() and flush() return bool true on success.
Therefore they have to be inverted to detect errors. However,
fsync() is a posix system call, so it returns zero (false) on
success. Therefore it should not be inverted.
Note that currently this entire code block can never run.
knownsize is always zero because QFile.size() currently
cannot determine the size of a block device. However, when I
asked to confirm this behavior, a Qt maintainer decided to
implement it, so there is now a PR. If that is released then
this code block will become live and the reversed fsync check
will cause a problem.
PR: https://codereview.qt-project.org/c/qt/qtbase/+/581443
gpt.Signature is not a null-terminated string, but an 8-byte character array. Using `strcmp` will not provide a valid result. Use `strncmp` over the first 8 bytes instead.
Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
- Apply with p1, using a patch generated from git-format-patch.
- Use POSIX 'cd' over 'pushd, popd'
- Use OLDPWD to the find the patch, rather than making assumptions
about the relative location of it.
The keyboard: section should be used instead, which should do the right
thing on whatever platform cloud-init is being used on (writes
/etc/default/keyboard on Debian/Ubuntu, uses localectl on RHEL/Fedora,
runs setup-keymap on Alpine).
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038762
[2]: 2030788
On systems with a very large number of snap packages installed, there
are a considerable number of loop devices. In this case, the `lsblk`
command in linuxdrivelist fills the stdout pipe, blocks, and the
rpi-imager process assumes it has timed out [1].
This is a trivial work-around that simply excludes loop devices
(major=7) from the `lsblk` output. Given subsequent code excludes
everything starting with `/dev/loop` anyway, there should be no change
in user experience with this exclusion.
[1]: https://github.com/waveform80/imager-snap/issues/6