swiftlang / swift-format

Formatting technology for Swift source code
Apache License 2.0
2.44k stars 222 forks source link

Error building swift-format in a Docker container - Reopen #770

Open brucemontegani opened 1 month ago

brucemontegani commented 1 month ago

I know I closed this issue the other day but It is still happening. I can confirm that it is a 5.10.1 issue. I can say it works fine for 508.0.0 and for the 'main' branch I am getting the same error but in different spots. This is not a container memory issue.

Here is the log from Docker:

[internal] load build definition from Dockerfile.extended transferring 1656/0 0.004 resolve image config for docker-image://docker.io/docker/dockerfile:1.4 docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc [internal] load .dockerignore transferring 2/0 0.002 [internal] load metadata for docker.io/library/swift:5.10 [context dev_containers_feature_content_source] load .dockerignore [context dev_containers_feature_content_source] load from client transferring 8492/0 0.004 [dev_containers_feature_content_normalize 1/3] FROM docker.io/library/swift:5.10@sha256:f74c9b0ab8e2c2c2af435097e260f6f41be57ef3ef40ce085815a1da40826c8a [dev_containers_feature_content_normalize 2/3] COPY --from=dev_containers_feature_content_source devcontainer-features.builtin.env /tmp/build-features/ [dev_containers_feature_content_normalize 3/3] RUN chmod -R 0755 /tmp/build-features/ [dev_containers_target_stage 3/5] COPY --from=dev_containers_feature_content_normalize /tmp/build-features/ /tmp/dev-container-features [dev_containers_target_stage 2/5] RUN mkdir -p /tmp/dev-container-features [dev_containers_target_stage 4/5] RUN echo "_CONTAINER_USER_HOME=$( (command -v getent >/dev/null 2>&1 && getent passwd 'root' || grep -E '^root|^[^:]:[^:]:root:' /etc/passwd || true) | cut -d: -f6)" >> /tmp/dev-container-features/devcontainer-features.builtin.env && echo "_REMOTE_USER_HOME=$( (command -v getent >/dev/null 2>&1 && getent passwd 'root' || grep -E '^root|^[^:]:[^:]:root:' /etc/passwd || true) | cut -d: -f6)" >> /tmp/dev-container-features/devcontainer-features.builtin.env [dev_containers_target_stage 5/5] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=swift-format_0,target=/tmp/build-features-src/swift-format_0 cp -ar /tmp/build-features-src/swift-format_0 /tmp/dev-container-features && chmod -R 0755 /tmp/dev-container-features/swift-format_0 && cd /tmp/dev-container-features/swift-format_0 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh && rm -rf /tmp/dev-container-features/swift-format_0

Feature       : swift-format
Description   : A feature that installs Apple's swift-format
Id            : Unknown
Version       : 0.2.0
Documentation :
Options       :
VERSION="default"
===========================================================================
++ pwd
+ STARTDIR=/tmp/dev-container-features/swift-format_0
++ mktemp -d
Downloading swiftlang/swift-format
+ TEMPDIR=/tmp/tmp.JzvePaoYcJ
+ VERSION=default
+ trap cleanup EXIT
+ echo 'Downloading swiftlang/swift-format'
+ git clone https://github.com/swiftlang/swift-format /tmp/tmp.JzvePaoYcJ
Cloning into '/tmp/tmp.JzvePaoYcJ'...
+ cd /tmp/tmp.JzvePaoYcJ
+ [[ default == \d\e\f\a\u\l\t ]]
++ get_swift_format_version
+++ swift --version
+++ egrep -o 'Swift version [0-9]+.[0-9]+'
+++ tail -c +15
++ local swift_version=5.10
++ local major_version
++ local minor_version
++ IFS=.
++ read -r maj_version minor_version
++ '[' 2 -eq 1 ']'
++ local swift_format_version=510
++ version_as_number=510
++ local swift_format_version_filter
++ [[ 510 -lt 508 ]]
++ swift_format_version_filter='510.*.*'
+++ tail -n 1
+++ git tag -l '510.*.*'
++ VERSION=510.1.0
++ echo 510.1.0
+ VERSION=510.1.0
+ [[ -z 510.1.0 ]]
Checking out swift-format version from git repo
+ echo 'Checking out swift-format version from git repo'
+ git checkout 510.1.0
Note: switching to '510.1.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

