-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Run annocheck for libruby.so #11123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run annocheck for libruby.so #11123
Conversation
A few thing to consider:
|
3b319bf
to
baf9214
Compare
46dc2bf
to
d706a1a
Compare
Apparently |
fa82c4f
to
6daff56
Compare
When building with `--shared` option, most functionality is kept in `libruby.so`. Therefore also run annocheck for `libruby.so`. Testing `ruby` executable is almost pointless. Use `sed` to expand the `${FILES}` variable, because Docker can't do it: https://stackoverflow.com/questions/61599384/specify-multiple-files-in-arg-to-copy-in-dockerfile
It is not needed to create dir explicitly, when the destination end by slash
373c911
to
28280f7
Compare
I decided to expand the |
Not sure if the build should not be configured with
|
And just FTR, this is the Rust tracker: |
@@ -27,7 +27,8 @@ else | |||
# volume in container in container on GitHub Actions | |||
# <.github/workflows/compilers.yml>. | |||
TAG="${TAG}-copy" | |||
"${DOCKER}" build --rm -t "${TAG}" --build-arg=FILES="${*}" -f ${TOOL_DIR}/annocheck/Dockerfile-copy . | |||
sed -r "s/\\$\{FILES\}/${*}/" ${TOOL_DIR}/annocheck/Dockerfile-copy | \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't /
as the separator unsafe, as it is also a file separator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nobu I would agree with your opinion. the /
is unsafe when the ${*}
includes the file separator /
.
However, I don't think we need to use the sed
command. Because this hack just ignores the functionality of the --build-arg=FILES="${*}"
as an argument. And I have alternative idea to deal with this limitation in a way to understand the logic easily in my opinion. I will share it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For someone who is interested in the annocheck test on CI. The test is executed in the .github/workflows/annocheck.yml
calling the make test-annocheck
calling tool/test-annocheck.sh
.
I tested and debugged this PR on my following branch in my forked repository. The latest commit on the branch is my change proposal for this PR.
https://github.com/junaruga/ruby/tree/wip/v_annocheck-libruby-so-debug
Below is the diff. I think this way is better in terms of understanding the logic easily without using the sed
hack making the --build-arg=FILES="${*}"
in the docker build
command meaningless.
What do you think?
diff --git a/tool/annocheck/Dockerfile-copy b/tool/annocheck/Dockerfile-copy
index 132febc86c..0a79f3a50a 100644
--- a/tool/annocheck/Dockerfile-copy
+++ b/tool/annocheck/Dockerfile-copy
@@ -1,6 +1,6 @@
FROM docker.io/fedora:latest
-ARG FILES
+ARG IN_DIR
RUN dnf -y install annobin-annocheck
-COPY ${FILES} /work/
+COPY ${IN_DIR} /work
WORKDIR /work
diff --git a/tool/test-annocheck.sh b/tool/test-annocheck.sh
index f6a6bd8223..cbe833d97c 100755
--- a/tool/test-annocheck.sh
+++ b/tool/test-annocheck.sh
@@ -15,6 +15,7 @@ set -x
DOCKER="$(command -v docker || command -v podman)"
TAG=ruby-fedora-annocheck
TOOL_DIR=$(dirname "${0}")
+TMP_DIR="tmp/annocheck"
DOCKER_RUN_VOLUME_OPTS=
if [ -z "${CI-}" ]; then
@@ -27,8 +28,13 @@ else
# volume in container in container on GitHub Actions
# <.github/workflows/compilers.yml>.
TAG="${TAG}-copy"
- sed -r "s/\\$\{FILES\}/${*}/" ${TOOL_DIR}/annocheck/Dockerfile-copy | \
- "${DOCKER}" build --rm -t "${TAG}" --build-arg=FILES="${*}" -f - .
+ rm -rf "${TMP_DIR}"
+ mkdir -p "${TMP_DIR}"
+ for file in ${@}; do
+ cp -p "${file}" "${TMP_DIR}"
+ done
+ "${DOCKER}" build --rm -t "${TAG}" --build-arg=IN_DIR="${TMP_DIR}" -f ${TOOL_DIR}/annocheck/Dockerfile-copy .
+ rm -rf "${TMP_DIR}"
fi
"${DOCKER}" run --rm -t ${DOCKER_RUN_VOLUME_OPTS} "${TAG}" annocheck --verbose ${TEST_ANNOCHECK_OPTS-} "${@}"
I confirmed the make test-annocheck
passed on GitHub Actions on my forked repository.
https://github.com/junaruga/ruby/actions/runs/10073821672/job/27848650745#step:10:106
@@ -1668,7 +1668,7 @@ no-test-bundler-parallel: | |||
# architecture. It is designed to be independent of the host OS and the | |||
# architecture. The test-annocheck.sh requires docker or podman. | |||
test-annocheck: $(PROGRAM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $(LIBRUBY_SO)
is missed at this line.
@@ -27,7 +27,8 @@ else | |||
# volume in container in container on GitHub Actions | |||
# <.github/workflows/compilers.yml>. | |||
TAG="${TAG}-copy" | |||
"${DOCKER}" build --rm -t "${TAG}" --build-arg=FILES="${*}" -f ${TOOL_DIR}/annocheck/Dockerfile-copy . | |||
sed -r "s/\\$\{FILES\}/${*}/" ${TOOL_DIR}/annocheck/Dockerfile-copy | \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nobu I would agree with your opinion. the /
is unsafe when the ${*}
includes the file separator /
.
However, I don't think we need to use the sed
command. Because this hack just ignores the functionality of the --build-arg=FILES="${*}"
as an argument. And I have alternative idea to deal with this limitation in a way to understand the logic easily in my opinion. I will share it soon.
By the way, below is an article about https://www.baeldung.com/linux/dollar-star-at
|
I did cherry-pick this PR, adding my change, and opened another PR #11324. So, I would close this PR. Thanks for your PR! |
When building with
--shared
option, most functionality is kept inlibruby.so
. Therefore also run annocheck forlibruby.so
. Testingruby
executable is almost pointless.