apple / HomeKitADK

Apache License 2.0
2.57k stars 233 forks source link

Invalid docker reference & Fork bomb with make #24

Closed Clovel closed 4 years ago

Clovel commented 4 years ago

Setup :

Issues

1) make TARGET=Linux all

I have narrowed it down to the main Makefile. The RUN definition must not be getting a correct

2) make TARGET=Linux docker

This seems to work correctly :

Sending build context to Docker daemon     30MB
Step 1/5 : FROM ubuntu:18.04
 ---> 549b9b86cb8d
Step 2/5 : RUN echo ========== Install dependencies ==========   && apt-get update && apt-get install -y     clang     git     make     perl     python3-pip     unzip     wget     libasound2-dev     libavahi-compat-libdnssd-dev     libfaac-dev     libopus-dev     libsqlite3-dev     libssl-dev
 ---> Using cache
 ---> e65f030d9088
Step 3/5 : RUN apt-get install -y gdb
 ---> Using cache
 ---> 95ec9292ed42
Step 4/5 : RUN echo ========== Cleanup ==========   && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 4e94fb11151c
Step 5/5 : WORKDIR /build
 ---> Using cache
 ---> eab9b00d43fe
Successfully built eab9b00d43fe
eab9b00d43fe

We do get the docker contained ID at the end. This is what needs to be inserted in the docker run command.

Analysis

The

-it `make docker`

line does not have a correct syntax. And does not give the Makefile's command the argument it should.

What was attempted

Replacing

-it `make docker`

by

-it $(shell make docker)

This results in a fork bomb.

make: Makefile:5: fork: Resource temporarily unavailable
make: Makefile:11: fork: Resource temporarily unavailable
make: Makefile:28: fork: Resource temporarily unavailable
make: fork: Resource temporarily unavailable
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
make: fork: Resource temporarily unavailable
...
timoschilling commented 4 years ago

I think https://github.com/apple/HomeKitADK/pull/19 contains a fix for that.

Clovel commented 4 years ago

@timoschilling Indeed it does contain a fix for that ! Thanks !

I will close the issue once this is merged.

aajain-com commented 4 years ago

@Clovel yes I ran into the exact same issue when trying to setup the CI and have a fix. Unfortunately I can't merge my PR just yet due to some legal reasons using github actions but will split the change into two separate commits and put up for review.