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

debug gentoo emerge with pudb error #454

Open
guyuming76 opened this issue Jun 5, 2021 · 4 comments
Open

debug gentoo emerge with pudb error #454

guyuming76 opened this issue Jun 5, 2021 · 4 comments

Comments

@guyuming76
Copy link

i am debug gentoo linux emerge script with pudb.

in /usr/lib/python3.8/site-packages/_emerge/main.py, i add

from pudb import set_trace; set_trace(paused=False)

from pudb.lowlevel import setlogfile; setlogfile("/tmp/pudberrors.log")

and

gymDeskGentoo ~/.config/pudb # cat saved-breakpoints-3.8
b /usr/lib/python3.8/site-packages/portage/process.py:374

the debugging runs ok, and the emerging process can finished fine, except that near the end of the process, i get an exception screen, but the screen only destroyed the display, i can still work with the terminal window and type clear command the clear the terminal display

image

in /tmp/pudberrors.log, i can find what follows:

[*** Pudb UI Exception Encountered: Error while showing error dialog ***
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2378, in call_with_ui
return f(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2657, in interaction
self.event_loop()
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2614, in event_loop
keys = self.screen.get_input()
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 342, in get_input
self._wait_for_input_ready(self._next_timeout)
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 542, in _wait_for_input_ready
fd = self._input_fileno()
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 98, in _input_fileno
return self._term_input_file.fileno()
ValueError: I/O operation on closed file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 443, in user_line
self.interaction(frame)
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 409, in interaction
self.ui.call_with_ui(self.ui.interaction, exc_tuple,
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2380, in call_with_ui
self.hide()
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2373, in hide
self.screen.stop()
File "/usr/lib/python3.8/site-packages/urwid/display_common.py", line 821, in stop
self._stop()
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 255, in _stop
fd = self._input_fileno()
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 98, in _input_fileno
return self._term_input_file.fileno()
ValueError: I/O operation on closed file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2292, in show_internal_exc_dlg
self._show_internal_exc_dlg(exc_tuple)
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2319, in _show_internal_exc_dlg
self._show_exception_dialog(
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2327, in _show_exception_dialog
res = self.dialog(
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2263, in dialog
return self.event_loop(w)[0]
File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2614, in event_loop
keys = self.screen.get_input()
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 342, in get_input
self._wait_for_input_ready(self._next_timeout)
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 542, in _wait_for_input_ready
fd = self._input_fileno()
File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 98, in _input_fileno
return self._term_input_file.fileno()
ValueError: I/O operation on closed file](url)

@inducer
Copy link
Owner

inducer commented Jun 5, 2021

This looks like something closed standard input out from under pudb. Not much it can do in that case IMO. pudb is an interactive debugger, and without stdin, it has no way to receive user interactions. I'm kind of surprised it made it as far as it did, likely in no small part due to @mvanderkamp's careful job catching errors.

You could try to use pudb's remote debugging, which avoids sharing the debuggee's stdin/out.

@guyuming76
Copy link
Author

guyuming76 commented Jun 7, 2021

thanks for suggesting remote debugging, but i still get issues, and i have created a new thread in gentoo forum: https://forums.gentoo.org/viewtopic-p-8620251.html#8620251

@guyuming76
Copy link
Author

guyuming76 commented Jun 7, 2021

截图_2021-06-06_21-27-15

截图_2021-06-07_09-38-24

截图_2021-06-07_14-01-28

截图_2021-06-07_14-47-20

@qhuy4119
Copy link
Contributor

I'm inexperienced with this socket stuff but have you checked https://stackoverflow.com/questions/62847773/typeerror-utf-8-encode-argument-1-must-be-str-not-bytes ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants