From patchwork Thu Jan 11 15:43:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1885689 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=cJeSI/mj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::53a; helo=mail-ed1-x53a.google.com; envelope-from=swupdate+bncbaabbd4zqcwqmgqe37pkjkq@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-ed1-x53a.google.com (mail-ed1-x53a.google.com [IPv6:2a00:1450:4864:20::53a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T9ppr6t3xz1yPf for ; Fri, 12 Jan 2024 02:43:15 +1100 (AEDT) Received: by mail-ed1-x53a.google.com with SMTP id 4fb4d7f45d1cf-556c60c7eb8sf2326036a12.0 for ; Thu, 11 Jan 2024 07:43:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704987792; cv=pass; d=google.com; s=arc-20160816; b=hdyE/lBvCdrBJhF/Hwe3om+5BnJJkhUMGf/CHyfx6Zoh9FDbCYsO+tk6fNyL1rGc0O 6u9xqz9ljeQGQ5NwQGZ8CCUlTGEnADFh624/l019VZm4c4UoThbl31MQlxvvYJBhlKtB YzOnW0YAO2Z2CFIp3vqWWUHlP/rH9WDHvkDF+DrAgFuzvRTSnmu79ojs9OAHa4TTlSeJ h29GAz+fPOqhg222STz5CBoBp60QxP3iDbt4hcOVD95qDtXtQKqOsDSEyl/ecoGKb+dF WburKVxA+OlEx05QoEH28USkHYgbMIxdEfplOAwplERB/yKiGFMIJTEop69mrZHlygEU c1DA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=3JVlXvwCc+hxprs9/qD4fPQeUgcAttPzpc5rn+Se8uU=; fh=BeBIh3RcaIvLvchNldgBWZyKgRnQIUIPJvMX5Pb5emE=; b=DLuWaY0M3z5EWuhAlehQF/7/A8wignznvFE2gxlrHLwbSgtgirO/Xc1RwE63KZ4HcT QD1xe9s0VD9KTdD9xBfiLNxQrotqlHlWmVN2FMMRuE88zb+pq6sTOdYwV9I1XjlFSqw5 W1zRMPniSB4aWzcv/o7Eq644X+FhwY+CxqvBU+ugXCn2icVPJ6S0aUj6j3AUVd/rF1dk hj5j+KZYjzrCDabWFp79PmHXH+2Tva82V8BQuvjM3P8OsX9+M8ST7D1M7WWk53hp03fL 0UO8kcurfeNTWXSYs0G5O5EWahvrmNkJT9DdzemeDzG82c5rs3kduMbjdMl4W+HI24Pe vsyg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1704987792; x=1705592592; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=3JVlXvwCc+hxprs9/qD4fPQeUgcAttPzpc5rn+Se8uU=; b=cJeSI/mjp57zVMYx7RtQ78NsWJRwCblmnw+W8lfskXq/q2eq3M4F4757HSaO5IgLX8 4WAIWwAtBXyYGgssWX25NRByve3ZkluzBSkHd3SuQT7iPkjbi8f/GBVNMofVXvGNOA+H 9+VHhCwvBb7Ytljt63bsU4tbTvPwPYXtG08T5rgERhB23me7Huc/czRYzi7e1eaBCOZp X7s+y940O9sc5RrP3muEhlFxkjVCRscIm0VRFDDj0xbC29UqmYwtisWzPJToYXabRTki PmcgeKnGgkdT0NdotXGsJFDlyLx0MyXzbVp+ktzhgDChreHVRwzcyXWk5sAwNuIJmz4c 4Xyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704987792; x=1705592592; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=3JVlXvwCc+hxprs9/qD4fPQeUgcAttPzpc5rn+Se8uU=; b=lgtigABerjbHchEFBDyRXkUBOUfmVQOT3YFMDuT1KMmBAmNE40UVRBe//hEbVbFroQ O2gpIL1MjTadoVlOa4ikKpRwH/2FGrsQNUF55J7XfSZR1RwEf8Aj/tt4c4J2XmijYJto 10Avt4WJFjuq3XaxnzK+CaPjcUZPzM8XlgevgSYLIv1Fq5Li5UHv/op5tB9rgmbwk/ha rVS1QbHSlaiVcecUP1fHFmINETTWtzmTmvFcKie0nzpfizW/3bsxFN/uR6d5IrwponkW zPEQrSyPtLXUwX8DWblcrQD/MBd14q6Ziv8ujkmiZ1nxxkUEzcS7ma4WWXTIZvvI9aek fmPg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0YwBm3y18SMjHf4hDaASW+vD/pdZLB50g29lcrTJ74Mu5jaK+P5P FVkBEgCASru+/EBQpGNqmbg= X-Google-Smtp-Source: AGHT+IFYtvPyEXVdbx1TgXhhywnDeTk0vMWa/wz4vVann1rnzzQHL1MsLn2pOMvRv7C/tsq9IVCp3A== X-Received: by 2002:a05:6402:2794:b0:558:40b:8987 with SMTP id b20-20020a056402279400b00558040b8987mr950128ede.16.1704987791701; Thu, 11 Jan 2024 07:43:11 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:5212:b0:554:3e24:fff8 with SMTP id s18-20020a056402521200b005543e24fff8ls631342edd.2.-pod-prod-05-eu; Thu, 11 Jan 2024 07:43:09 -0800 (PST) X-Received: by 2002:a50:fb10:0:b0:557:1a2f:c8f7 with SMTP id d16-20020a50fb10000000b005571a2fc8f7mr752143edq.37.1704987789544; Thu, 11 Jan 2024 07:43:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704987789; cv=none; d=google.com; s=arc-20160816; b=hnda1UHFM3Y7NNk03xe24+Dr2bw1zOtdUj+7F8VX+LgcdUZZBlZ7Ws1aiFIBcWFHsp k3QFugll1z4nzIU7zKgt+cwi/craYFxM7sY3f5yjYmwZWhR9Z6tvNdN6YKeA1Wuyy/dF fp1+2oGE3bOQQzB6GnqJoluX/vZaJyIATdInZ0X3hjJP3nFKR1lRKLOaCs9Tuy8cQwIr YV8LgBq0gCQ5T1gBuI7x0rl5ok2wwLp3V9Um2kes1CMpyFhs/2DCAYAfJMDPz57MmajL YPnmVZ9ya/kVdqssqHXCeageNjFKTK4vu81F6Oz5fhwWsb8/RGXpHDMGUPVi+PrpE9WC C1dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=YoICaJlF9YZ7ze0Mf5Lvtw5WIxnHzxdOoaiTu6PH2/0=; fh=BeBIh3RcaIvLvchNldgBWZyKgRnQIUIPJvMX5Pb5emE=; b=ZZxengi9LMpJ+yOCnMIJScPXPMItb60INqLpphSgCCsXQYeHkRe9cmT1D5Hr0OIMKV Fwu+Hj68G86eOa/zjGSjC+YAgnGgsveQ4BXIuEhD+E+4IjYp/xhWQUK23izKahuRqBEx Dv3lzvYJ+i1hdT4ddy4i84Jzwo75Z28iKh34tE68A7SivYIgHXs1jnw4HtZFoEwKUzkr KLiwQiaMtJnO3QYNvzT94Jn6E0bm+Y14e3Dh+t7dJAVUYHIpI+tPml73e9uHV7WCnYbU FsNgQe+BVZkxdCXAQeLfQ+e5FH8w3/mbYQKMSPn7VslNEvbTKUMCTys/YQnnkyJ6cAt5 q2mw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.10]) by gmr-mx.google.com with ESMTPS id b15-20020a50cccf000000b0055535b942ebsi88763edj.0.2024.01.11.07.43.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 07:43:09 -0800 (PST) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) client-ip=212.227.17.10; Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1Mqrjz-1qkoyz3ojR-00mpkF; Thu, 11 Jan 2024 16:43:08 +0100 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic , Michael Glembotzki Subject: [swupdate] [PATCH 2/2] BUG: post-update command is no longer called from mongoose interface Date: Thu, 11 Jan 2024 16:43:05 +0100 Message-Id: <20240111154305.668188-3-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240111154305.668188-1-stefano.babic@swupdate.org> References: <20240111154305.668188-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:9fLZI8Vp2xqUKt4E0bP5vx66c6I5OPFY5r9UfRjOwbMXxP7RW6m Vo0uwdVgfgX68Ydy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Qe6ZM7ocbtbZFawn/ R+tNyMf+rRO3dpdLn/egvmnjoBHHWQ0Rcr7o= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , post-update is not called anymore. Reason are commit 8fccd13 and d116870 because they force the source of an update independently from the real source. The source for an update is set when a install request is sent and cached into core. The progress interface must retrieve the source and be stateless for it. Signed-off-by: Stefano Babic Reported-by: Michael Glembotzki --- core/notifier.c | 5 ++--- core/progress_thread.c | 9 ++++----- corelib/channel_curl.c | 2 +- include/progress.h | 2 +- mongoose/mongoose_interface.c | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/core/notifier.c b/core/notifier.c index 15220605..aec7a139 100644 --- a/core/notifier.c +++ b/core/notifier.c @@ -352,7 +352,6 @@ static void progress_notifier (RECOVERY_STATUS status, int event, int level, con { int dwl_percent = 0; unsigned long long dwl_bytes = 0; - sourcetype source = SOURCE_UNKNOWN; (void)level; /* Check just in case a process want to send an info outside */ @@ -360,8 +359,8 @@ static void progress_notifier (RECOVERY_STATUS status, int event, int level, con return; if (event == RECOVERY_DWL && - (sscanf(msg, "%d-%llu-%d", &dwl_percent, &dwl_bytes, (int *)&source) == 3)) { - swupdate_download_update(dwl_percent, dwl_bytes, source); + (sscanf(msg, "%d-%llu", &dwl_percent, &dwl_bytes) == 2)) { + swupdate_download_update(dwl_percent, dwl_bytes); return; } diff --git a/core/progress_thread.c b/core/progress_thread.c index 161d2f61..fff16f51 100644 --- a/core/progress_thread.c +++ b/core/progress_thread.c @@ -107,7 +107,7 @@ static void send_progress_msg(void) } } -static void _swupdate_download_update(unsigned int perc, unsigned long long totalbytes, sourcetype source) +static void _swupdate_download_update(unsigned int perc, unsigned long long totalbytes) { /* * TODO: totalbytes should be forwarded correctly @@ -117,7 +117,6 @@ static void _swupdate_download_update(unsigned int perc, unsigned long long tota pthread_mutex_lock(&pprog->lock); if (perc != pprog->msg.dwl_percent) { pprog->msg.status = DOWNLOAD; - pprog->msg.source = source; pprog->msg.dwl_percent = perc; pprog->msg.dwl_bytes = totalbytes; send_progress_msg(); @@ -161,7 +160,7 @@ void swupdate_progress_update(unsigned int perc) pthread_mutex_unlock(&pprog->lock); } -void swupdate_download_update(unsigned int perc, unsigned long long totalbytes, sourcetype source) +void swupdate_download_update(unsigned int perc, unsigned long long totalbytes) { char info[PRINFOSIZE]; /* info */ @@ -175,13 +174,13 @@ void swupdate_download_update(unsigned int perc, unsigned long long totalbytes, * and decode them in the notifier, in this case * the progress_notifier */ - snprintf(info, sizeof(info) - 1, "%d-%llu-%d", perc, totalbytes, source); + snprintf(info, sizeof(info) - 1, "%d-%llu", perc, totalbytes); notify(PROGRESS, RECOVERY_DWL, TRACELEVEL, info); return; } /* Called by main process, emit a progress message */ - _swupdate_download_update(perc, totalbytes, source); + _swupdate_download_update(perc, totalbytes); } void swupdate_progress_inc_step(const char *image, const char *handler_name) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index 33dbbd7f..35f7f37f 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -463,7 +463,7 @@ static int channel_callback_xferinfo(void *p, curl_off_t dltotal, curl_off_t dln DEBUG("Downloaded %d%% (%zu of %zu kB).", percent, (size_t)dlnow / 1024, (size_t)dltotal / 1024); - swupdate_download_update(percent, dltotal, data->source); + swupdate_download_update(percent, dltotal); return 0; } diff --git a/include/progress.h b/include/progress.h index de680f47..64fa23d7 100644 --- a/include/progress.h +++ b/include/progress.h @@ -24,6 +24,6 @@ void swupdate_progress_end(RECOVERY_STATUS status); void swupdate_progress_done(const char *info); void swupdate_progress_info(RECOVERY_STATUS status, int cause, const char *msg); -void swupdate_download_update(unsigned int perc, unsigned long long totalbytes, sourcetype source); +void swupdate_download_update(unsigned int perc, unsigned long long totalbytes); void *progress_bar_thread (void *data); diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 4b61acb1..39dca711 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -584,7 +584,7 @@ static void upload_handler(struct mg_connection *nc, int ev, void *ev_data, break; } - swupdate_download_update(0, mp->len, SOURCE_WEBSERVER); + swupdate_download_update(0, mp->len); if (swupdate_file_setnonblock(fus->fd, true)) { WARN("IPC cannot be set in non-blocking, fallback to block mode"); @@ -637,7 +637,7 @@ static void upload_handler(struct mg_connection *nc, int ev, void *ev_data, percent = (uint8_t)(100.0 * ((double)fus->len / (double)mp->len)); if (percent != fus->percent) { fus->percent = percent; - swupdate_download_update(fus->percent, mp->len, SOURCE_WEBSERVER); + swupdate_download_update(fus->percent, mp->len); } fus->last_io_time = mg_millis();