23 Commits

Author SHA1 Message Date
Mia McMahill
a9215f4153 flatpak-coredumpctl: Clean up usage messages slightly with metavar
This just makes the generated messages slightly less redundant and a
little closer to coredumpctl's.
2026-06-23 09:05:14 +00:00
Mia McMahill
aef5cf91a3 flatpak-coredumpctl: Make use of periods consistent in help messages
Help messages were inconsistent about whether they ended with periods or
not. I chose to remove the periods from those that had them rather than
the other way around because the help messages automatically generated
by argparse do not have periods.
2026-06-23 09:05:14 +00:00
Mia McMahill
32698f1e60 flatpak-coredumpctl: Refactor arg validation to have no typecheck errors
There are a couple related changes made here, with the intention of
making it easier to implement additional features in the future:
- Mutual exclusivity of --build-directory and app is better enforced
  both through types and at runtime. The types will let type checkers
  ensure that we cannot reach the run function without at least one of
  them being valid. At runtime, it no longer allows both to be
  specified, which could result in confusion over which takes
  precedence.
- Instead of wrapping the entire program in a class, there is now only a
  small class that handles validation of the arguments and holding the
  data to be passed to run. This provides a better separation of
  concerns, with the argument parsing now being a little less tied to
  running the debugger.
2026-06-23 09:05:14 +00:00
Mia McMahill
dbdddd4bd5 flatpak-coredumpctl: Only call sys.exit from main 2026-06-23 09:05:14 +00:00
Mia McMahill
e77bb49d88 flatpak-coredumpctl: Remove nargs="?" from -m option
-m with no argument currently results in coredumpctl_matches having a
value of "", which is exactly the same as if it weren't used at all. As
far as I can tell, allowing this does nothing useful, only making the
usage slightly less clear.
2026-06-23 09:05:14 +00:00
razzeee
6b6fdda2f6 flatpak-coredumpctl: Guard against unexpected coredumpctl output
The bare tuple unpack 'executable, = re.findall(...)' raises a cryptic
ValueError if the pattern matches zero or more than one line. Replace it
with an explicit length check and a clear error message.

Also pass count=1 to str.replace() so a /newroot prefix is only stripped
once and /app/ paths are passed through unchanged.
2026-06-08 12:10:42 +00:00
Mia McMahill
8c418fa4b9 flatpak-coredumpctl: Use subprocess.PIPE instead of NamedTemporaryFile 2026-05-27 14:48:22 +00:00
Mia McMahill
61272df8cd flatpak-coredumpctl: Require Python 3.10 or greater at runtime 2026-05-27 14:48:22 +00:00
Mia McMahill
b6ceab85c3 flatpak-coredumpctl: Pass tuple to startswith instead of two calls 2026-05-27 14:48:22 +00:00
Mia McMahill
4bcd6cd48b flatpak-coredumpctl: Pass description as argparse description argument
This prevents it from getting printed twice in some circumstances
2026-05-27 14:48:22 +00:00
Mia McMahill
8e5d4c1183 flatpak-coredumpctl: Exit with return code of flatpak_command 2026-05-27 14:48:22 +00:00
Mia McMahill
0285e879d0 flatpak-coredumpctl: Print help message to stderr
This is more consistent with common practice for
help messages printed due to missing/incorrect arguments.
2026-05-27 14:48:22 +00:00
Mia McMahill
d7dbb10845 flatpak-coredumpctl: Replace old style format strings with f-strings
Print out error messages instead of raising an uncaught exception

Replace one more set of quotes that I missed previously
2026-05-27 14:48:22 +00:00
Mia McMahill
f48c7866b6 flatpak-coredumpctl: Clean up mixed usage of single and double quotes 2026-05-27 14:48:22 +00:00
Mia McMahill
af453ce99d flatpak-coredumpctl: Check for /app as well as /newroot
This fixes a bug where the warning about not being a flatpaked
application was being printed for flatpaks. This was due to a
change in bwrap so that the paths no longer start with /newroot.
2026-05-27 14:48:22 +00:00
Manuel Rego Casasnovas
6ae117c250 flatpak-bisect: Use raw string for regular expression
This is showing a SyntaxWarning when using flatpak-bisect
with Python 3.12. Using a raw string fixes it.

See second change listed in:
https://docs.python.org/3/whatsnew/3.12.html#other-language-changes

Closes: #6508
2026-02-25 23:39:15 +05:30
Simon McVittie
9eb824f863 Add a Meson build system
Resolves: https://github.com/flatpak/flatpak/issues/2241
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 16:12:14 +01:00
Matthew Leeds
f9a4b44c64 flatpak-bisect: Remove unused variable
This fixes a warning pointed out by lgtm.com. I checked that the following
still works:
$ PAGER=more flatpak-bisect -b stable org.gnome.Builder log

Closes: #2894
Approved by: matthiasclasen
2019-05-16 23:56:24 +00:00
Michael Catanzaro
68a5a46cbf flatpak-coredumpctl: launch flatpak with --filesystem=home
This is a debugging tool so there's no need for a strict sandbox. I
want to be able to extract backtraces from gdb using 'set logging on'
and it's not currently possible without using
--extra-flatpak-args="--filesystem=home".

Closes: #2313
Approved by: matthiasclasen
2018-11-14 12:35:31 +00:00
Charlie Turner
15c8e26a91 flatpak-coredumpctl: -b option ignored the argument.
Due to a typo, the -b option was not placing the passed build directory
into the CoreDumper class.

Closes: #2076
Approved by: alexlarsson
2018-09-07 15:17:39 +00:00
Thibault Saunier
c0ef5aadcb scripts: Add a flatpak-coredumpctl to debug crashed application in gdb
Closes: #1784
Approved by: alexlarsson
2018-06-19 08:39:31 +00:00
Alexandru Băluț
ad4aada754 scripts: Fix flatpak-bisect log
The script was using stdout=subprocess.STDOUT but the Popen
documentation does not mention this as a valid value.

An exception was being thrown when running flatpak-bisect <name> log:
OSError: [Errno 9] Bad file descriptor
2017-05-02 15:01:19 +02:00
Thibault Saunier
75388609b3 scripts: Add a script to allow bisecting failures
The CLI is pretty similare to the `git bisect` one and works as follow:

  $ flatpak-bisect org.app.App start # Update application and get the history
  $ flatpak-bisect org.app.App bad # Sets current commit as first bad commit
  $ flatpak-bisect org.app.App checkout GoodHash # Checkout the first known good commit
  $ flatpak-bisect org.app.App good # Sets GoodHash as first good commit

... Here it starts bisection and checkouts a commit on the way, the user should launch the
app to check if the commit is good or bad and run:

  $ flatpak-bisect org.app.App good # if commit is good
  $ flatpak-bisect org.app.App bad # if commit is bad

flatpak-bisect will tell when the first bad commit is found.

Fixes https://github.com/flatpak/flatpak/issues/530
2017-02-23 17:41:06 +01:00