8000 Add structured output by lefessan · Pull Request #228 · strace/strace · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add structured output #228

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lefessan
Copy link
Contributor
@lefessan lefessan commented Oct 28, 2022

Add options "-B / --structured-output FORMAT" to print the output of strace in a more parsable format. Currently, we provide "json" for JSON format and "ocaml" for OCaml format.

Given the extend of modifications, we don't aim at covering all the features of strace, but only the most commonly used, and keep full textual backward compatibility.

JSON Format definition:

The format can be checked by putting it in a contest "[... null]", as an array of syscalls. All ints are stored in strings to avoid overflows and specific notations.

OCaml Format definition:

terminals:= token_string | token_integerL

struct := "[" [ token_string "," value ';' ]* "]"
array := "[" [ value ";" ]* "]"
value :=
| "NULL"
| "STRING" token_string
| "PARTIAL_STRING" token_string
| "ARRAY" array
| "INDIRECT" array
| "INT" token_integer
| "STRUCT" struct
| "FLAGS" array
| "CALL" "(" token_string "," array ")"

Values can be typechecked by the OCaml compiler using the following ADT:

type t =
  | NULL
  | PARTIAL_STRING of string
  | STRING of string
  | INT of int64
  | INDIRECT of t list
  | ARRAY of t list
  | FLAGS of t list
  | STRUCT of ( string * t ) list
  | CALL of string * t list
  | ARG of string * t

@lefessan lefessan mentioned this pull request Oct 28, 2022
@codecov
Copy link
codecov bot commented Oct 29, 2022

Codecov Report

Merging #228 (fbc1b19) into master (fbc1b19) will not change coverage.
The diff coverage is n/a.

❗ Current head fbc1b19 differs from pull request most recent head 9c05400. Consider uploading reports for the commit 9c05400 to get more accurate results

@@           Coverage Diff           @@
##           master     #228   +/-   ##
=======================================
  Coverage   91.39%   91.39%           
=======================================
  Files         178      178           
  Lines       17440    17440           
=======================================
  Hits        15939    15939           
  Misses       1501     1501           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lefessan lefessan force-pushed the z-2022-10-18-structured-output branch from b37c6be to 3eb47a1 Compare October 31, 2022 13:49
@lefessan
Copy link
Contributor Author

I fixed the white-spaces error.

@ldv-alt ldv-alt force-pushed the z-2022-10-18-structured-output branch from 3eb47a1 to 1c559c1 Compare November 1, 2022 08:22
@ldv-alt
Copy link
Member
ldv-alt commented Nov 6, 2022

Fabrice, thanks for taking this on. I'd like to ask you to follow the coding style we use in strace, which is similar to the one used in the Linux kernel. In particular, tabs instead of spaces, if ( instead of if( , and so on. Also, I've already made most of automatic changes in the master branch, please rebase. Please turn TCP_STATE_* macros into an enum, and add a comment about TCP_STATE_DUMMY, otherwise it's not clear why tprint_or is defined using TCP_STATE_DUMMY while tprint_plus is defined using TCP_STATE_DELIM. I'll try to do a proper review when the code is updated.

@lefessan lefessan force-pushed the z-2022-10-18-structured-output branch from 1c559c1 to c027a5e Compare November 19, 2022 22:44
@lefessan lefessan changed the title Add structured output WIP: Add structured output Nov 19, 2022
@lefessan lefessan force-pushed the z-2022-10-18-structured-output branch from c027a5e to c1e437b Compare November 21, 2022 08:39
@lefessan lefessan force-pushed the z-2022-10-18-structured-output branch 2 times, most recently from 4708ee2 to ea60f31 Compare November 30, 2022 13:23
Add options "-B / --structured-output FORMAT" to print the output of strace in a more parsable format. Currently, we provide "json" for JSON format and "ocaml" for OCaml format.

Given the extend of modifications, we don't aim at covering all the features of strace, but only the most commonly used, and keep full textual backward compatibility.

See file README-format for more information
@lefessan lefessan force-pushed the z-2022-10-18-structured-output branch from ea60f31 to 9c05400 Compare November 30, 2022 14:26
@lefessan lefessan changed the title WIP: Add structured output Add structured output Nov 30, 2022
@lefessan
Copy link
Contributor Author

@ldv-alt I tried to fix most indentation problems, and rebased it on the latest version. Is there a tool that I can use to spot such problems automatically ?

@ldv-alt
Copy link
Member
ldv-alt commented Dec 18, 2022

I'm not aware of such a tool although it might exist.
Fabrice, how do you test these changes? Could these tests be used in CI?

@masatake
Copy link
Contributor

https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl is the one used in the Linux kernel to check the style.

@ldv-alt
Copy link
Member
ldv-alt commented Jan 21, 2023

OK, I've cherry picked those parts of the PR that could be applied without structured output itself.
@lefessan could you rebase, please, so I'd be able to merge it somehow?

Also, it's crucial to find a way how to test structured output in CI.

@ldv-alt
Copy link
Member
ldv-alt commented Mar 11, 2023

@lefessan, are you still interested in getting this PR merged?

@pombredanne
Copy link
Contributor

@lefessan gentle ping :)

8000
@spoutn1k
Copy link
Contributor
spoutn1k commented Jan 6, 2024

Is this abandoned ? I am very interested in JSON output and wanted to know if this feature was desired still and if I should try and merge the changes.

@ldv-alt
Copy link
Member
ldv-alt commented Jan 11, 2024

Apparently, this PR is stalled for almost a year now.

@spoutn1k
Copy link
Contributor

It is stalled, but my question was more about if I should try to finish the work or if the project took another direction and it was not relevant anymore. If I try and merge it, will it even be considered ?

@ldv-alt
Copy link
Member
ldv-alt commented Jan 11, 2024

The topic is by no means less relevant than before, but it's still non-trivial.

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

Successfully merging this pull request may close these issues.

5 participants
0