{"id":816315,"url":"http://patchwork.ozlabs.org/api/patches/816315/?format=json","web_url":"http://patchwork.ozlabs.org/project/swupdate/patch/20170920153433.15343-1-christian.storm@siemens.com/","project":{"id":58,"url":"http://patchwork.ozlabs.org/api/projects/58/?format=json","name":"swupdate development","link_name":"swupdate","list_id":"swupdate.googlegroups.com","list_email":"swupdate@googlegroups.com","web_url":"https://github.com/sbabic/swupdate","scm_url":"git://github.com/sbabic/swupdate","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170920153433.15343-1-christian.storm@siemens.com>","list_archive_url":null,"date":"2017-09-20T15:34:33","name":"core: don't unlink if final equals temp location","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a5cfd1156afc5b3ba6c12d97379abc559423f785","submitter":{"id":72180,"url":"http://patchwork.ozlabs.org/api/people/72180/?format=json","name":"Storm, Christian","email":"christian.storm@siemens.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/swupdate/patch/20170920153433.15343-1-christian.storm@siemens.com/mbox/","series":[{"id":4152,"url":"http://patchwork.ozlabs.org/api/series/4152/?format=json","web_url":"http://patchwork.ozlabs.org/project/swupdate/list/?series=4152","date":"2017-09-20T15:34:33","name":"core: don't unlink if final equals temp location","version":1,"mbox":"http://patchwork.ozlabs.org/series/4152/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816315/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816315/checks/","tags":{},"related":[],"headers":{"Return-Path":"<swupdate+bncBDD6BWV65QPBBNUWRLHAKGQE54AE4NQ@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=googlegroups.com\n\t(client-ip=2a00:1450:4010:c07::238;\n\thelo=mail-lf0-x238.google.com;\n\tenvelope-from=swupdate+bncbdd6bwv65qpbbnuwrlhakgqe54ae4nq@googlegroups.com;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=\"W+aaFASC\"; dkim-atps=neutral"],"Received":["from mail-lf0-x238.google.com (mail-lf0-x238.google.com\n\t[IPv6:2a00:1450:4010:c07::238])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xy3lZ4D0lz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 01:37:29 +1000 (AEST)","by mail-lf0-x238.google.com with SMTP id x199sf509595lfd.4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 08:37:29 -0700 (PDT)","by 10.25.23.154 with SMTP id 26ls110475lfx.7.gmail;\n\tWed, 20 Sep 2017 08:37:25 -0700 (PDT)","from goliath.siemens.de (goliath.siemens.de. [192.35.17.28])\n\tby gmr-mx.google.com with ESMTPS id\n\tc142si215911wmh.3.2017.09.20.08.37.25\n\tfor <swupdate@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 20 Sep 2017 08:37:25 -0700 (PDT)","from mail2.siemens.de (mail2.siemens.de [139.25.208.11])\n\tby goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v8KFbPQt017182\n\t(version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)\n\tfor <swupdate@googlegroups.com>; Wed, 20 Sep 2017 17:37:25 +0200","from MD1KR9XC.ad001.siemens.net ([139.25.69.251])\n\tby mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v8KFbPuF001227;\n\tWed, 20 Sep 2017 17:37:25 +0200"],"ARC-Seal":["i=2; a=rsa-sha256; t=1505921847; cv=pass;\n\td=google.com; s=arc-20160816;\n\tb=jKNK4nVN4hrQMIWglU6mUW13udYbM/bUSOPb2N/MEaMww+JjV7986wI01tqxEe+sQV\n\tNE/LCk4/5tvZrTyti2j10vDH3JtfSgb/SitoG2+SH9MvDedbA4YbAS7o8U7sYj/LAbCo\n\t0beuqTVrQTlBN2kdJJOX0LHGprdtkpdG4GsWmjAWom6a51IzDrBvJRdng13und0ry0lW\n\tobvtWete4BY/lgPAfghcuDm7PXn6+F9KF1wQa+t7jlo4Z5IgemFL2NUNxxXFHRm8eQt+\n\t+0e53gaBiwJ1wowp939joPOqE1frBT2XC+7XEFmcEbk/SFYViU7YDyp49kEGVDcUO8DH\n\tuT/Q==","i=1; a=rsa-sha256; t=1505921845; cv=none;\n\td=google.com; s=arc-20160816;\n\tb=hZU3VfWpJ5NBgSFpMUQCjAxiMaxGBI+Olmghx3RUPeUX6Meb84K3a1dzEHDEB89Qq4\n\tx6+VXpk9uxj++6LKxHRj/zqgnsjqTskswsavPDKk94VU2drERPMHLfnmgx7MsJS3eZob\n\t05Uj5fhc17lWoRlOXD6Z0FAye2LAxOjO3/046LCFQ+TfqSNSc3D+geOcoxtKcs6wXfkA\n\tHbhuzYRbj4lfCRVcQd0IqhUl3+oX6mhdMiGbmkY9SQHoVK4X94FEdE2jJ3NAjjb9VICg\n\tKu9Iy462voes0j+ZhYbsGZU/AA7v+i4qVmtSLPy8HZbCTL3jb4pezi//vMDLxUw8U8ET\n\ti46w=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n\t:list-id:mailing-list:precedence:message-id:date:subject:cc:to:from\n\t:arc-authentication-results:arc-message-signature:mime-version\n\t:sender:dkim-signature:arc-authentication-results;\n\tbh=N1c0kqaP5H79+eqAqOc05HqzDv6dYvMkzE0ZoVay/u0=;\n\tb=r/TVkLPs8ThL/1gpJOLSsmipw420+VJ28UR2dXXjfccrI/HxD+Q/jyKobvD9jBJ0Aj\n\t26BIdGSReOEtwZUHzhOaPq/F9+K/YwLJAMsPoWcdenFiJY0DjxW5YaC7Tx8LtUpWzKQa\n\t5reTL2xpQ0B033MFO9XpVF5FZm+tNRlw6dVDwwh84oBWAenUIukGPqnw+rlE854tS7hA\n\t5PVC1SzsuxXdcZ9r7S+9Y54kaYFdNuW1z8ubZ9bRNcEKO2tTW2tw40/eDOjV7S17LM8C\n\tWXopi2gLXtXw3QIeUrcqVqgotrpynET3uhvH3+ZsgHwNRZ5I+CByvjXJpbfU3ibzaAkK\n\t5Y0Q==","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=message-id:date:subject:cc:to:from:arc-authentication-results;\n\tbh=2zQlzE9ULavZIdj/tnea9OJfyVhXcZGCEc9tyzYQ1yk=;\n\tb=x8HsHKR89cZUPWDo+rTaerls4fzQ7IERQun2UFBmSddx83rQmKZ2KmC1m+6MQg2Zzs\n\t9WjnEeeTlGGYVEe9oPthEB7pJ4UqxjBT76gufbK5nq7PmWkONVAKx32gdFz8CXoy8FGA\n\tTYertKd5U55LIq4HRdJJgLuWnFU7+IVCF6glWo+iKCS+ImzC2sclDSKvdN0jOzwvwG9F\n\tLmHyJ0vNEiR82svTMW2KF8kQxcn6wB7YuKuGZcmMKGitJIiMAlDtYEJoZi1spzcgNf7r\n\tVRrUB8UJgAf4FC23vOrybILD64rP6kYbihD9DaQDW8ekTOiOATS8lXPxtOQoJS29vSme\n\tnjdg=="],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n\tspf=neutral (google.com: 192.35.17.28 is neither permitted nor denied\n\tby domain of christian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com","i=1; gmr-mx.google.com;\n\tspf=neutral (google.com: 192.35.17.28 is neither permitted nor denied\n\tby domain of christian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20161025;\n\th=sender:mime-version:from:to:cc:subject:date:message-id\n\t:x-original-sender:x-original-authentication-results:precedence\n\t:mailing-list:list-id:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=N1c0kqaP5H79+eqAqOc05HqzDv6dYvMkzE0ZoVay/u0=;\n\tb=W+aaFASCfzHx2mzUU/uMCyBoLOA6UksKo6lnobZyimcmVO4o9+1CNZf4SmMpOrCIMT\n\ty71LHsxIc8HY7GYyvLnJj5nzPAE1HxlWAamp+XNTCAiVPHsjPKupGc7rFO2Tm8OHZFEa\n\tCzOP8Evx95BG1k7nkhltqUwc33rcOz5DsuqA12SpuFNpOaY+ZctN5t28mRSHi7BaycPt\n\tIvBDwH1hxtNg4NprJRRxhj/Lov0rW5PXKBl4r+r6s79y5jZDy3MAIOaDs+Q3CUJ/UgVR\n\tlOc7Elr5+PIBgQF3AphDdMI2V3KFEhTUWj490KHaq8nJSaQTOKHBPaXbg/0sdWevUTd4\n\tEaWA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=sender:x-gm-message-state:mime-version:from:to:cc:subject:date\n\t:message-id:x-original-sender:x-original-authentication-results\n\t:precedence:mailing-list:list-id:x-spam-checked-in-group:list-post\n\t:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=N1c0kqaP5H79+eqAqOc05HqzDv6dYvMkzE0ZoVay/u0=;\n\tb=QU4ghlSOyLy0rCsqaiqEiNx8BBYRYPsOehqOZGtAGkDUnL3TS+HODD7CnDaYz58/I/\n\tPyd2+lUtX2jfwWf2+1ifVizIIIyw0NgEQxycqPdY8OAa1AbRzXw+4BD22ghC5ESxncoe\n\tmxm/rFKM4MEsDeCTA0UuIvZyevrdC/HldcAq1g1IWZgF74zQGVtFowSEHa/ippdY7N+W\n\tkEcj5+68MEAwLh2FS0jozzioDU0y0QSA/mpLELV5+b8Jju9fN3x4rGkgGXfGo3DdEfiC\n\tvD93stojxDDptc7u+dLzA1eu5I+91XoIUTCBqriX5Wk4gHLklo3hw4IseX3x7mlXEW+i\n\t/8KA==","Sender":"swupdate@googlegroups.com","X-Gm-Message-State":"AHPjjUgdUD8YypfKVtHCPPpzt68MZXILx+Otwr5aOekb87ya1SyQOIEa\n\t0BiTmrqDTR8uoNO0J40O2lM=","X-Google-Smtp-Source":"AOwi7QDk8hPAWaS4GpagWUtN64275bA+spDsxOvSDje4s9GtBWmo8EdqW2VymHAMF1rur8Cc+0xuUg==","X-Received":["by 10.25.24.209 with SMTP id 78mr4991lfy.20.1505921847183;\n\tWed, 20 Sep 2017 08:37:27 -0700 (PDT)","by 10.46.101.8 with SMTP id z8mr571473ljb.0.1505921845713;\n\tWed, 20 Sep 2017 08:37:25 -0700 (PDT)"],"MIME-Version":"1.0","X-BeenThere":"swupdate@googlegroups.com","Received-SPF":"neutral (google.com: 192.35.17.28 is neither permitted nor\n\tdenied by domain of christian.storm@siemens.com)\n\tclient-ip=192.35.17.28; ","From":"Christian Storm <christian.storm@siemens.com>","To":"swupdate@googlegroups.com","Cc":"Christian Storm <christian.storm@siemens.com>","Subject":"[swupdate] [PATCH] core: don't unlink if final equals temp location","Date":"Wed, 20 Sep 2017 17:34:33 +0200","Message-Id":"<20170920153433.15343-1-christian.storm@siemens.com>","X-Mailer":"git-send-email 2.14.1","X-Original-Sender":"christian.storm@siemens.com","X-Original-Authentication-Results":"gmr-mx.google.com;       spf=neutral\n\t(google.com: 192.35.17.28 is neither permitted nor denied by domain\n\tof christian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com","Content-Type":"text/plain; charset=\"UTF-8\"","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n\tcontact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n\t<mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n\t<mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/swupdate/subscribe>"},"content":"If the temporary location of an artifact happens to\nbe identical to the final location of the artifact,\nSWUpdate deletes the artifact after installation\n(if CONFIG_NOCLEANUP isn't set, that is).\n\nConsider the following sw-description with default\nTMPDIR=/tmp set:\n\nsoftware =\n{\n    version = \"0.0.1\";\n    files: (\n        {\n            filename = \"dummy.file\";\n            path = \"/tmp/dummy.file\";\n        }\n    );\n}\n\nAfter installation, /tmp/dummy.file will be removed.\nPrevent its removal and issue a warning. Additionally,\nif dummy.file is referenced more than once, issue a\nwarning stating its removal reason.\n\nSigned-off-by: Christian Storm <christian.storm@siemens.com>\n---\n corelib/installer.c | 18 +++++++++++++++++-\n 1 file changed, 17 insertions(+), 1 deletion(-)","diff":"diff --git a/corelib/installer.c b/corelib/installer.c\nindex 8a188a1..6c6271c 100644\n--- a/corelib/installer.c\n+++ b/corelib/installer.c\n@@ -326,7 +326,23 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile)\n \t\t\t\tcontinue;\n \t\t}\n \n-\t\tret = install_single_image(img);\n+\t\tif (strncmp(img->path, img->extract_file, sizeof(img->path)) == 0) {\n+\t\t\tstruct img_type *tmpimg;\n+\t\t\tWARN(\"Temporary and final location for %s is identical, skip \"\n+\t\t\t     \"processing.\", img->path);\n+\t\t\tLIST_REMOVE(img, next);\n+\t\t\tLIST_FOREACH(tmpimg, &sw->images, next) {\n+\t\t\t\tif (strncmp(tmpimg->fname, img->fname, sizeof(img->fname)) == 0) {\n+\t\t\t\t\tWARN(\"%s will be removed, it's referenced more \"\n+\t\t\t\t\t     \"than once.\", img->path);\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tfree(img);\n+\t\t\tret = 0;\n+\t\t} else {\n+\t\t\tret = install_single_image(img);\n+\t\t}\n \n \t\tif (!fromfile)\n \t\t\tclose(img->fdin);\n","prefixes":[]}