Closed clemens closed 2 years ago
Here's how I've worked around it for now:
#!/bin/bash
$(npm bin)/better-npm-audit audit > /dev/null && echo "All good!"
I debugged this a bit but I'm still not sure about the proper fix... It also doesn't help that #766 didn't add a test documenting the intended behaviour of to_utf8
method 🤔
Here's a minimal Dockerfile to reproduce the bug:
_(note: the debian
image on this Dockerfile does not define any locale; Encoding.locale_charmap
returns ANSI_X3.4-1968
and the code breaks on gems/overcommit-0.59.0/lib/overcommit/subprocess.rb:105:in 'convert'
)_
FROM debian
RUN apt update -y && apt install -y ruby git && gem install bundler overcommit
WORKDIR some-dir
# setup a git repo with a utf-8 commit message
RUN git init && \
git config --local user.name "Overcommit Tester" && \
git config --local user.email "overcommit@example.com" && \
git commit --allow-empty -m "🤝 UTF-8 text"
# add and install a pre-commit hook that checks a commit message
RUN echo "PreCommit:\n CapitalizedSubject:\n enabled: true" > .overcommit.yml && overcommit --install
# amend the commit to trigger the pre-commit hook; this raises an error
RUN git commit --amend --no-edit
If I understood it correctly, v0.59 breaks on utf8 strings for any unix system that does not define an utf8 locale.
The latest release seems to have an issue when emojis (or more general: UTF-8 characters) are used in a command's output.
Here's the error i'm getting:
The command looks like this:
The binary looks like this:
The output from the command is this:
I'm assuming this is related to https://github.com/sds/overcommit/pull/766.
OS: Debian 10 in Docker container overcommit version: 0.59.0 (it works fine in 0.58.0)