Skip to content
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

Search depended packages by path suffix #858

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

kohtala
Copy link
Contributor

@kohtala kohtala commented Aug 2, 2023

Package search by substring finds the substring in libc6-dev package in bookworm causing dev packages to be installed in the slim image.

Fixes #857.

Package search by substring finds the substring in libc6-dev package
in bookworm causing dev packages to be installed in the slim image.

Fixes docker-library#857.
@kohtala
Copy link
Contributor Author

kohtala commented Aug 5, 2023

I verified what changed due to this commit:

$ docker run --rm python:3.11.3-slim-bookworm dpkg-query -Wf '${Package}\n' > 3.11.3-slim-bookworm.lst
$ docker run --rm sha256:0f312442888796fbacf071931af23bb652eec5d948603ce0744e09ae1cc245b8 dpkg-query -Wf '${Package}\n' > 3.11.4-slim-bookworm-patched.lst
$ diff 3.11.4-slim-bookworm*
31d30
< libc-dev-bin
33d31
< libc6-dev
37d34
< libcrypt-dev
63d59
< libnsl-dev
86d81
< libtirpc-dev
93d87
< linux-libc-dev
105d98
< rpcsvc-proto

@yosifkit
Copy link
Member

If the first character in the filename-search-pattern is none of *[?/ then it will be considered a substring match and will be implicitly surrounded by * (as in *filename-search-pattern*).

https://manpages.debian.org/bookworm/dpkg/dpkg-query.1.en.html#S

LGTM

$ docker run -it --rm python:slim bash
root@097ad189d1b7:/# diff -u \
<(find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' 2>/dev/null | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "%s\n", so }' | sort -u | xargs -r dpkg-query --search | cut -d: -f1 | sort -u) \
<(find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' 2>/dev/null | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' | sort -u | xargs -r dpkg-query --search | cut -d: -f1 | sort -u)
--- /dev/fd/63  2023-08-25 21:01:29.769054925 +0000
+++ /dev/fd/62  2023-08-25 21:01:29.769054925 +0000
@@ -1,6 +1,5 @@
 libbz2-1.0
 libc6
-libc6-dev
 libcom-err2
 libcrypt1
 libdb5.3

@yosifkit yosifkit merged commit 81b6e5f into docker-library:master Aug 25, 2023
42 checks passed
@yosifkit
Copy link
Member

Thank you!

docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Aug 25, 2023
Changes:

- docker-library/python@81b6e5f: Merge pull request docker-library/python#858 from kohtala/issue-857
- docker-library/python@2a443de: Update 3.9 to 3.9.18
- docker-library/python@3baa203: Update 3.8 to 3.8.18
- docker-library/python@ffc9b5b: Update 3.11 to 3.11.5, pip 23.2.1
- docker-library/python@9102bda: Update 3.10 to 3.10.13
@kohtala
Copy link
Contributor Author

kohtala commented Aug 28, 2023

Thank you.

I realize it would have been helpful, had I noticed to include the quote already in the comments. Sorry for that.

@tianon
Copy link
Member

tianon commented Dec 1, 2023

For my own future reference, the specific offending file path is this one:

libc6-dev:amd64: /usr/share/gdb/auto-load/lib/x86_64-linux-gnu/libc.so.6-gdb.py

😮‍💨

Edit: a more clear/complete example:

$ docker run -it --rm python:3.11.4-slim bash
root@1b9dc2995f40:/# dpkg-query --search lib/x86_64-linux-gnu/libc.so.6
libc6-dev:amd64: /usr/share/gdb/auto-load/lib/x86_64-linux-gnu/libc.so.6-gdb.py
libc6:amd64: /lib/x86_64-linux-gnu/libc.so.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.11.4-slim adds dev packages
3 participants