#2822 PR merged
: Fix vi in the rescue system on Fedora and RHEL 9¶
Labels: enhancement
, cleanup
, fixed / solved / done
pcahyna opened issue at 2022-06-16 14:48:¶
Pull Request Details:¶
-
Type: Bug Fix
-
Impact: High
-
Reference to related issue (URL): https://bugzilla.redhat.com/show_bug.cgi?id=2097437
-
How was this pull request tested?
without the change:
# echo 'PROGS+=( timeout )' >> /etc/rear/local.conf
# rear -d mkrescue
...
Testing that the recovery system in /var/tmp/rear.sewWahfi7dNgMlf/rootfs contains a usable system
...
# chroot /var/tmp/rear.sewWahfi7dNgMlf/rootfs timeout 10 vi +q
# echo $?
124
with the change, the return code is 0 and manually executing vi in the chroot works properly.
- Brief description of the changes in this pull request:
In recent Fedora and RHEL 9, vi
is a shell script that executes vim
if found, so linking vim
to vi
leads to an infinite loop. Fix by
removing the symlink (I find it more confusing than helpful anyway, and
it is good to reduce the amount of special handling) and adding
/usr/libexec/vi
(the real executable, executed by vi
if vim
is not
found) to COPY_AS_IS
.
One could add vim as well, but I am afraid that it would bloat the rescue ramdisk in case vim is compiled with a rich set of features.
pcahyna commented at 2022-06-16 14:50:¶
Impact is High, because vi
in the rescue system is currently broken
without the change.
pcahyna commented at 2022-06-16 15:05:¶
@gdha I was thinking about it, but the problem is, this "just in case"
may get quite expensive in terms of ramdisk size, if vim
is linked
against e.g. Perl, Python, TCL and GTK (I believe on Ubuntu / Debian
this can be the case).
jsmeix commented at 2022-06-20 07:42:¶
I found 'vim' at those code places
# find usr/sbin/rear usr/share/rear -type f | xargs grep 'vim' | grep -v '# vim: set et ts=4 sw=4'
usr/share/rear/build/GNU/Linux/005_create_symlinks.sh:
ln -sf $v vi $ROOTFS_DIR/bin/vim >&2
usr/share/rear/build/OPALPBA/Linux-i386/106_remove_files_copied_unconditionally.sh:
bin/vim
Perhaps with the changes in this pull request in
build/OPALPBA/Linux-i386/106_remove_files_copied_unconditionally.sh
# Remove symlinks whose targets have been excluded on the PBA system
local symlinks_to_remove=(
bin/vim
var/lib/rear
)
could be simplified or cleaned up to
# Remove symlinks whose targets have been excluded on the PBA system
local symlinks_to_remove=(
var/lib/rear
)
?
build/OPALPBA/Linux-i386/106_remove_files_copied_unconditionally.sh
originates from
https://github.com/rear/rear/commit/e9f61ccc74f5b5be8106b43f67b219983e955956
which points to
https://github.com/rear/rear/pull/2448
but I found no explanation why the 'bin/vim' symlink is removed
especially in case of OUTPUT=RAWDISK
pcahyna commented at 2022-06-20 11:36:¶
@jsmeix good catch, I have no idea why that symlink gets removed, but since we now avoid creating it. I guess it makes sense to avoid removing it as well.
pcahyna commented at 2022-06-20 12:35:¶
I addressed both comments, so I will rebase and merge the PR.
[Export of Github issue for rear/rear.]