public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v2] deb-dl-dir: Avoid hanging mounts on failed download
Date: Thu, 24 Oct 2024 13:09:46 +0300	[thread overview]
Message-ID: <20241024100946.214428-1-amikan@ilbers.de> (raw)

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.

Signed-off-by: Anton Mikanovich <amikan@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

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241024100946.214428-1-amikan%40ilbers.de.

             reply	other threads:[~2024-10-24 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 10:09 Anton Mikanovich [this message]
2024-10-24 10:41 ` Uladzimir Bely
2024-10-25 13:57 ` Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241024100946.214428-1-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox