[PATCH] deb-dl-dir: Avoid hanging mounts on failed download

3 views
Skip to first unread message

Anton Mikanovich

unread,
Oct 17, 2024, 3:57:43 AM10/17/24
to isar-...@googlegroups.com, Anton Mikanovich
If apt-get fails during debsrc_download execution there will be mount
left behind. Protect it with a trap for cleanup in case of failure.

Signed-off-by: Anton Mikanovich <ami...@ilbers.de>
---
meta/classes/deb-dl-dir.bbclass | 3 +++
1 file changed, 3 insertions(+)

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 55e56c50..7ebd057e 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -48,6 +48,9 @@ debsrc_download() {

debsrc_do_mounts "${rootfs}"

+ trap 'exit 1' INT HUP QUIT TERM ALRM USR1
+ trap 'debsrc_undo_mounts "${rootfs}"' EXIT
+
( flock 9
set -e
printenv | grep -q BB_VERBOSE_LOGS && set -x
--
2.34.1

Anton Mikanovich

unread,
Oct 24, 2024, 6:09:57 AM10/24/24
to isar-...@googlegroups.com, Anton Mikanovich
If apt-get fails during debsrc_download execution, one mount will be
left behind. If ISAR_FAIL_ON_CLEANUP is set to 1, an additional error
will be observed:

| Err:1 http://ftp.de.debian.org/debian bookworm/main rtmpdump 2.4+20151223.gitfa8646d.1-2 (dsc)
| Could not connect to ftp.de.debian.org:80 (141.76.2.4), connection timed out
| Err:2 http://ftp.de.debian.org/debian bookworm/main rtmpdump 2.4+20151223.gitfa8646d.1-2 (tar)
| Unable to connect to ftp.de.debian.org:80:
| Err:3 http://ftp.de.debian.org/debian bookworm/main rtmpdump 2.4+20151223.gitfa8646d.1-2 (diff)
| Unable to connect to ftp.de.debian.org:80:
| E: Failed to fetch http://ftp.de.debian.org/debian/pool/main/r/rtmpdump/rtmpdump_2.4%2b20151223.gitfa8646d.1-2.dsc Could not connect to ftp.de.debian.org:80 (141.76.2.4), connection timed out
| E: Failed to fetch http://ftp.de.debian.org/debian/pool/main/r/rtmpdump/rtmpdump_2.4%2b20151223.gitfa8646d.1.orig.tar.gz Unable to connect to ftp.de.debian.org:80:
| E: Failed to fetch http://ftp.de.debian.org/debian/pool/main/r/rtmpdump/rtmpdump_2.4%2b20151223.gitfa8646d.1-2.debian.tar.xz Unable to connect to ftp.de.debian.org:80:
| E: Failed to fetch some archives.
| WARNING: exit code 100 from a shell command.
| DEBUG: Executing shell function rootfs_do_umounts
| DEBUG: Shell function rootfs_do_umounts finished
| DEBUG: Python function do_rootfs_postprocess finished
NOTE: recipe isar-image-ci-1.0-r0: task do_rootfs_postprocess: Failed
NOTE: Tasks Summary: Attempted 699 tasks of which 391 didn't need to be rerun and 1 failed.
ERROR: build/tmp/work/debian-bookworm-armhf/isar-image-ci-qemuarm/1.0-r0/rootfs/deb-src left mounted

Protect mounting with a trap for cleanup in case of failure.

Uladzimir Bely

unread,
Oct 24, 2024, 6:41:43 AM10/24/24
to Anton Mikanovich, isar-...@googlegroups.com
Since patch v2 is technically a v1 with updated commit message, already
well-tested in CI, we would like to merge it soon (e.g. 2024-10-25), if
there are no objections.

--
Best regards,
Uladzimir.

Uladzimir Bely

unread,
Oct 25, 2024, 9:57:51 AM10/25/24
to Anton Mikanovich, isar-...@googlegroups.com
On Thu, 2024-10-24 at 13:09 +0300, Anton Mikanovich wrote:
Applied to next.

--
Best regards,
Uladzimir.
Reply all
Reply to author
Forward
0 new messages