Commit graph

97 commits

Author SHA1 Message Date
Robin Jarry 8e37d16a32 Release version 0.13.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-10-20 22:21:09 +02:00
Robin Jarry ebcd6fcea1 lint: check for bad white space habits
A little coding hygiene cannot hurt. Add a simple awk script to check
all source files for bad white space habits:

- trailing white space
- trailing new lines at the end of files
- missing new line at the end of files
- spaces followed by tabs

The script outputs color when the terminal supports it. It exits with
a non-zero code when there was at least one white space issue found.
Call the script in the lint step.

Example output of the awk script:

 config/default_styleset:1:# <-- trailing whitespace
 config/default_styleset:3:# <-- trailing whitespace
 doc/aerc.1.scd:78:        Executes an arbitrary command in the background. Aerc will set the <-- trailing whitespace
 doc/aerc.1.scd:234:        <-- trailing whitespace
 doc/aerc.1.scd:237:        <-- trailing whitespace
 worker/types/thread_test.go:74:        //         return ErrSkipThread<-- space(s) followed by tab(s)
 worker/lib/testdata/message/invalid/hexa: trailing new line(s)

Fix issues reported by the script.

NB: The ENDFILE match is a GNU extension. It will be ignored on BSD-awk
and trailing new lines will not be detected. The lint make target is
only invoked on alpine linux which has GNU awk anyway.

NB: Empty cells in scdoc tables require trailing white space... Avoid
this by setting content in these cells. I don't really see a use for
empty cells.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-10-19 10:19:19 +02:00
Robin Jarry e804fac59f mk: exclude govulncheck from lint
The vulnerability database is evolving with time. It can cause the lint
step to fail suddenly without any source code changes on our side.

Moreover, sometimes, there is nothing we can do to fix the issue nor to
silence that specific error.

Found 1 known vulnerability.

Vulnerability #1: GO-2022-1039
  Programs which compile regular expressions from untrusted
  sources may be vulnerable to memory exhaustion or denial of
  service. The parsed regexp representation is linear in the size
  of the input, but in some cases the constant factor can be as
  high as 40,000, making relatively small regexps consume much
  larger amounts of memory. After fix, each regexp being parsed is
  limited to a 256 MB memory footprint. Regular expressions whose
  representation would use more space than that are rejected.
  Normal use of regular expressions is unaffected.

  Call stacks in your code:
    config/config.go:1000:46:
    git.sr.ht/~rjarry/aerc/config.AercConfig.LoadBinds calls
    regexp.Compile, which eventually calls regexp/syntax.Parse

  Found in: regexp/syntax@go1.18.6
  Fixed in: regexp/syntax@go1.19.2
  More info: https://pkg.go.dev/vuln/GO-2022-1039

Move govulncheck into its own make target to be executed manually.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-07 17:51:54 -05:00
Robin Jarry fcd75ab529 mk: make it obvious that GOFLAGS change cause a rebuild
We had a few issues with that for downstream distros recently.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-09-20 11:37:58 +02:00
Moritz Poldrack dcaabd5adf lint: warn about known security issues
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-09-14 20:51:57 +02:00
Robin Jarry aa52b295b2 Release version 0.12.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-09-01 10:08:54 +02:00
Robin Jarry 8f8dee8303 aerc: fix build when GOFLAGS contains spaces
Due to multiple levels of nested quoting, it is not possible to escape
spaces and/or quotes from GOFLAGS and pass the value to go build
-ldflags to set a compile time variable.

Encode main.Flags in base64 and decode it when reading it.

Fixes: d7e6dc3649 ("aerc: add build info to version string")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2022-08-24 17:00:39 +02:00
Robin Jarry d7e6dc3649 aerc: add build info to version string
Example:

 $ aerc -v
 aerc 0.11.0 +notmuch (go1.18.4 amd64 linux)

Also include that version information in the debug and panic logs.

debug.ReadBuildInfo() is only available in go 1.18+. Add a new variable
set at build time to store $GOFLAGS.

Suggested-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2022-08-22 15:46:33 +02:00
Moritz Poldrack 57de50b7d4 lint: add golangci-lint to the linters
go vet has been removed from the lint step as it is run by the new
linter.

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:58:06 +02:00
Moritz Poldrack 21dcd440f8 lint: use gofumpt instead of gofmt
Link: https://github.com/mvdan/gofumpt
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-01 10:44:50 +02:00
Jose Lombera f5e886406b mk: compute version deterministically
Ensure abbreviated commit id of fixed length in computed version
regardless of user's configuration.  Choose length 12 as safe value.

