lp://staging/apport
- Get this branch:
- bzr branch lp://staging/apport
Branch merges
Branch information
Import details
This branch is an import of the HEAD branch of the Git repository at https://git.launchpad.net/apport.
Last successful import was .
Recent revisions
- 3915. By Benjamin Drung
-
fix(apport): Replace os.path.exists check by try-except
Replace `os.path.exists` check by trying to open the file and catching
`FileNotFoundError` to avoid race conditions.Signed-off-by: Benjamin Drung <email address hidden>
- 3914. By Benjamin Drung
-
fix(tests): Fix false positives for test_run_
crash_anonymity The test `test_run_
crash_anonymity ` can fail if the user or host name is
short:```
============== ======= ======= ======= ======= ======= ======= ======= =======
FAIL: test_run_crash_anonymity (tests. integration. test_ui. T)
run_crash() anonymization
-------------- ------- ------- ------- ------- ------- ------- ------- -------
Traceback (most recent call last):
File "/usr/lib/python3. 10/unittest/ mock.py" , line 1369, in patched
return func(*newargs, **newkeywargs)
File "/<<PKGBUILDDIR>>/tests/ integration/ test_ui. py", line 1650, in test_run_ crash_anonymity
self.assertNotIn(
AssertionError: 'kin' unexpectedly found in 'ProblemType: Crash\nArchitecture: amd64\n[...]'
```The string `kin` can be found in the report (for example in the tag
`kinetic`). So only search for full words in the report if the string is
short (less than five characters and not the string `ubuntu`).Signed-off-by: Benjamin Drung <email address hidden>
- 3913. By Benjamin Drung
-
fix: Use ProblemReport for running generic hook manually
Running the generic general hook manually fails:
```
$ python3 data/general-hooks/generic. py
Traceback (most recent call last):
File "/home/bdrung/ projects/ apport/ apport/ data/general- hooks/generic. py", line 129, in <module>
add_info(r, None)
File "/home/bdrung/ projects/ apport/ apport/ data/general- hooks/generic. py", line 123, in add_info
if report["ProblemType" ] == "Crash":
~~~~~~^ ^^^^^^^ ^^^^^^^
KeyError: 'ProblemType'
```Use an instance of `ProblemReport` like Apport would use.
Signed-off-by: Benjamin Drung <email address hidden>
- 3912. By Benjamin Drung
-
fix: Fix raising OSError if _command_output() runs into a timeout
mypy complains:
```
apport/report. py:179: error: On Python 3 formatting "b'abc'" with "{}" produces "b'abc'", not "abc"; use "{!r}" if this is desired behavior [str-bytes-safe]
apport/report. py:180: error: Item "None" of "Optional[bytes]" has no attribute "rstrip" [union-attr]
```The mypy complains can be converted into a test case that fail:
```
ERROR: test_command_output_ timeout_ no_output (tests. integration. test_report. T.test_ command_ output_ timeout_ no_output)
-------------- ------- ------- ------- ------- ------- ------- ------- -------
Traceback (most recent call last):
File "/home/bdrung/ projects/ apport/ apport/ apport/ report. py", line 169, in _command_output
sp = subprocess.run(
^^^^^ ^^^^^^^ ^^^
File "/usr/lib/python3. 11/subprocess. py", line 550, in run
stdout, stderr = process.communicate( input, timeout=timeout)
^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^
File "/usr/lib/python3. 11/subprocess. py", line 1207, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^
File "/usr/lib/python3. 11/subprocess. py", line 2060, in _communicate
self._check_ timeout( endtime, orig_timeout, stdout, stderr)
File "/usr/lib/python3. 11/subprocess. py", line 1251, in _check_timeout
raise TimeoutExpired(
subprocess.TimeoutExpired: Command '['sleep', '3600']' timed out after 0.1 seconds During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/bdrung/ projects/ apport/ apport/ tests/integrati on/test_ report. py", line 1938, in test_command_ output_ timeout_ no_output
apport.report. _command_ output( ["sleep" , "3600"], timeout=0.1)
File "/home/bdrung/ projects/ apport/ apport/ apport/ report. py", line 182, in _command_output
f" after {error.timeout} seconds: {error.stdout. rstrip( )}"
^^^ ^^^^^^^ ^^^^^^^ ^^
AttributeError: 'NoneType' object has no attribute 'rstrip'
```Signed-off-by: Benjamin Drung <email address hidden>
- 3911. By Benjamin Drung
-
refactor(apport): Drop using proc_pid_fd from is_same_ns
Instead of using `proc_pid_fd` in `is_same_ns()` just specify the path
to the cgroup file. The other code in the function does that already.Signed-off-by: Benjamin Drung <email address hidden>
- 3910. By Benjamin Drung
-
refactor: Move pylint's invalid-name overrides to affected files
Move pylint's invalid-name overrides to affected files to allow getting
this alert for new cases. Address the pylint complains for files that
only have a few complains.Signed-off-by: Benjamin Drung <email address hidden>
- 3909. By Benjamin Drung
-
refactor(gtk/kde): Add assertions to make mypy happy
mypy complains:
```
gtk/apport-gtk:238: error: "None" has no attribute "get" [attr-defined]
gtk/apport-gtk:280: error: Value of type "None" is not indexable [index]
gtk/apport-gtk:413: error: Unsupported right operand type for in ("None") [operator]
gtk/apport-gtk:414: error: Value of type "None" is not indexable [index]
kde/apport-kde:130: error: "QObject" has no attribute "setRange" [attr-defined]
kde/apport-kde:131: error: "QObject" has no attribute "setValue" [attr-defined]
kde/apport-kde:133: error: "QObject" has no attribute "setRange" [attr-defined]
kde/apport-kde:134: error: "QObject" has no attribute "setValue" [attr-defined]
kde/apport-kde:413: error: Incompatible types in assignment (expression has type "ReportDialog", variable has type "None") [assignment]
kde/apport-kde:417: error: "None" has no attribute "exec_" [attr-defined]
kde/apport-kde:426: error: "None" has no attribute "continue_button" [attr-defined]
kde/apport-kde:429: error: "None" has no attribute "send_error_report" [attr-defined]
kde/apport-kde:431: error: "None" has no attribute "ignore_future_ problems" [attr-defined]
kde/apport-kde:516: error: "None" has no attribute "set" [attr-defined]
kde/apport-kde:518: error: "None" has no attribute "set" [attr-defined]
```Add assertions to ensure that the variables are not `None`.
Signed-off-by: Benjamin Drung <email address hidden>
- 3908. By Benjamin Drung
-
refactor(
apport- cli): Move saving the report into a separate function Move saving the problem report in a temporary directory into a separate
function. Assert that `self.report` is not `None` to make mypy happy.Signed-off-by: Benjamin Drung <email address hidden>
- 3907. By Benjamin Drung
-
fix(tests): Correct type of local_path in get_data_directory to str
All calls to `get_data_
directory` that specify `local_path` pass a
string. So correct that type.Signed-off-by: Benjamin Drung <email address hidden>
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)