From a0467d37d319a3b2d0331644a7083d2dc5de6ec9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 25 Mar 2017 14:16:21 +0100 Subject: [PATCH 1/2] Remove bash This requires to install ncurses explicitly, which was installed as a dep for bash before, and Vim requires it. Ref: https://github.com/tweekmonster/vim-testbed/issues/20#issuecomment-289196080 --- Dockerfile | 5 +---- scripts/argecho.sh | 2 +- scripts/install_vim.sh | 4 +++- scripts/run_vim.sh | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4693511..7235371 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,6 @@ FROM alpine:3.5 -RUN apk --update add bash \ - && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* - -RUN adduser -h /home -s /bin/bash -D -u 8465 vimtest +RUN adduser -h /home -s /bin/sh -D -u 8465 vimtest RUN mkdir -p /vim /vim-build/bin /plugins RUN chown vimtest:vimtest /home /plugins diff --git a/scripts/argecho.sh b/scripts/argecho.sh index 017e6a2..f7cf1d6 100644 --- a/scripts/argecho.sh +++ b/scripts/argecho.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo "Running as: $(whoami)" diff --git a/scripts/install_vim.sh b/scripts/install_vim.sh index df766b0..0c317f8 100644 --- a/scripts/install_vim.sh +++ b/scripts/install_vim.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e @@ -20,6 +20,8 @@ build() { [ -z $NAME ] && NAME="vim-${TAG}" [ -z $TAG ] && bail "-tag is required" + apk add ncurses + VIM_NAME="vim_${TAG}_py${PYTHON}_rb${RUBY}_lua${LUA}" VIM_PATH="/vim-build/$VIM_NAME" VIM_BIN="$VIM_PATH/bin/vim" diff --git a/scripts/run_vim.sh b/scripts/run_vim.sh index 2467cf2..e1d664a 100644 --- a/scripts/run_vim.sh +++ b/scripts/run_vim.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh BIN=$1 shift -if [ "$BIN" == "bash" ] || [ -z "$BIN" ]; then - exec /bin/bash +if [ "$BIN" = "sh" ] || [ -z "$BIN" ]; then + exec /bin/sh fi if ! [ -x "/vim-build/bin/$BIN" ]; then exec "$BIN" "$@" From 6e443db4b5a626a1944f46586dcb35bdf201161a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 25 Mar 2017 15:06:16 +0100 Subject: [PATCH 2/2] Test argecho and fix shellcheck issue --- example/Makefile | 12 ++++++++++++ scripts/argecho.sh | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/example/Makefile b/example/Makefile index 5babd65..3c23ee7 100644 --- a/example/Makefile +++ b/example/Makefile @@ -15,5 +15,17 @@ test: test-setup for vim in $$vims; do \ $(DOCKER) $$vim '+Vader! test/*'; \ done + out=$$(docker run --rm "$(IMAGE)" /vim-build/bin/argecho "arg1" "arg 2"); \ + for line in "PWD=/" "Running as: root" "Arguments:" "arg1" "arg 2"; do \ + if ! echo "$$out" | grep -qFx -e "$$line"; then \ + echo "Line not found: $$line"; echo "$$out"; exit 1; \ + fi \ + done + out=$$(docker run --rm "$(IMAGE)" argecho "arg1" "arg 2"); \ + for line in "Running as: vimtest" "PWD=/testplugin" "Arguments:" "-u" "/home/vimrc" "-i" "NONE" "arg1" "arg 2"; do \ + if ! echo "$$out" | grep -qFx -e "$$line"; then \ + echo "Line not found: $$line"; echo "$$out"; exit 1; \ + fi \ + done .PHONY: test-setup test diff --git a/scripts/argecho.sh b/scripts/argecho.sh index f7cf1d6..a6b7641 100644 --- a/scripts/argecho.sh +++ b/scripts/argecho.sh @@ -9,6 +9,6 @@ env echo echo "Arguments:" while [ $# -gt 0 ]; do - echo $1 + echo "$1" shift done