Link: https://github.com/git/git/commit/dce96489162b
Signed-off-by: Jose Lombera <jose@lombera.dev>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-07-17 18:38:40 +02:00
Robin Jarry 12dec19109 Release version 0.11.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-07-11 21:25:05 +02:00
Robin Jarry bc86392169 mk: merge checkfmt into lint
No need to have two separate targets.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-06-24 21:46:51 +02:00
Moritz Poldrack e9b0186782 mk: add lint target
Run go vet only for now. More linters can be added later. Run linters in
the CI pipeline.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-24 21:08:21 +02:00
Moritz Poldrack d5e278e5ff mk: add dev target with go race detector enabled
Add a dev target which enables Go's race detector. This requires CGo to
be enabled and reduces performance significantly, but helps in finding
data races which can lead to hard to diagnose bugs.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-24 21:08:21 +02:00
Moritz Poldrack d889981088 mk: show built version in build log
Replace the implicit shell-parsing with explicitly running the command.
This allows the built version to be reflected in the build log.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-24 21:08:21 +02:00
Moritz Poldrack 4ebeaa5b95 mk: strip build dir from stack traces
Add the -trimpath flag to the default build command to remove the user's
path from stack traces.

Use a separate BUILD_OPTS make var to avoid it being accidentally
overridden on the command line.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-24 21:08:21 +02:00
Koni Marti 527f602f36 filters: awk filter to parse text/calendar
Implement a filter to read text/calendar (ics) data with awk.
Parses multiple events and shows the date recurrence if
available. Awk alternative to the python filter.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-05-31 14:32:00 +02:00
Robin Jarry b65f5649c8 gpg: make tests more robust
Skip the tests if gpg is not installed.
Avoid interference with the global ~/.gnupg.
Automatically delete GNUPGHOME at the end of tests.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-05-10 14:50:49 +02:00
Robin Jarry 43a79acdfa mk: bump version
I guess I forget to do it every other time...

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-05-10 10:01:34 +02:00
Jens Grassel 1ecee8efa5 Add html "unsafe" filter to work also without dante
If socksify (from dante) is not installed then the filter uses w3m
without it to render an html message part.

Signed-off-by: Jens Grassel <jens@wegtam.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-17 12:17:43 +02:00
Robin Jarry 02b7f74016 mk: do not depend on cmp being available
cmp is part of gnu diffutils which may not be available. Use grep which
is more widespread.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-04-14 21:51:09 +02:00
Robin Jarry 247c6c7438 mk: rename ambiguous LDFLAGS variable
The LDFLAGS environment variable is usually indented for C the linker
flags which are not compatible with go -ldflags.

Use a more explicit GO_LDFLAGS variable instead. Allow adding extra
flags without overriding the default ones by specifying
GO_EXTRA_LDFLAGS.

This may break the build on some distros that rely on setting LDFLAGS to
change the default shareDir or version. They will have to switch to
GO_EXTRA_LDFLAGS.

Link: https://salsa.debian.org/go-team/packages/aerc/-/commit/e9ed90beae9f
Link: https://src.fedoraproject.org/rpms/aerc/blob/f36/f/aerc.spec#_86
Fixes: e7e22aba60 ("mk: rebuild if goflags or ldflags have changed")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-04-06 15:37:00 +02:00
Jens Grassel 374d3a0d01 Add filter script for ics files.
This is a python script for python 3 using the vobject library to show
details about an ics file (text/calendar attachment).

Signed-off-by: Jens Grassel <jens@wegtam.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-03-23 20:56:22 +01:00
Robin Jarry 4c699d35f8 Release version 0.9.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-03-21 22:16:28 +01:00
Daniel Patterson 0cfffaef54 config: specify sharedir during build
We should use the Makefile value of SHAREDIR when searching for config
files and templates etc.

This is important for systems which do not use the standard file
hierarchy or which do not have a consistent location for installing
program files, for example NixOS, which will have a different install
location with every update.

Signed-off-by: Daniel Patterson <me@danielpatterson.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-03 21:31:32 +01:00
Robin Jarry daa26638bc mk: fix dynamic source dependencies with bsd make
When building with BSD make, running `make` after updating a source file
will not cause the binary to be rebuilt. After inspection, it appears
that the GOSRC variable only contains "go.mod go.sum". The aerc target
does not depend on .go source files.

The $(shell) construct is GNU make specific. BSD make has a special
assignment operator (!=) which evaluates a shell command. Since GNU make
4.0, the BSD != operator is supported for compatibility.

