Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not crash if RDP is selected after regular GUI startup failed (#2326410) #5999

Merged

Conversation

M4rtinK
Copy link
Contributor

@M4rtinK M4rtinK commented Nov 15, 2024

The ask_rd_question() function returns not only the credentials tuple, but also the "use remote desktop" flag.

We correctly handled that in the regular case where we ask for user password if user selected RDP instead of text mode.

But we missed that in the harder to test case where RDP is suggested as an option to the user after regular locally running GUI startup fails. Oops! :P

So handle the extra value and avoid the crash. :)

Resolves: rhbz#2326410

@M4rtinK M4rtinK requested a review from jkonecny12 November 15, 2024 16:04
@M4rtinK M4rtinK force-pushed the master-fix_rdp_credentials_fetching branch from 6430ebd to 5d4508f Compare November 15, 2024 16:11
@M4rtinK
Copy link
Contributor Author

M4rtinK commented Nov 15, 2024

/kickstart-test --testtype smoke

rdp_creds = ask_rd_question(anaconda, message)
# we aren't really interested in the use_rd flag so at least mark it like this
# to avoid linters being grumpy
_use_rd, rdp_creds = ask_rd_question(anaconda, message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly to me this doesn't seem correct.

I don't think we should set the flag.use_rd, it looks to me like a side effect. Another option is to not return the value but that would be less preferable to me as the side effect is still there.

In other words, from looking on this change set it doesn't sense why we ignore this value when we ask for it on line below, however, it's not visible that the use_rd flag is set inside the ask_rd_question.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather rewrite the calls in this method to something like:

def set_gui_mode_on_rdp(anaconda, use_rd):
        if not anaconda.gui_mode:
            log.info("RDP requested via RDP question, switching Anaconda to GUI mode.")
        anaconda.display_mode = constants.DisplayModes.GUI
        flags.use_rd = True

use_rd, rdp_creds = ask_rd_question(message)
set_gui_mode_on_rdp(anaconda, use_rd)

Seems cleaner to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good - yeah, it might actually make sense to set the flag there as well - its should still be marked as using RD even after Wayland crashed. Must have somehow mixed it all up with GUI/non-GUI mode. :)

Feel free to open a new PR & we can then close this one as obsolete. :)

@jkonecny12
Copy link
Member

@M4rtinK could you please tell me how to reproduce this situation?

@M4rtinK
Copy link
Contributor Author

M4rtinK commented Nov 19, 2024

@M4rtinK could you please tell me how to reproduce this situation?

That's the tricky part - I think you need to crash your Wayland session, so that the GUI-startup-failed logic kicks in. :P

On the other hand, I think you can just make run-in-new-session script used to start GNOME Kiosk throw a traceback & this should trigger the fallback code. :)

M4rtinK and others added 2 commits December 2, 2024 15:51
…26410)

The ask_rd_question() function returns not only the credentials tuple,
but also the "use remote desktop" flag.

We correctly handled that in the regular case where we ask for user
password if user selected RDP instead of text mode.

But we missed that in the harder to test case where RDP is suggested
as an option to the user after regular locally running GUI startup
fails. Oops! :P

So handle the extra value and avoid the crash. :)

Resolves: rhbz#2326410
The ask rdp questions dialog methods in display.py were setting
display mode and flags which wasn't visible before. Let's make it
obvious in the code so we don't forget about such an issue as before.
@jkonecny12 jkonecny12 force-pushed the master-fix_rdp_credentials_fetching branch from 088d87e to 4863cc6 Compare December 2, 2024 16:02
@jkonecny12
Copy link
Member

Added one more commit to this PR as suggested above.

@jkonecny12
Copy link
Member

/kickstart-test --testtype smoke

@jkonecny12
Copy link
Member

@M4rtinK do you agree with the new addition?

@M4rtinK
Copy link
Contributor Author

M4rtinK commented Dec 3, 2024

@M4rtinK do you agree with the new addition?

Looking good - ACK (can't ACK formally as original PR author. :D).

@jkonecny12
Copy link
Member

/kickstart-test --testtype coverage

@jkonecny12 jkonecny12 merged commit 5159e65 into rhinstaller:master Dec 4, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f42 Fedora 42
Development

Successfully merging this pull request may close these issues.

2 participants