From patchwork Thu Jul 16 09:03:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joris OFFOUGA X-Patchwork-Id: 1330075 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OUhbfvjP; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B6pGG75HHz9sQt for ; Thu, 16 Jul 2020 19:04:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B06732286C; Thu, 16 Jul 2020 09:04:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W23PT2Zqxtfx; Thu, 16 Jul 2020 09:04:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id B2DEC2042C; Thu, 16 Jul 2020 09:04:00 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id D7A9A1BF421 for ; Thu, 16 Jul 2020 09:03:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D4ADA88E88 for ; Thu, 16 Jul 2020 09:03:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WHaMGmzF2-uZ for ; Thu, 16 Jul 2020 09:03:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by fraxinus.osuosl.org (Postfix) with ESMTPS id EB15988E87 for ; Thu, 16 Jul 2020 09:03:58 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id l2so10777306wmf.0 for ; Thu, 16 Jul 2020 02:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ibfn9JlLLKgsSzD1FFjFWYmVfM4a4RNl7qWEg80aGZk=; b=OUhbfvjP8+oYESnlQolG19zYZ1hJxvGSN4v8y6eGLmAJF7CXSKf9lNHcMkLQpJpNNi BvZRVbW35DxyuwFeoYpQbScDrYdKexT5igddj9aTfM9MhaPqsEN8Px4gucwLOawb6fXb x4APJiZ7s95G0f+Aoe6MFibLzRe7kSUPOnbuNmSVkAcnTkyU9tkP10LcQ7XyUAHC7glu pv4WVLa2bRomaxVLyX66EITLAIr9Fpe9zOTVF9OQFVmGZdQZZIr4TvloyiBmyebNojCV t9jzJcBlYEmIUdxmDmCedK+oELyR57D0QBrXiN3XyjEgpS8fHEB2dnev4Ojmqj+9uQWo qH0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ibfn9JlLLKgsSzD1FFjFWYmVfM4a4RNl7qWEg80aGZk=; b=Fwpttkx34AwJBe6y+GwDlsAi3lg3K9el0eXmxtMztELlfPe75BqonyauTYwTZxle9e nHff7b5GnIyR2BucLJuEZLkrvSpTZbW3m1vfSxLMKUfq06kvdZTxV/cOiDhzHqDofTTF FPDyZQzBHy+OSz7/Q3KW2br4q5EHx/NaXS+HB1sqCgYCEwq5Hyrn7zo18Bc5iqyz23lL Zgd5h/TuYxRZfLPp1zKQmIhYw0dO8bD2f/6DpWcq+1PSmdJoNQ/UoP+vJigXATIHo1/C xHAm96plEMcJGcIf4dd0gBhypvjukhb5QSKdmXt1/vvyXb4T/hMDF8/wGcQLKG8tro6v qS9A== X-Gm-Message-State: AOAM532bbDKmhmXGRGQyloo+Skpui0ZIHcjB7u6TdpDwUvK81ID+w81W f07mlNoOCSrKdQySkJ9yZw/vWUQ4 X-Google-Smtp-Source: ABdhPJxQ7YOQlGJOKlMJsjkli5F15+5V3+YdtpVzzZuuqmEWX939BOWFfk4AtiDKibRA95CKG8zu1w== X-Received: by 2002:a1c:3142:: with SMTP id x63mr3330220wmx.62.1594890236935; Thu, 16 Jul 2020 02:03:56 -0700 (PDT) Received: from XPS-15-7590.home ([2a01:cb19:16b:9900:1140:2591:5237:7a2c]) by smtp.gmail.com with ESMTPSA id 92sm8624267wrr.96.2020.07.16.02.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 02:03:56 -0700 (PDT) From: Joris Offouga To: buildroot@buildroot.org Date: Thu, 16 Jul 2020 11:03:49 +0200 Message-Id: <20200716090350.13378-1-offougajoris@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH V2] package/swupdate: Backport fixes X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joris Offouga Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Applied same commit [1] of meta-swupdate for fixes: [2] Shellscript stops before completing [3] diskpart: force kernel to reread partition table [1]: https://github.com/sbabic/meta-swupdate/commit/3fccf23e2816b176075588309e3e4702a318dfc7 [2]: https://github.com/sbabic/swupdate/commit/1078af97a5ac5c3091c8e601b836cd69a7aab7fc [3]: https://github.com/sbabic/swupdate/commit/e3a6b120ff88f6dc34570002de97754b607966ec Signed-off-by: Joris Offouga --- Changed v1-> v2: Add my signed-off-by on the patches ...rce-kernel-to-reread-partition-table.patch | 32 ++++++++++++ ...-Shellscript-stops-before-completing.patch | 52 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 package/swupdate/0001-diskpart-force-kernel-to-reread-partition-table.patch create mode 100644 package/swupdate/0002-Shellscript-stops-before-completing.patch diff --git a/package/swupdate/0001-diskpart-force-kernel-to-reread-partition-table.patch b/package/swupdate/0001-diskpart-force-kernel-to-reread-partition-table.patch new file mode 100644 index 0000000000..81e26a1797 --- /dev/null +++ b/package/swupdate/0001-diskpart-force-kernel-to-reread-partition-table.patch @@ -0,0 +1,32 @@ +From 305a7a5a74a612801d9df2b2efc86dd952b8c4e7 Mon Sep 17 00:00:00 2001 +From: Stefano Babic +Date: Tue, 9 Jun 2020 13:58:06 +0000 +Subject: [PATCH 1/2] diskpart: force kernel to reread partition table + +After writing a partition table to disk, the kernel should be informed +(like the partconf tool does), else it is not possible to install images +in the new created partitions. + +Signed-off-by: Stefano Babic +Signed-off-by: Joris Offouga +--- + handlers/diskpart_handler.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c +index 16adc17..372412b 100644 +--- a/handlers/diskpart_handler.c ++++ b/handlers/diskpart_handler.c +@@ -273,7 +273,8 @@ static int diskpart(struct img_type *img, + /* + * Everything done, write into disk + */ +- ret = fdisk_write_disklabel(cxt); ++ ret = fdisk_write_disklabel(cxt) | ++ fdisk_reread_partition_table(cxt); + + handler_exit: + if (fdisk_deassign_device(cxt, 0)) +-- +2.25.1 + diff --git a/package/swupdate/0002-Shellscript-stops-before-completing.patch b/package/swupdate/0002-Shellscript-stops-before-completing.patch new file mode 100644 index 0000000000..0d38b8bb57 --- /dev/null +++ b/package/swupdate/0002-Shellscript-stops-before-completing.patch @@ -0,0 +1,52 @@ +From bd08e45d7b25f06da2fc6dc824146b471db5f1f4 Mon Sep 17 00:00:00 2001 +From: Stefano Babic +Date: Tue, 16 Jun 2020 10:29:55 +0200 +Subject: [PATCH 2/2] Shellscript stops before completing + +Commit 8fb94d7 reworks the way shell script are called, redirecting +stdout and stderr to SWUpdate. A shell script runs then in a child +process. Under some circumstances, SWUpdate closes the forked process +before the child process completes. + +Be sure that the child process has terminated before to go on. + +Signed-off-by: Stefano Babic +Reported-by: Piotr Piwko +Tested-by: Piotr Piwko +Signed-off-by: Joris Offouga +--- + core/pctl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/core/pctl.c b/core/pctl.c +index 8b1c667..01ad540 100644 +--- a/core/pctl.c ++++ b/core/pctl.c +@@ -263,6 +263,7 @@ int run_system_cmd(const char *cmd) + } + } else { + int fds[2]; ++ pid_t w; + + close(stdoutpipe[PIPE_WRITE]); + close(stderrpipe[PIPE_WRITE]); +@@ -276,7 +277,6 @@ int run_system_cmd(const char *cmd) + * and from stderr (of the child process) as ERROR + */ + do { +- pid_t w; + int n1 = 0; + struct timeval tv; + fd_set readfds; +@@ -373,7 +373,7 @@ int run_system_cmd(const char *cmd) + } + } + } while (ret > 0 && n1 > 0); +- } while (!WIFEXITED(wstatus)); ++ } while (w != process_id); + + close(stdoutpipe[PIPE_READ]); + close(stderrpipe[PIPE_READ]); +-- +2.25.1 +