diffkemp icon indicating copy to clipboard operation
diffkemp copied to clipboard

`diffkemp-out.yaml`: Add info about differing `sysctl` parameters

Open PLukas2018 opened this issue 3 months ago • 0 comments

When comparing the sysctl parameters, the diffkemp-out.yaml file currently contains only information about in which functions are found semantic differences, but not which/how the functions are connected with the sysctl parameters.

So e.g., for sysctl-list file containing the following sysctl groups:

kernel.*                                                                        
vm.*

when running following commands:

build/bin/diffkemp build-kernel kernel/linux-4.18.0-80.el8/ snap-80-sysctl sysctl-list --sysctl
build/bin/diffkemp build-kernel kernel/linux-4.18.0-147.el8/ snap-147-sysctl sysctl-list --sysctl
build/bin/diffkemp compare snap-80-sysctl/ snap-147-sysctl/

The diffkemp-out.yaml looks like this.

It would be beneficial if the file also included information about to which sysctl parameter the function belongs to.

The updated format of diffkemp-out.yaml remains to be discussed, but it could theoretically look like:

  1.  results:
     - function:
       diffs:
       - function:
         old-callstack:
         - name: ... 
           file: ... 
           line: ... 
         - # ...
         new-callstack:
         - # ...
       - # ...
       sysctl: # Name of sysctl parameter  <------------------------ Add
     - # ...
    

    In the case of the sysctl parameter comparison, there would be an added sysctl field to all functions containing the name of the compared sysctl parameter (e.g., sysctl: kernel.acct) based on which the function was compared.

  2. An alternative solution would be:

    results:
    - sysctl: # Name of sysctl parameter  <------------------------ Add
      results: # Differing functions for given parameter (indented inside the `sysctl` group) <--------- Change
      - function:
        diffs:
        - function:
          old-callstack:
          - name: ... 
            file: ... 
            line: ... 
          - # ...
          new-callstack:
          - # ...
        - # ...
      - # ...
    - sysctl: # Name of different sysctl parameter
      results: .... #  Differing functions for given parameter 
    

    In the case of the sysctl parameter comparison, the format would be different; the results of individual functions would be inserted within the results for the given sysctl parameter.

  3. Different approach.

It would be good to also add a kind field (or something similar) to the output file, so we can easily distinguish if the results are of function comparison or sysctl parameters comparison when the user (or we in the viewer) parses them.


An approximate list of things that will need to be updated:

  • Update Results class: Currently we are using it to represent the result of

    • the overall project,
    • compared functions and
    • differing/inner functions.

    We are using the inner attribute of the class to contain the inner parts (project -> compared functions -> differing functions). For this update, we would also use the class to represent the result of the sysctl parameter, so the hierarchy would look like this project -> sysctl -> compared functions -> differing functions). The changes would probably also require adding a new attribute to the class that would distinguish between these 'kinds' of results and additional changes to the class to make it work correctly.

  • Updating the compare function so it creates an instance of the Result class for a sysctl parameter and inserts the results of compared functions into it...

  • Updating the YamlOutput class so it outputs the updated diffkemp-out.yaml file format.

  • The viewer may also need to be also updated so it handles correctly the updated format of the diffkemp-out.yaml file.

PLukas2018 avatar Sep 16 '25 10:09 PLukas2018