git switch -c <new-branch-name>

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 7996ac6 Change version to 510.1.0
Building swift-format version-> 510.1.0
+ echo 'Building swift-format version-> 510.1.0'
+ swift build -c release --product swift-format
Fetching https://github.com/apple/swift-syntax.git
Fetching https://github.com/apple/swift-argument-parser.git
Fetching https://github.com/apple/swift-markdown.git
[1/62442] Fetching swift-syntax
[4997/68469] Fetching swift-syntax, swift-markdown
[9424/80524] Fetching swift-syntax, swift-markdown, swift-argument-parser
Fetched https://github.com/apple/swift-markdown.git from cache (2.39s)
Fetched https://github.com/apple/swift-argument-parser.git from cache (2.41s)
Fetched https://github.com/apple/swift-syntax.git from cache (2.45s)
Computing version for https://github.com/apple/swift-syntax.git
Computed https://github.com/apple/swift-syntax.git at 510.0.2 (0.55s)
Computed https://github.com/apple/swift-syntax.git at 510.0.2 (0.00s)
Computing version for https://github.com/apple/swift-markdown.git
Computed https://github.com/apple/swift-markdown.git at 0.4.0 (0.40s)
Fetching https://github.com/apple/swift-cmark.git
[1/17801] Fetching swift-cmark
Fetched https://github.com/apple/swift-cmark.git from cache (1.18s)
Computed https://github.com/apple/swift-markdown.git at 0.4.0 (0.00s)
Computing version for https://github.com/apple/swift-cmark.git
Computed https://github.com/apple/swift-cmark.git at 0.4.0 (0.34s)
Computing version for https://github.com/apple/swift-argument-parser.git
Computed https://github.com/apple/swift-argument-parser.git at 1.4.0 (0.19s)
Computed https://github.com/apple/swift-argument-parser.git at 1.4.0 (0.00s)
Creating working copy for https://github.com/apple/swift-syntax.git
Working copy of https://github.com/apple/swift-syntax.git resolved at 510.0.2
Creating working copy for https://github.com/apple/swift-cmark.git
Working copy of https://github.com/apple/swift-cmark.git resolved at 0.4.0
Creating working copy for https://github.com/apple/swift-markdown.git
Working copy of https://github.com/apple/swift-markdown.git resolved at 0.4.0
Creating working copy for https://github.com/apple/swift-argument-parser.git
Working copy of https://github.com/apple/swift-argument-parser.git resolved at 1.4.0
Building for production...
[0/51] Write sources
[1/51] Compiling cmark-gfm cmark_ctype.c
[2/51] Compiling cmark-gfm cmark.c
[3/51] Compiling cmark-gfm arena.c
[4/51] Compiling cmark-gfm-extensions tasklist.c
[5/51] Compiling cmark-gfm-extensions core-extensions.c
[6/51] Compiling cmark-gfm-extensions strikethrough.c
[7/51] Compiling cmark-gfm-extensions tagfilter.c
[8/51] Compiling cmark-gfm xml.c
[9/51] Compiling cmark-gfm-extensions ext_scanners.c
[10/51] Compiling cmark-gfm syntax_extension.c
[11/51] Compiling cmark-gfm-extensions autolink.c
[12/51] Compiling cmark-gfm render.c
[13/51] Compiling cmark-gfm registry.c
[14/51] Compiling cmark-gfm plugin.c
[15/51] Compiling cmark-gfm references.c
[16/51] Compiling cmark-gfm plaintext.c
[17/51] Compiling cmark-gfm map.c
[18/51] Compiling cmark-gfm linked_list.c
[19/51] Compiling cmark-gfm man.c
[20/51] Compiling cmark-gfm-extensions table.c
[21/51] Write swift-version-24593BA9C3E375BF.txt
[22/51] Compiling cmark-gfm latex.c
[23/51] Compiling cmark-gfm node.c
[24/51] Compiling cmark-gfm iterator.c
[25/51] Compiling cmark-gfm houdini_href_e.c
[26/51] Compiling cmark-gfm houdini_html_e.c
[27/51] Compiling cmark-gfm blocks.c
[28/51] Compiling cmark-gfm html.c
[29/51] Write sources
[32/51] Compiling cmark-gfm footnotes.c
[33/51] Compiling cmark-gfm houdini_html_u.c
[34/51] Write sources
[41/52] Compiling CAtomic CAtomic.c
[42/52] Write sources
[43/52] Compiling cmark-gfm commonmark.c
[44/52] Write sources
[45/52] Compiling cmark-gfm buffer.c
[47/54] Compiling SwiftSyntax509 Empty.swift
[48/54] Compiling SwiftSyntax510 Empty.swift
[48/55] Compiling cmark-gfm inlines.c
[49/55] Compiling cmark-gfm scanners.c
[50/55] Compiling cmark-gfm utf8.c
[52/56] Compiling ArgumentParserToolInfo ToolInfo.swift
[53/57] Compiling Markdown ChildIndexPath.swift
[54/57] Compiling ArgumentParser BashCompletionsGenerator.swift
error: compile command failed due to signal 9 (use -v to see invocation)
+ cleanup
+ local exit_status=1
+ echo 'Cleaning up... Exit status: 1'
Cleaning up... Exit status: 1
+ cd /tmp/dev-container-features/swift-format_0
+ '[' -n /tmp/tmp.JzvePaoYcJ ']'
+ rm -rf /tmp/tmp.JzvePaoYcJ
ERROR: Feature "swift-format" (Unknown) failed to install!
ahoppen commented 1 month ago

Synced to Apple’s issue tracker as rdar://131969179

allevato commented 1 month ago

As with the previous issue, there's nothing in the log that points to swift-format as the culprit. It looks like it's compiling the other dependencies and getting killed before it gets to anything in swift-format.

Unfortunately I'm not sure how to suggest that you debug this; I don't have much experience with Docker.

ahoppen commented 1 month ago