Skip to content

dburkart/check-sieve

Repository files navigation

check-sieve
Because breaking your sieve in production sucks.

badge-license badge-contributors badge-language badge-tests badge-last-release

This project aims to make checking mail Sieve syntax easy and painless. Because breaking your sieve in production sucks.

Particular attention is paid to the quality of errors generated. For example:

Errors found in "testsieve":

Incorrect syntax for command "convert".
On line 2:
convert image image ["pix-x=320","pix-y=240"];
^^^^^^^
Usage: convert  <quoted-from-media-type: string>                                      
         <quoted-to-media-type: string>                                        
         <transcoding-params: string-list>  

For a web-based demonstration of check-sieve which is entirely browser-based, visit https://checksieve.com.

Usage

Usage: check-sieve [options] file1 [file2 ...]                                 
                                                                               
Options:                                                                       
  -h, --help               Show this message                                   
  --max-list-length N      Flag lists over a certain length (default: none)    
  --server <host>:<port>   Only allow capabilities advertised by the specified 
                           server.                                             
  --trace-parser           Trace the operation of the parser                   
  --trace-scanner          Trace the operation of the scanner                  
  --trace-tree             Trace the abstract-syntax-tree                      
  --version                Print out version information 

Features

Supported RFCs

Note

If you find any discrepancies with these RFCs, have a request for an RFC not included, or have test-cases that should work but don't, please file an issue.

Development

Dependencies

check-sieve minimally depends on having a modern C++ compiler and the Make build automation software.

On BSD-like systems such as FreeBSD, the gmake tool is required.

Building check-sieve only depends on those aforementioned tools. Developing check-sieve requires addition dependencies:

Additionally, Emscripten is required to generate the Check Sieve JavaScript library.

Installing dependencies

Ubuntu and Debian-based distributions

# Synchronize mirrors
sudo apt-get update

# Core development dependencies
sudo apt-get install make gcc g++ bison flex python3 libpython3-dev 

# JavaScript dependencies
sudo apt-get install emscripten

Arch Linux

# Synchronize mirrors, and
# Core development dependencies
sudo pacman -Syu make gcc bison flex python 

# JavaScript dependencies
sudo pacman -Sy emscripten

Compiling

At the moment, there are four targets for this project:

  1. check-sieve -- This is a command-line program you can use to verify sieves.
  2. libchecksieve.a -- A statically linked library for embedding in other programs (like check-sieve).
  3. checksieve.so -- This is a python extension created for use by the unit tests in the test directory
  4. wasm -- This builds a webassembly javascript library using emscripten.

To build check-sieve simply run make. This will also build the static library. Running make test will compile checksieve.so and run the python tests in the tests directory. Finally, running make all will run all of the other targets.

Installing

To install to /usr/local/, simply run the following:

make install

To install to a custom location, build and install with INSTALL_PREFIX set in your environment to the desired location.

Packages
Snap

Installation of the latest edge snap from snapcraft can be done with the following command:

snap install --edge check-sieve