From patchwork Fri Nov 20 15:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1403862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33a; helo=mail-wm1-x33a.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbgon376qkgqezslzrni@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=siemens.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=td2lxGas; dkim-atps=neutral Received: from mail-wm1-x33a.google.com (mail-wm1-x33a.google.com [IPv6:2a00:1450:4864:20::33a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cd1M65kN7z9s1l for ; Sat, 21 Nov 2020 02:54:07 +1100 (AEDT) Received: by mail-wm1-x33a.google.com with SMTP id y26sf3148813wmj.7 for ; Fri, 20 Nov 2020 07:54:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1605887642; cv=pass; d=google.com; s=arc-20160816; b=V9A/AjEurnnlD8+aGt5iWPFQOI0c5UKmuVhG/xPGpdknoQHcS+j56lIHCB4ZGE+u25 xtfMPPlCMbtB5oP2zLj5RJ4ymUkOrlxRg7+55lIEN0cg3GYORdBiQAwz2P+7yLgyZRYn 75VoX5neJPTFEGujVEOFAopZR4v1tHuvfss5QtE3j2yzT5aXISnAOp8AuVgXAEu0yYus 3RG6ELoNv4nvQEvYEVaoCJDsM6yBlrY+H4SPiGes4+VsJ4fdH6HujXhyPh/HGSsSkY1y UovKgDrHz3xph4hKQ94czxVhCKAAaxNeU7goZrLXOf3fAIbzfRQVJH4QDSpLrY5w5ZfL 5oKQ== 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:content-transfer-encoding :content-disposition:mime-version:mail-followup-to:message-id :subject:to:from:date:sender:dkim-signature; bh=eayFcNMgS6vypSPWIPToFuYPoRO6LmsT6xVgSAYFaY4=; b=MErttB/YDV/WJ/il575NrmnoEYOSJHHtWSs6nELQFyV2y54gQhjlhnfhwS7Z5Fxpn9 YmK/zShyb2Nah2kcFLwN5x6nYd0kjBI7vci7ZDWrdJuBGKWy1d5T6EMFKXcCkN2bX07V F98RyWOXApWLS4uFYTOUCT7ao5XYhT83MhWxIOa4eUFHwnqp1XbR6lgp6kGadrydlU1T dPfHpBb2BspiBIEDbaUQBNgavl/WHFO0KHhi7oIMF3CunyW467BGJIyd/bkHuIy8UTsm 0dNqt9n2W6d6m40wAz5oDShePsani36g11utbW4oQHgKmIIfHEjmkCZPUrgA9hsCQjHI Q6qQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:content-transfer-encoding :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=eayFcNMgS6vypSPWIPToFuYPoRO6LmsT6xVgSAYFaY4=; b=td2lxGasbRL8nO75Jxz2UYLLoP6PjL3n5YNtJ8ls0+4sXvmwheX6xHj5kLRplSdL+4 z/unxXC7jJYurppmrPzAoAfz5rIS+IHd9IYZRYkVPoX/hvIh0nDiU0sZBU2XydXyowW1 pb5Z2iplzRscARpYzo0Qx6K4Bi+saSYH4r5b8aV9P2jnLbSddayidCzNf1lF2enmTkkm /VuhP5I3EpIyalrEg6udOAN0+3RhXTbg5MYYv6fQg5t8ajfVie63EXTH/X1yulmUYQdh 24aSoN+z7GqD2P1PHi1WWRRlEcRWnhJfc5JgT1NLYbbZH4K2RkxW5wU7996+Qd8c+69B s1Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:subject:message-id :mail-followup-to:mime-version:content-disposition :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=eayFcNMgS6vypSPWIPToFuYPoRO6LmsT6xVgSAYFaY4=; b=n8psbhCcazjNx1nn6vIEV9nlB+EndE0SQXAPpzdJIDDNNoUn4mUBS6Urkm/m2ambk9 7RjBWAiSRhRRcbGCPIAgoSOmASABMY5xJR0/1VAFrXRVALXszeA1jdfOvLZhAJ1Rg68X 3gOocKk6oZfhFsv36t55bDU98sE22lcl/aBl43veEvNOQmoCtj+CbHrw/tHBqAGotGPJ me5X1zSznp/3vtRsd/27Tg0D4v5LbqrFrcaqBRHHCorD4FH4LR/1csfpA13xqX6Q8RyA TvTgpCFWZYG4Yty4HqakxWLcg18IFf0vgfkk0E2miLvJAXXRLIRi/HoxkitWpqRAIYSY Bu+g== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM530J+5P6YgsKjPgHX2uTBJ8XA35Cfn7WwHnztdWXOkwXk+jPqA8m LeY/OfJg6q4tkn75Vjohpss= X-Google-Smtp-Source: ABdhPJzV2BArj0mVzJrqEc4LalfxtepdJeaM64VVZIR8W1YMxl578+VY6DfsC56SmzUx+W72IZkBiQ== X-Received: by 2002:adf:e74d:: with SMTP id c13mr17605209wrn.277.1605887642057; Fri, 20 Nov 2020 07:54:02 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:e5c2:: with SMTP id a2ls4310553wrn.3.gmail; Fri, 20 Nov 2020 07:54:01 -0800 (PST) X-Received: by 2002:adf:94c3:: with SMTP id 61mr17495745wrr.143.1605887640905; Fri, 20 Nov 2020 07:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605887640; cv=none; d=google.com; s=arc-20160816; b=f1hjM9Po4udHGPwZFV67F1LwugdUrx2IWemVNF+vYp/bfy+FF9+WA1zMO7Y7Bmy8TY eUcQ8qyZS61O1LBuFzHzjVEksigSKQi9uOPrYRLTdbsqAhusP/5U4NyDUTx0rHQntOBu xTCas9q6UPve0AYKqjeIhLi1wOeg37Yvv2IIPMcF7ioWZcdemUIltj+moVtghZYtjIZD sq4zQHv9XutnIm5XM30ub9OS6pDfaCOPg5KcUjD+Qw1T34sN9TL2/7HQ5gS6P3dAJpvp 6f5ix95LwmOi2+/04UFzDllaLHMDKjnqD6fJL3KdgZozVdGmvX/jNM7+xkJBKN83GWY1 PkHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-disposition:mime-version :mail-followup-to:message-id:subject:to:from:date; bh=5WsHqKIqbs6zu0uaEsDK6LO9iySIjVIdSzVIyzoPmIc=; b=Dui1oPgnGxirOtKQGQ0N5F78Ezlo9gLfTdn5bofrNUSjZnKH3mO95TxEnbNcsQwaaV rStVz3x0a/68l162sIY/KvpMotlxZQ37fjrblljzgepAqL7xeb24cOvTUT2uCMK9/EE3 u8sIzhkkPtEzezGx56nXTWmEx8aRdxpYMPIYhvAHZT9UxH8Hevu4kZoEt8muOYLiuFHB gV39Yiu5onUbdSTwnya4RB8Ep1SuQFzibFV868fD/0NUC53pVZeh4lYXJu0jXJB1CWWx AwdAdYjMBw1/VQiy881XDhhZYRi7xvxRj9qrJU24VQ39I4pHs3+z0QFIOMnvJ+wp7lkr 4mWA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id 61si120650wrq.0.2020.11.20.07.54.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Nov 2020 07:54:00 -0800 (PST) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id 0AKFs0qw026445 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 20 Nov 2020 16:54:00 +0100 Received: from localhost ([167.87.0.54]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTPS id 0AKFs0Mi015146 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 20 Nov 2020 16:54:00 +0100 Date: Fri, 20 Nov 2020 16:55:25 +0100 From: Christian Storm To: swupdate@googlegroups.com Subject: [swupdate] dry-run mode is broken Message-ID: <20201120155525.hbbgsdh5k23zr5dm@MD1ZFJVC.ad001.siemens.net> Mail-Followup-To: swupdate@googlegroups.com MIME-Version: 1.0 Content-Disposition: inline X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com 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: , Hi Stefano, on current HEAD, the SWUpdate --dry-run option is broken for (at least) the downloader. Running something like: ./swupdate -v -l10 --dry-run -d '-u http://localhost:8080/download/root.swu' does not perform a dry run but an actual installation! With this printf-debugging patch applied If applicable, I can send this as separate patch. Then, one more thing... :) In dry run mode, the BOOTVAR_TRANSACTION and STATE_KEY are also set. I consider this being wrong and can send a patch fixing this if we agree on it being wrong, that is. Kind regards, Christian --- a/core/stream_interface.c +++ b/core/stream_interface.c @@ -504,6 +504,7 @@ void *network_initializer(void *data) /* * Check if the dry run flag is overwritten */ + INFO(">>> dry-run: %s global: %s", req->dry_run ? "true" : "false", software->globals.dry_run == 1 ? "true": "false"); if (req->dry_run) software->globals.dry_run = 1; else you'll see [INFO ] : SWUPDATE running : [network_initializer] : >>> dry-run: false global: true for the above command. This is because the downloader didn't send dry_run in its request and that overrules the global setting. So either the downloader is adapted to send dry_run in its request (meaning it must access the global swcfg) or the dry_run setting logics needs to be overhauled. By the way, software->globals.dry_run is set to the current request's dry_run setting but never reset to its original value prior to the current request. So the current state of SWUpdate's idea of being in dry run mode or not depends on the last request. I do not think this is a good idea in particular for non one-shot modules like suricatta... In addition to that, pre and postupdate commands are run in dry run mode. Is there a reasoning for this? I would rather like to not run them in dry run, as in the following patch: diff --git a/core/installer.c b/core/installer.c index 82b5d60..981a21d 100644 --- a/core/installer.c +++ b/core/installer.c @@ -469,8 +469,12 @@ void cleanup_files(struct swupdate_cfg *software) { int preupdatecmd(struct swupdate_cfg *swcfg) { if (swcfg) { - DEBUG("Running Pre-update command"); - return run_system_cmd(swcfg->globals.preupdatecmd); + if (swcfg->globals.dry_run) { + DEBUG("Dry run, skipping Pre-update command"); + } else { + DEBUG("Running Pre-update command"); + return run_system_cmd(swcfg->globals.preupdatecmd); + } } return 0; @@ -481,8 +485,13 @@ int postupdate(struct swupdate_cfg *swcfg, const char *info) swupdate_progress_done(info); if (swcfg) { - DEBUG("Running Post-update command"); - return run_system_cmd(swcfg->globals.postupdatecmd); + if (swcfg->globals.dry_run) { + DEBUG("Dry run, skipping Post-update command"); + } else { + DEBUG("Running Post-update command"); + return run_system_cmd(swcfg->globals.postupdatecmd); + } + } return 0;