You are not logged in.

#1 2023-10-22 14:37:25

bedtime
Member
Registered: 2019-02-12
Posts: 106

Bug with arch-chroot when exiting via a script?

App: arch-chroot (pacman -S arch-install-scripts)

Issue: exiting arch-chroot via the typed command 'exit', exits the arch-chroot and the script

Expectation: That it would exit just the arch-chroot command and not exit the script. Regular chroot does as expected (exits chroot and not the script), arch-chroot, does not.


Some code to illustrate. Note that you must have another working system properly mounted on /mnt to chroot (or arch-chroot) into:

#!/bin/bash

do_chroot () {

   echo "Entering chroot."

   #chroot /mnt /bin/bash
   arch-chroot /mnt /bin/bash

   echo "Exiting chroot."

}

do_dummy () {
   echo "Dummy command executed." 
}

choices=("Chroot" "Dummy" "Quit")

select choice in "${choices[@]}" 
do
   case $choice in
        "Chroot")         do_chroot ;;
        "Dummy")          do_dummy ;;
        "Quit")           break ;;
        '')               echo "Invalid option!" ;;
    esac
done

Exiting arch-chroot doesn't just break you from the select case, but it exits you entirely from the script.

I was talking about this on the Fedora forum, and a member confirmed. He's a lot more experienced than I am in these matters and came up with some reasons what could be happening:
https://forums.fedoraforum.org/showthre … ost1876323

I'm not able to post a bug as the system won't let me in: https://gitlab.archlinux.org/archlinux/ … s/-/issues

If anyone can confirm or report this bug, that would be great.

Offline

Board footer

Powered by FluxBB