View on GitHub

DBGBench

From Practitioners for Researchers

Using Participant Patches

git clone https://github.com/dbgbench/dbgbench.github.io.git dbgbench cd dbgbench/docker ./run.sh find

* Within the Docker container, apply the [patch](#list-of-errors-wpatches) of participant [Participant ID] for error [Error ID]:
```bash
cd ~/Desktop/[Error ID]/find
patch -p1 -l -f < [Error ID]/[Participant ID].patch

Example 1: Dry-run-apply All Patches

You can simply copy-paste the following into your terminal.

# Change to grep if needed
PROJECT=find

# Make patches available locally
cd ~/Desktop
git config --global http.sslVerify false
git clone https://github.com/dbgbench/dbgbench.github.io.git dbgbench

# Loop over all errors and check patch applicability
for id in $(ls -1d ~/Desktop/${PROJECT}*/${PROJECT}.*); do
  pushd $(echo $id | rev | cut -d/ -f2- | rev)/$PROJECT > /dev/null

  error=$(echo $id | rev | cut -d/ -f1 | rev)
  for patch in $(ls -1d ~/Desktop/dbgbench/patches/$error/*.patch); do 
    patch -l -p1 --dry-run -f < $patch > /dev/null

    if [ $? -eq 0 ]; then
      printf "[v]\tCan "
    else
      printf "[x]\tCannot "
    fi
    echo "apply $(echo $patch | rev | cut -d/ -f1 | rev | cut -d. -f1)'s patch to $error ($(echo $id | rev | cut -d/ -f2 | rev))"
  done

  popd > /dev/null
done

Example 2: Check Patch Plausibility

You can simply copy-paste the following into your terminal.

# Change to 'grep' if needed
PROJECT=find

# Make patches available locally
cd ~/Desktop
git config --global http.sslVerify false
git clone https://github.com/dbgbench/dbgbench.github.io.git dbgbench

# Loop over all errors and check patch plausibility
for id in $(ls -1d ~/Desktop/${PROJECT}*/${PROJECT}.*); do
  pushd $(echo $id | rev | cut -d/ -f2- | rev)/$PROJECT > /dev/null

  error=$(echo $id | rev | cut -d/ -f1 | rev)
  for patch in $(ls -1d ~/Desktop/dbgbench/patches/$error/*.patch); do

    # Apply patch
    patch -l -p1 -f < $patch > /dev/null
    if [ $? -ne 0 ]; then
      echo "[?] Cannot apply $(echo $patch | rev | cut -d/ -f1 | rev | cut -d. -f1)'s patch to $error ($(echo $id | rev | cut -d/ -f2 | rev))."
      patch -R -l -p1 -f < $patch > /dev/null
      continue;
    fi

    # Build new/patched version
    make > log.$error.txt 2>&1
    if [ $? -ne 0 ]; then
      echo "[?] Cannot build $error. More info: log.$error.txt"
      continue;
    fi

    # Test new/patched version
    ../test/test.sh $PWD > /dev/null 2>&1
    if [ $? -eq 0 ]; then
      printf "[v] Plausible patch"
    else
      printf "[x] Implausible patch"
    fi
    
    # Revert to old/buggy version
    patch -R -l -p1 -f < $patch > /dev/null
    echo " from $(echo $patch | rev | cut -d/ -f1 | rev | cut -d. -f1) for $error ($(echo $id | rev | cut -d/ -f2 | rev))"

  done
  
  # make sure to build correct (reverted) version
  make > /dev/null 2>&1

  popd > /dev/null
done

Notes

List of Errors w/Patches

You can click on the links below.