Use a syntax that is available in both make flavours.

Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
2022-02-27 21:11:52 +01:00
Robin Jarry e7e22aba60 mk: rebuild if goflags or ldflags have changed
Running make with different values for GOFLAGS or VERSION does not cause
aerc to be rebuilt whereas it should.

Write the go build command line into a file and force aerc to be rebuilt
if the command line has changed.

Use the BSD make compatible != operator to run the command. This
operator is also available in GNU make since version 4.0.

Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
2022-02-27 21:11:31 +01:00
Robin Jarry 9dc2803220 filters: restore plaintext awk script
This script is referenced by some users configuration. Restore it to
avoid breaking existing setups.

Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-20 23:46:29 +01:00
Robin Jarry c63ca9bd9c filters: rename plaintext to colorize
This filter script is not compatible with the previous one. Rename it to
avoid issues with existing configs.

Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-20 23:46:29 +01:00
Robin Jarry 8ed9ae7f0a mk: bump version
I should have done this before creating the tag.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-20 22:04:16 +01:00
Robin Jarry 20cfef95ff contrib: fix aerc.desktop install path
Add missing $(PREFIX).

Note to self: always test install before accepting patches.

Fixes: 5abc3cab96 ("contrib: add xdg desktop entry")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-19 22:29:40 +01:00
Moritz Poldrack 5abc3cab96 contrib: add xdg desktop entry
Add an XDG desktop file to handle mailto: links, to make it easier to
reply to mailing list threads and compose emails with aerc in general.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-19 18:42:44 +01:00
Robin Jarry bb0f180140 config: do not hardcode sharedir
Instead of using a static SHAREDIR at compile time, use a list of
standard paths to use at runtime for templates, config files and
stylesets.

This implies removing all default filters in the default configuration.
Replace them with basic commands. New users can configure the filters as
they wish.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-19 15:24:55 +01:00
Robin Jarry 1f99581f67 mk: use debug to generate a non-optimized binary
Do not use this to run the debugger. Instead, build a non-optimized
binary and display what command should be executed to attach to
a running program.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-02 22:12:08 +01:00
Mark Dain 1864680bfc mk: add make checkinstall
Adds a quick way to ensure the install was successful.
2022-01-24 09:38:45 +01:00
Robin Jarry 44f81c87e4 mk: syntax cleanup
Avoid multiline strings. Use dlv --build-flags.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-21 21:56:40 +01:00
Robin Jarry e97e0d8ab1 mk: be compatible with bsd make
ifeq is not supported by bsd make. We don't need this. Use a simple
shell command.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-21 21:56:40 +01:00
Robin Jarry 34d36bad0d Revert "mk: only install if files changed"
This reverts commit 22ad9e199a.

This breaks install on macOS:

      install -m755 -D aerc /usr/local/bin/aerc
      install: illegal option -- D

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-21 21:38:01 +01:00
Robin Jarry 0709115916 mk: avoid searching in hidden directories at the root
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-20 21:43:47 +01:00
Robin Jarry 22ad9e199a mk: only install if files changed
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-19 22:02:44 +01:00
Robin Jarry 877a94f5d9 compose: add default template for new messages
Allow defining a default template to use when composing new messages.
Add an example to be used for new users.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-19 21:42:41 +01:00
Robin Jarry f81d8871c7 Release version 0.7.1
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-15 12:14:32 +01:00
Robin Jarry 4d7d01b3f0 Release version 0.7.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-14 21:23:18 +01:00
psykose bc087d9b30 mk: remove version override
some build systems build inside a git environment- most notably,
alpine aports is built inside an aports tree. this override prevents
a VERSION=$pkgver override from being passed at build time and makes
aerc think its version is an alpine version from aports:

< aerc -v
aerc v3.15.0.r122.gb306bc1c4c
2021-12-13 14:56:22 +01:00
Robin Jarry 6857ab7a71 build: add check for code formatting
Let's avoid pushing unformatted code.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-11 23:13:27 +01:00
Robin Jarry c303b95336 Release version 0.6.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-09 21:10:17 +01:00
Reto Brunner 077063ba4b Makefile: use git version string if we can
Some packagers overwrote the version we embed in aerc, we really don't want that.
Hence we force clear the variable at the beginning of the makefile.
If git is available and returns a useful info we now use that version instead
of the hardcoded version
2021-02-07 19:25:06 +01:00
y0ast da265a56e4 Make makefile compatible with 3.81 (default MacOS)
Enables using the makefile with mac default make.
2020-12-24 10:56:16 +01:00
Reto Brunner fb67d1f5a3 version bump: 0.5.2 2020-11-14 00:23:43 +01:00