From 8b77258c0e9fab2804769abd4776555022de4fe2 Mon Sep 17 00:00:00 2001 From: Josh Rosen Date: Mon, 29 Apr 2019 22:17:30 -0700 Subject: [PATCH] Port change from https://github.com/bazelbuild/bazel/pull/8196 --- java_stub_template/file/file.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java_stub_template/file/file.txt b/java_stub_template/file/file.txt index e30a83cf87..0132b16f9b 100644 --- a/java_stub_template/file/file.txt +++ b/java_stub_template/file/file.txt @@ -314,12 +314,14 @@ function create_and_run_classpath_jar() { CLASSPATH_LINE="Class-Path:$MANIFEST_CLASSPATH" # No line in the MANIFEST.MF file may be longer than 72 bytes. # A space prefix indicates the line is still the content of the last attribute. - for ((i = 0; i < "${#CLASSPATH_LINE}"; i += 71)); do + IFS=$'\n' + WRAPPED_LINES=($(echo "$CLASSPATH_LINE" | fold -w 71)) + for ((i = 0; i < "${#WRAPPED_LINES[*]}"; i += 1)); do PREFIX=" " if ((i == 0)); then PREFIX="" fi - echo "$PREFIX${CLASSPATH_LINE:$i:71}" + echo "$PREFIX${WRAPPED_LINES[$i]}" done echo "Created-By: Bazel" ) >$MANIFEST_FILE