| Message ID | 20241219100411.356551-2-Michael.Glembotzki@iris-sensing.com |
|---|---|
| State | Accepted |
| Headers | show
Return-Path: <swupdate+bncBDY5JUXLVIEBBCHBR65QMGQEM4HDFRY@googlegroups.com>
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=uoEZ0l44;
dkim=pass (2048-bit key;
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
header.s=20230601 header.b=k1Ot+z9i;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com
(client-ip=2a00:1450:4864:20::33e; helo=mail-wm1-x33e.google.com;
envelope-from=swupdate+bncbdy5juxlviebbchbr65qmgqem4hdfry@googlegroups.com;
receiver=patchwork.ozlabs.org)
Received: from mail-wm1-x33e.google.com (mail-wm1-x33e.google.com
[IPv6:2a00:1450:4864:20::33e])
(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 4YDR7z65qGz1yQN
for <incoming@patchwork.ozlabs.org>; Thu, 19 Dec 2024 21:08:14 +1100 (AEDT)
Received: by mail-wm1-x33e.google.com with SMTP id
5b1f17b1804b1-4362f893bfasf3544125e9.1
for <incoming@patchwork.ozlabs.org>;
Thu, 19 Dec 2024 02:08:14 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1734602890; cv=pass;
d=google.com; s=arc-20240605;
b=dvAFmpstanUkM3TCxnX7OSswBl268ETsCYpjk7UcqrD02errPlzhBWkzXV+pT24Cij
RvnjASeRwu8i48SXrLO/7j9COc8p7/FoR0FvWjlj1rz3ewsqjPnC3Esk6bXvlbqNSxAZ
WT3iddrpQDx8gwjEOTweaFcoc9oxJL4CKa6e97QaYBuvdG+tVzCGlFkkQ3aEs/+jSPGJ
uiaUcLae1Fr4ptQ+d+DpkhlBMiWauoRBArtrxwW8EJqCJ/I6M9lZFWDt0a809jFkfBM0
Ci15fr0P885a0NOB0PsUdPaWiMnd3hcTpWeWb/IGi3B0jYDVDQvMPDP6bBqucicIYeQm
L/6g==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:mime-version:message-id:date
:subject:cc:to:from:sender:dkim-signature:dkim-signature;
bh=YFr4yt4NoVCX9CLHyXV5myKjjYr+GxEbdN5QY7nwFt0=;
fh=sPXt3F8e+rbbZ47/8RMuSFSh/Z4AbB82iyUmwBN2mg8=;
b=c2TxZ/gc0KGv1SrjhBvGfNni+PG8gfN6Xw0IVDFV5hON2WRTQ+qmX7uwgKynzv/Ur9
HuGXzPJigR5RQDNHLaxK5lmPT/W0tn+6EsOEqGn+jXS8MhV65+7qMfDM5yahVDB9rdr1
gSI0D/GqIr5TxUlNfuhO1LcFhMpRbX7th8iQ+XLfVASMbyzbJDbw+jVPAV2eEUfpzDFw
jEdOFF80kDzSS5n8AXI21JWOtMmWShSZ9yfRRGn5U8Rxv+jGP9jaMjN/JuT6U94/bhTd
PxnNloYez7y3xk9zm3YyTfGoedUNbtkgTJdp8QMDZzZ16+7h9u96p4KwtT0B+WQGg1fY
irsw==;
darn=patchwork.ozlabs.org
ARC-Authentication-Results: i=2; gmr-mx.google.com;
dkim=pass header.i=@gmail.com header.s=20230601 header.b=QQ1L96RO;
spf=pass (google.com: domain of m.glembo@gmail.com designates
2a00:1450:4864:20::52d as permitted sender) smtp.mailfrom=m.glembo@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass header.i=@googlegroups.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlegroups.com; s=20230601; t=1734602890; x=1735207690;
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:mime-version:message-id:date:subject:cc:to:from
:sender:from:to:cc:subject:date:message-id:reply-to;
bh=YFr4yt4NoVCX9CLHyXV5myKjjYr+GxEbdN5QY7nwFt0=;
b=uoEZ0l44jEWFcxaS2FVqgoWKqyHG1H52RmuVXh9kYHZFP1Z65vospQo0fMids9ALwq
6dzTy1AGXyAY8Ot4WSslu7K+byroRclif3q90Kw3dhPeH5Cf1AGepi7D/Y+tFyWQiw0x
UCxHsXGWy9HysJbTHcg6wv+Jl9oOrpEsFkkx/XKAOWeB8Q3vupDXJsD1CwvIHHrUWWvv
oZMzPTS1YG2ngZljOdv1Jchi6i6/4ncCKg1908hTH920R6B+zf1HwwezlK8uUPnc3rT9
q/Gq8T4Y2CT6/V0PgSvTfQqfuGtTLGaQOAwS4c2rDFn2uUHtsM02w4KWFnAiqJRMCOJ+
yz1A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1734602890; x=1735207690;
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:mime-version:message-id:date:subject:cc:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=YFr4yt4NoVCX9CLHyXV5myKjjYr+GxEbdN5QY7nwFt0=;
b=k1Ot+z9i5uxAOF6ANqJT3ynkeKSOvxovMcz83rGVS3Jd2kp3CZ8vh129UmD3J0I7IP
ZNPb+arBHdOtxYchQ7HkS4763fJBngWBJrE38dnuJgnhpfxvb2W7dAOo36ZmbkfkmIw7
aNZtuvQRBaqFsoqSx8Va8kXSRlXwmo7JtmsfEfn9qTUe1GrpSAikYRk+gpVYR0Ue2b78
RJFI8RdhlMpnmoGbjsvB8DDqZc1sOycNIxWMbiJwP3SbMUL6/GWsNSYp1M8IxshpaR39
MrF8aPINAqPzJ0bZKQNvYcM/hu2EduKo0umEUdFDk0+iiiwehbwRJPNLvg7YdllZoQCG
Me1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1734602890; x=1735207690;
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:mime-version
:message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state
:sender:from:to:cc:subject:date:message-id:reply-to;
bh=YFr4yt4NoVCX9CLHyXV5myKjjYr+GxEbdN5QY7nwFt0=;
b=no0/1jBZVlgQqPXs3HM6W1ZVEoyjlyE2tH7YOKBaTzqSwQLGUrn85gb2ofIDFbKhlW
psBXT4MvgD4dI34TCgUdslSj9ngmoLfE1MmynBSbNSHUiCROT1ga/sFZEcu7w+Ao+irX
MsmP99MfPfgMg3HcUlV7mYK8hPDR6Qk+xEms64KfWUfTOf7q7lQZQkJp7H/nGGqQORyS
66Kp/Bsn57dZ3lgXlWb4Hj4SopU772XCh+cNI+HN/vkwodZ2gvBDpL9vi8OEEGSVf0+v
mh4lXOtjAtLYYgMCgK4TAPm6DY/2uYJXgA4WaW0qwfZc6zuEO9TA6+6rBVOAr6e5AhqI
5Thw==
Sender: swupdate@googlegroups.com
X-Forwarded-Encrypted: i=2;
AJvYcCV5QatHUXucdAStyTOlAOxX5LpOHF9PiTdo3yIHraj+ntGGTBXDKb83+4vD5REZezbstQ1lWuhkYg==@patchwork.ozlabs.org
X-Gm-Message-State: AOJu0Yxi6imRk14dtCioozXsf8rhghguQURF3W6MK5IEMBi4PLpwJ0Y4
BCLXlRYmrFSDXstmQrz6x+gNXqYYPNn2UXdyKhDqDnv9rzHHtsSw
X-Google-Smtp-Source:
AGHT+IGgu5uYAda5GsHwmmKOWjDhGECPlAha7KFYD65cgmZ2lHGzEnVaP8GorJWCczcogYreDMvv/g==
X-Received: by 2002:a05:600c:3b1d:b0:434:9fac:b158 with SMTP id
5b1f17b1804b1-43655343012mr51511315e9.1.1734602889738;
Thu, 19 Dec 2024 02:08:09 -0800 (PST)
X-BeenThere: swupdate@googlegroups.com
Received: by 2002:a05:600c:4245:b0:436:2204:3f27 with SMTP id
5b1f17b1804b1-4365c51e341ls3950095e9.2.-pod-prod-08-eu; Thu, 19 Dec 2024
02:08:06 -0800 (PST)
X-Received: by 2002:a05:600c:1d15:b0:434:f609:1afa with SMTP id
5b1f17b1804b1-436553430bbmr56427785e9.4.1734602886535;
Thu, 19 Dec 2024 02:08:06 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1734602886; cv=none;
d=google.com; s=arc-20240605;
b=g9/+zUS8TfiIciJAz+NkdXef7BVis5ICTJUd33JlVHBCpvmpxkAIZhx5YBDV/ALHQ+
JMmV6hxgdbwjhQ0odMuJB1I/927HBG0DRL9dKEm8qKQAbcfcgrRSqeqlAVwjEQItqps+
ScBI9kwybs1EJSA6Xkysg9edzE2U2PBpu2Dl4T1NF5W8ddwX0SCvPmvn4uY2wbVp61Qw
eUjNcCG03s5UxTS5kEH/mG1LzsFcnqmfK9wN60CS7S2DVRjFDlFy4vfPUDDmu70A8jSu
zqKQqtJOcpMhO4bA8EI1oQDDh2GGj5nsKR49YA1NQd8OBI3bgH2Yztxuo0bZbxtY83jg
VKPg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:dkim-signature;
bh=3/bOCK8BgCIVZ//uM1ZuFZpQXCe7pYO94KJVwn6ZxWE=;
fh=zydHuzCQWrku2OPQyZfraJZFcOpEXLQ/YBcu3QNiBd0=;
b=JJY7e2z8AydpqQswxBv4sQULnd5v/gOQjvOwtQ6A7xuHib2b+IqMQndmUGLG3PLwdZ
g+AzQY1IhhBLEdEw2f0TxZw7hESieJ2Aw8aESNoqMr0kd29u/92KkzTrMSpJSzvKtkwc
cJ9oPyOZIL7skRxgxlIa/vNeK4Bax/GJS2DNeNZq47azT7zMPTz5qcR95Wv4+kMHINYt
IJr6n6XbzZ43AQaz4/sM+KKGL8kGyFuG8pD5n6Cbif+qSmo8tOaixocdRsLETwU5+m+P
Koc3B1vrnD8B+BxHZSQcoRsmchTweLEbRPqQNt56a0mSgDhn/SaXYw6agTLjhIgJnQzS
L3jg==;
dara=google.com
ARC-Authentication-Results: i=1; gmr-mx.google.com;
dkim=pass header.i=@gmail.com header.s=20230601 header.b=QQ1L96RO;
spf=pass (google.com: domain of m.glembo@gmail.com designates
2a00:1450:4864:20::52d as permitted sender) smtp.mailfrom=m.glembo@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass header.i=@googlegroups.com
Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com.
[2a00:1450:4864:20::52d])
by gmr-mx.google.com with ESMTPS id
5b1f17b1804b1-4364a376b54si4375695e9.0.2024.12.19.02.08.06
for <swupdate@googlegroups.com>
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Thu, 19 Dec 2024 02:08:06 -0800 (PST)
Received-SPF: pass (google.com: domain of m.glembo@gmail.com designates
2a00:1450:4864:20::52d as permitted sender) client-ip=2a00:1450:4864:20::52d;
Received: by mail-ed1-x52d.google.com with SMTP id
4fb4d7f45d1cf-5cecbddb574so898126a12.1
for <swupdate@googlegroups.com>; Thu, 19 Dec 2024 02:08:06 -0800 (PST)
X-Gm-Gg: ASbGncu4ibaWpQzWiO4D+IWfZ/YUWMF8BWnTrCQVNYHuBa41AoovtzQzhxVLwsdYq+f
VoOt4b6Exv2Y3Ai053HBifOwvGya1F8Ho40ht21DIsacPkf9BKaNEWxntmj66M3/86jTzpG5LW/
dYDyQaONOKAumJDWN2O8gu0oB+ib3BEoouOQP/HUadCG30B5/3VIbFaZ70i/x8pJRvEyf16OMsY
rRVeTvzIpg9oJJzSKyuNXZ17M6QIEFUVQslTSalKzFFOKH1T0UZ1vS1/pRqpguKCMOxev5sXsX+
cw==
X-Received: by 2002:a05:6402:528f:b0:5d0:e73c:b7f2 with SMTP id
4fb4d7f45d1cf-5d7ee3a2916mr6234675a12.7.1734602885413;
Thu, 19 Dec 2024 02:08:05 -0800 (PST)
Received: from PC-2635.irisgmbh.local ([2a02:8108:96c0:76fc::6dc7])
by smtp.gmail.com with ESMTPSA id
4fb4d7f45d1cf-5d80701c94csm480881a12.85.2024.12.19.02.08.04
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 19 Dec 2024 02:08:04 -0800 (PST)
From: Michael Glembotzki <m.glembo@gmail.com>
To: swupdate@googlegroups.com
Cc: Michael Glembotzki <Michael.Glembotzki@iris-sensing.com>
Subject: [swupdate] [PATCH] BUG: util: Append missing slash to temporary mount
dir
Date: Thu, 19 Dec 2024 11:04:11 +0100
Message-ID: <20241219100411.356551-2-Michael.Glembotzki@iris-sensing.com>
X-Mailer: git-send-email 2.47.1
MIME-Version: 1.0
X-Original-Sender: m.glembo@gmail.com
X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass
header.i=@gmail.com header.s=20230601 header.b=QQ1L96RO; spf=pass
(google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52d
as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass
(p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass header.i=@googlegroups.com
Content-Type: text/plain; charset="UTF-8"
Precedence: list
Mailing-list: list swupdate@googlegroups.com;
contact 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>,
<mailto:swupdate@googlegroups.com>
List-Help: <https://groups.google.com/support/>,
<mailto:swupdate+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/swupdate
List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>,
<mailto:swupdate+subscribe@googlegroups.com>
List-Unsubscribe:
<mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,
<https://groups.google.com/group/swupdate/subscribe>
|
| Series |
BUG: util: Append missing slash to temporary mount dir
|
expand
|
diff --git a/core/util.c b/core/util.c index 32104279..da3e815b 100644 --- a/core/util.c +++ b/core/util.c @@ -873,6 +873,7 @@ char *swupdate_temporary_mount(tmp_mountpoint_t type, const char *device, const char *mountpoint; const char *dir; int ret = 0; + unsigned int len; if (type != MNT_SCRIPTS && type != MNT_DATA && type != MNT_BOOT_SCRIPTS) return NULL; @@ -883,10 +884,13 @@ char *swupdate_temporary_mount(tmp_mountpoint_t type, const char *device, const } dir = mount_points[type]; - if (asprintf(&mountpoint, "%s%sXXXXXX", get_tmpdir(), dir) == -1) { + len = strlen(get_tmpdir()) + strlen(dir) + 8; /* 6 times X, / and \0 */ + mountpoint = (char*) calloc(len, sizeof(char)); + if (!mountpoint) { ERROR("Unable to allocate memory"); return NULL; } + snprintf(mountpoint, len, "%s%sXXXXXX", get_tmpdir(), dir); if (!mkdtemp(mountpoint)) { TRACE("Unable to create a unique temporary directory %s: %s", @@ -904,6 +908,8 @@ char *swupdate_temporary_mount(tmp_mountpoint_t type, const char *device, const return NULL; } + mountpoint[len-2] = '/'; + return mountpoint; }
The raw_handler requires a slash between the mountpoint and the file path. Otherwise, no correct mount is performed, and the file is saved to the wrong location. [TRACE] : SWUPDATE running : [install_raw_file] : Installing file fitimage.itb.signed on /tmp/datadst/UEE6x2fitImage.signed Fixes: 5d57a9c05ec2 (util: introduce generic mount helpers) Fixes: aff67cdb2c62 (Make use of introduced swupdate_temporary_(u)mount) Signed-off-by: Michael Glembotzki <Michael.Glembotzki@iris-sensing.com> --- The bug is pretty bad because, for example, it caused parts of the update (e.g. for us the kernel fitimage) to not be installed. I could imagine that some systems would not boot as expected. Only the raw_handler has been tested. Other handlers, such as rdiff, btrfs, archive, delta, could also be affected and should be explicitly tested. core/util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)