Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5509~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5509
Choose a head ref
  • 8 commits
  • 12 files changed
  • 2 contributors

Commits on Mar 29, 2025

  1. Add initial coccicheck script

    The coccicheck.py script can be used to run several semantics patches on a
    source tree to either generate a report, see the context of the modification
    (what lines that requires changes), or generate a patch to correct an issue.
    
        usage: coccicheck.py [-h] [--verbose] [--spatch SPATCH]
                            [--spflags SPFLAGS]
                            [--mode {patch,report,context}] [--jobs JOBS]
                            [--include DIR] [--patchdir DIR]
                            pattern path [path ...]
    
        positional arguments:
        pattern               Pattern for Cocci files to use.
        path                  Directory or source path to process.
    
        options:
        -h, --help            show this help message and exit
        --verbose, -v
        --spatch SPATCH       Path to spatch binary. Defaults to value of
                                environment variable SPATCH.
        --spflags SPFLAGS     Flags to pass to spatch call. Defaults to
                                value of enviroment variable SPFLAGS.
        --mode {patch,report,context}
                                Mode to use for coccinelle. Defaults to
                                value of environment variable MODE.
        --jobs JOBS           Number of jobs to use for spatch. Defaults
                                to value of environment variable JOBS.
        --include DIR, -I DIR
                                Extra include directories.
        --patchdir DIR        Path for which patch should be created
                                relative to.
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    0670e49 View commit details
    Browse the repository at this point in the history
  2. Create coccicheck target for autoconf

    This adds a coccicheck target for the autoconf-based build system. The
    coccicheck target accepts one parameter MODE, which can be either "patch",
    "report", or "context". The "patch" mode will generate a patch that can be
    applied to the source tree, the "report" mode will generate a list of file
    locations with information about what can be changed, and the "context" mode
    will just highlight the line that will be affected by the semantic patch.
    
    The following will generate a patch and apply it to the source code tree:
    
        make coccicheck MODE=patch | patch -p1
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    c1f7155 View commit details
    Browse the repository at this point in the history
  3. Add meson build for coccicheck

    This commit adds a run target `coccicheck` to meson build files.
    
    Since ninja does not accept parameters the same way make does, there are three
    run targets defined---"coccicheck-patch", "coccicheck-report", and
    "coccicheck-context"---that you can use to generate a patch, get a report, and
    get the context respectively. For example, to patch the tree from the "build"
    subdirectory created by the meson run:
    
        ninja coccicheck-patch | patch -d .. -p1
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    18bef14 View commit details
    Browse the repository at this point in the history
  4. Semantic patch for sizeof() using palloc()

    If palloc() is used to allocate elements of type T it should be assigned to a
    variable of type T* or risk indexes out of bounds. This semantic patch checks
    that allocations to variables of type T* are using sizeof(T) when allocating
    memory using palloc().
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    cebab18 View commit details
    Browse the repository at this point in the history
  5. Semantic patch for palloc_array and palloc_object

    Macros were added to the palloc API in commit 2016055 to improve
    type-safety, but very few instances were replaced. This adds a cocci script to
    do that replacement. The semantic patch deliberately do not replace instances
    where the type of the variable and the type used in the macro does not match.
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    c7f0fa4 View commit details
    Browse the repository at this point in the history
  6. Semantic patch for pg_cmp_* functions

    In commit 3b42bdb and 6b80394 overflow-safe comparison functions where
    introduced, but they are not widely used. This semantic patch identifies some
    of the more common cases and replaces them with calls to the corresponding
    pg_cmp_* function.
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    6a55648 View commit details
    Browse the repository at this point in the history
  7. Semantic patch to use stack-allocated StringInfoData

    This semantic patch replace uses of StringInfo with StringInfoData where the
    info is dynamically allocated but (optionally) freed at the end of the block.
    This will avoid one dynamic allocation that otherwise have to be dealt with.
    
    For example, this code:
    
        StringInfo info = makeStringInfo();
        ...
        appendStringInfo(info, ...);
        ...
        return do_stuff(..., info->data, ...);
    
    Can be replaced with:
    
        StringInfoData info;
        initStringInfo(&info);
        ...
        appendStringInfo(&info, ...);
        ...
        return do_stuff(..., info.data, ...);
    
    It does not do a replacement in these cases:
    
    - If the variable is assigned to an expression. In this case, the pointer can
      "leak" outside the function either through a global variable or a parameter
      assignment.
    
    - If an assignment is done to the expression. This cannot leak the data, but
      could mean a value-assignment of a structure, so we avoid this case.
    
    - If the pointer is returned.
    mkindahl authored and Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    3f1ded6 View commit details
    Browse the repository at this point in the history
  8. [CF 5509] Coccinelle for PostgreSQL development

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5509
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CA+14427LS9jKY2FuLwE5extZHK5DDzjFa_YG88yQ3k16WZ=How@mail.gmail.com
    Author(s): Mats Kindahl
    Commitfest Bot committed Mar 29, 2025
    Configuration menu
    Copy the full SHA
    aa07a20 View commit details
    Browse the repository at this point in the history
Loading