From dc9d597cd8d2e23c9cf576dc03c1f5705681b701 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 1 Aug 2019 19:35:24 -0400 Subject: [PATCH] feat: handle case where file may not have trailing newline and parsing depends on it --- plugins/common/functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/common/functions b/plugins/common/functions index 41c0c3d01..61a7bbb89 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -402,6 +402,11 @@ copy_from_image() { # workaround for CHECKS file when owner is root. seems to only happen when running inside docker cat "$TMP_FILE_COMMAND_OUTPUT" | dos2unix -l >"$DST_FILE" + # add trailing newline for certain places where file parsing depends on it + if [[ "$(tail -c1 "$DST_FILE")" != "" ]]; then + echo "" >>"$DST_FILE" + fi + "$DOCKER_BIN" rm -f "$CID" &>/dev/null else return 1