Skip to contentSkip to conversation

apt: Port apt-file to busybox readlink

PATCH In review Ricardo Ribalda Delgado 2 participants 4 messages May 17, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 apt: Port apt-file to busybox readlink

Redlink from busybox and coreutils behave differently on missing files. This leads to apt-key miss-behaving and also segure apt-get

root@qt5122:~# apt-key exportall
touch: : No such file or directory

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://release.qtec.com:5022/qtec/europa/deb/qt5122 ./ Release: At least one invalid signature was encountered.

---
v2: Add missing signed-off-by

 meta/recipes-devtools/apt/apt.inc             |  1 +
 ...t-Fix-apt-file-with-busybox-readlink.patch | 41 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch
meta/recipes-devtools/apt/apt.inc +1 -0
index f1cde3068d..995bfc45ee 100644
@@ -13,6 +13,7 @@ SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/a/${BPN}/${BPN}_${PV}.tar.
            file://disable-test.patch \
            file://0001-environment.mak-musl-based-systems-can-generate-shar.patch \
            file://0001-apt-1.2.12-Fix-musl-build.patch \
+           file://0001-apt-Fix-apt-file-with-busybox-readlink.patch \
            "
 SRC_URI[md5sum] = "ce8f9ab11f4fd0a08ec73eaffd75c8f0"
 SRC_URI[sha256sum] = "fa1311a9ce00e72379a0a3bc6d240ba30c0968cfbbb3472859e50b99e24e9598"
meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.17.0
#1 lore raw

Dear Ricardo,

Quoted 2 lines · On Thu, 17 May 2018 10:57:04 +0200 Ricardo Ribalda Delgado…

Redlink from busybox and coreutils behave differently on missing files. This leads to apt-key miss-behaving and also segure apt-get

wouldn't it be more appropriate to improve the behavior of busybox?

Best regards,
Andreas

Quoted 74 lines
root@qt5122:~# apt-key exportall
touch: : No such file or directory

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://release.qtec.com:5022/qtec/europa/deb/qt5122 ./ Release: At least one invalid signature was encountered.

---
v2: Add missing signed-off-by

 meta/recipes-devtools/apt/apt.inc             |  1 +
 ...t-Fix-apt-file-with-busybox-readlink.patch | 41 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch
meta/recipes-devtools/apt/apt.inc +1 -0
index f1cde3068d..995bfc45ee 100644
@@ -13,6 +13,7 @@ SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/a/${BPN}/${BPN}_${PV}.tar.
            file://disable-test.patch \
            file://0001-environment.mak-musl-based-systems-can-generate-shar.patch \
            file://0001-apt-1.2.12-Fix-musl-build.patch \
+           file://0001-apt-Fix-apt-file-with-busybox-readlink.patch \
            "
 SRC_URI[md5sum] = "ce8f9ab11f4fd0a08ec73eaffd75c8f0"
 SRC_URI[sha256sum] = "fa1311a9ce00e72379a0a3bc6d240ba30c0968cfbbb3472859e50b99e24e9598"
meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch new file +41 -0
new file mode 100644
index 0000000000..684e3b1626
@@ -0,0 +1,41 @@
+From 3e0804f7882088186f47ff3c3c9e60998a1d93a0 Mon Sep 17 00:00:00 2001
+From: Ricardo Ribalda Delgado <[email protected]>
+Date: Thu, 17 May 2018 10:42:44 +0200
+Subject: [PATCH] apt: Fix apt-file with busybox readlink
+
+Busybox readlink behaves diferently that coreutils readlink:
+
+root@qt5122:~# touch /tmp/this_file_exist
+root@qt5122:~# busybox readlink -f /tmp/this_file_exist
+/tmp/this_file_exist
+root@qt5122:~# readlink -f /tmp/this_file_exist
+/tmp/this_file_exist
+
+root@qt5122:~# readlink -f /tmp/this_file_does_not_exist
+/tmp/this_file_does_not_exist
+root@qt5122:~# busybox readlink -f /tmp/this_file_does_not_exist
+root@qt5122:~#
+
+This patch make apt-file compatible with busybox readlink
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
+---
+ cmdline/apt-key.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in
+index eab5805..421c981 100644
+--- a/cmdline/apt-key.in
++++ b/cmdline/apt-key.in
+@@ -313,6 +313,7 @@ merge_all_trusted_keyrings_into_pubring() {
+     # does the same as:
+     # foreach_keyring_do 'import_keys_from_keyring' "${GPGHOMEDIR}/pubring.gpg"
+     # but without using gpg, just cat and find
++    touch "${GPGHOMEDIR}/pubring.gpg"
+     local PUBRING="$(readlink -f "${GPGHOMEDIR}/pubring.gpg")"
+     rm -f "$PUBRING"
+     touch "$PUBRING"
+-- 
+2.17.0
+
#2 lore raw

Hi Andreas

Yes, I agree. But until that happen we can fix the bug with a one liner that works for coreutils and busybox without risking program relaying on the wrong behaviour of busybox

Quoted 5 lines · Andreas Oberritter

Dear Ricardo,

On Thu, 17 May 2018 10:57:04 +0200
Ricardo Ribalda Delgado <[email protected]> wrote:

Quoted 14 lines
Quoted 2 lines

Redlink from busybox and coreutils behave differently on missing files. This leads to apt-key miss-behaving and also segure apt-get

wouldn't it be more appropriate to improve the behavior of busybox?

Best regards,
Andreas

Quoted 5 lines
root@qt5122:~# apt-key exportall
touch: : No such file or directory

W: An error occurred during the signature verification. The repository

is not updated and the previous index files will be used. GPG error:
http://release.qtec.com:5022/qtec/europa/deb/qt5122 ./ Release: At least one invalid signature was encountered.

Quoted 9 lines
Quoted 9 lines

---
v2: Add missing signed-off-by

 meta/recipes-devtools/apt/apt.inc             |  1 +
 ...t-Fix-apt-file-with-busybox-readlink.patch | 41 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644

meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/meta/recipes-devtools/apt/apt.inc

Quoted 4 lines

meta/recipes-devtools/apt/apt.inc SRC_URI = "

Quoted 4 lines

index f1cde3068d..995bfc45ee 100644

meta/recipes-devtools/apt/apt.inc +0 -0
@@ -13,6 +13,7 @@ SRC_URI = "

http://archive.ubuntu.com/ubuntu/pool/main/a/${BPN}/${BPN}_${PV}.tar.

Quoted 2 lines

meta/recipes-devtools/apt/apt.inc SRC_URI = " · line 14

Quoted 2 lines
meta/recipes-devtools/apt/apt.inc +0 -0
            file://disable-test.patch \
 

file://0001-environment.mak-musl-based-systems-can-generate-shar.patch \

Quoted 5 lines

meta/recipes-devtools/apt/apt.inc SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/a/${BPN}/${BPN}_${PV}.tar.

Quoted 5 lines
meta/recipes-devtools/apt/apt.inc +1 -0
            file://0001-apt-1.2.12-Fix-musl-build.patch \
+           file://0001-apt-Fix-apt-file-with-busybox-readlink.patch \
            "
 SRC_URI[md5sum] = "ce8f9ab11f4fd0a08ec73eaffd75c8f0"
 SRC_URI[sha256sum] =

"fa1311a9ce00e72379a0a3bc6d240ba30c0968cfbbb3472859e50b99e24e9598"

Quoted 1 line
Quoted 1 line

diff --git

a/meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch b/meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch

Quoted 4 lines
Quoted 4 lines

new file mode 100644
index 0000000000..684e3b1626
--- /dev/null
+++

b/meta/recipes-devtools/apt/apt/0001-apt-Fix-apt-file-with-busybox-readlink.patch

Quoted 26 lines
Quoted 26 lines
meta/recipes-devtools/apt/apt.inc +25 -0
@@ -0,0 +1,41 @@
+From 3e0804f7882088186f47ff3c3c9e60998a1d93a0 Mon Sep 17 00:00:00 2001
+From: Ricardo Ribalda Delgado <[email protected]>
+Date: Thu, 17 May 2018 10:42:44 +0200
+Subject: [PATCH] apt: Fix apt-file with busybox readlink
+
+Busybox readlink behaves diferently that coreutils readlink:
+
+root@qt5122:~# touch /tmp/this_file_exist
+root@qt5122:~# busybox readlink -f /tmp/this_file_exist
+/tmp/this_file_exist
+root@qt5122:~# readlink -f /tmp/this_file_exist
+/tmp/this_file_exist
+
+root@qt5122:~# readlink -f /tmp/this_file_does_not_exist
+/tmp/this_file_does_not_exist
+root@qt5122:~# busybox readlink -f /tmp/this_file_does_not_exist
+root@qt5122:~#
+
+This patch make apt-file compatible with busybox readlink
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
+---
+ cmdline/apt-key.in | 1 +
+ 1 file changed, 1 insertion(+)
Quoted 8 lines

meta/recipes-devtools/apt/apt.inc line 33

Quoted 8 lines
meta/recipes-devtools/apt/apt.inc +8 -0
+
+diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in
+index eab5805..421c981 100644
+--- a/cmdline/apt-key.in
++++ b/cmdline/apt-key.in
+@@ -313,6 +313,7 @@ merge_all_trusted_keyrings_into_pubring() {
+     # does the same as:
+     # foreach_keyring_do 'import_keys_from_keyring'

"${GPGHOMEDIR}/pubring.gpg"

Quoted 8 lines
Quoted 8 lines
meta/recipes-devtools/apt/apt.inc +8 -0
+     # but without using gpg, just cat and find
++    touch "${GPGHOMEDIR}/pubring.gpg"
+     local PUBRING="$(readlink -f "${GPGHOMEDIR}/pubring.gpg")"
+     rm -f "$PUBRING"
+     touch "$PUBRING"
+--
+2.17.0
+
Signature · 1 line
Ricardo Ribalda