Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp344125lqc; Thu, 7 Mar 2024 21:41:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUveVU4oJnRCOCBdo0csg8KYNWTW2lpnXP9YtZv8BHH+qN4xHYCI/OMIx6DjShEtkv0j1yJ/oWFBPfivo3PzFYsBcwhiP+0j81OvtnRJg== X-Google-Smtp-Source: AGHT+IHLh315696fQ2DsZ/sMmNmS8tR8dRLZX4skMso7kR5SJtKqd7BGAl9XdcC7PNREyfW42u0o X-Received: by 2002:a17:90b:ed4:b0:29b:9a12:c9eb with SMTP id gz20-20020a17090b0ed400b0029b9a12c9ebmr2763216pjb.25.1709876519393; Thu, 07 Mar 2024 21:41:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709876519; cv=pass; d=google.com; s=arc-20160816; b=LECANgqDNU1V8hi6DNOxFIdABJEuyBoc0au9TxYfrqmx08uGAmCH3KhyqhlOjydCaA NkjDzzlly4R6fbUs2eUjt2sKbvDV5EspKYH/DEQUSS3ISCFwUoLg5pArDui9OowxYeUk Qeg+8lpGlaTBoAaFxT7DiP55GpXqrUm5Gk0K+qc4uukLD2Q+7yLPVFrT6gDgA+jkZEEM 9LmPvqiWbuiZEPpMGlxDtgpB3//CfS759n+XRnf5+CwIiClRnjRS6W9kb4ctygB51fes NQ1i1qj3hg6bQdmCSJq0Kbzq1q0mw0JQH8n1BUQu9amT7pxrUS6CIHX+Eye2/5RQqJNN aOSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=zw8UV9royTPVlh3Ux/4mrTGUvKQ5r4WD/Dv4PwgWcSA=; fh=Khw71LZ197LTXzVMCmBepzdHBz9wiRTQUszm4F0zqEQ=; b=Qz9cc8h1Ms09QK7UBuigy5kKP84O/DoGFBT2Vxv/oYk7q9GVmYuNKBkU9BT3M5kX00 Qss7B+cpW77ylIYQaa1BloipU4llvpYFYQhBLnmp8Tpqy+5/JReQrBg7U6n2YTaqkpuW njsV3f+uzK6mHf9te67QOkRyAAWQQVpeo5ya48d3OB2aO1yWJipB7rFuN8WHmB8/nFM6 WgBjYik6JWmuMGfjDrXSjffwAsYiuTLoVuE4ZycAHcWEtQKCNm06MEjbm44r250GrcCL PEbZKnzFlVWAaFgfUTrhA3lcUAhGRuxptdHYxdMDcCwQt9+I8Pqc+aLQrPm5VuHZ+cR7 n/sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UuLIWdKA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96539-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cu8-20020a17090afa8800b0029b71a3b84esi3103244pjb.117.2024.03.07.21.41.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 21:41:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96539-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UuLIWdKA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96539-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA7FC281DC1 for ; Fri, 8 Mar 2024 05:41:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B601D364C6; Fri, 8 Mar 2024 05:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UuLIWdKA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3994364A1 for ; Fri, 8 Mar 2024 05:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709876513; cv=none; b=WmtR/EoRXNlOrkaMqygBh+6WqCPdvFkY7j279H3Kmrbzxo/miL5t3me4zrW6Ko24E5X+9vRRbMHnld6qA8b+A4J7U8xatQ1ankOE9AjRj+If2W5nOauCSuCEhkUgrx63jUqwG8oYvfVgs12qF8/YEWaqI27YNpAFlMDl3OcK9BM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709876513; c=relaxed/simple; bh=YY0ngKqwHmUqwvnA4WlChAL0cHrU5iop01IV/D1Icmc=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=W9rJt2757GJJ3amASE6c9YQJKO9JrJjPElrJdK6uGXVrBlmmfUPekalH+DpD9P6JeMtzNpDJNxpskb6SM8TygmJ68Z9YeONJOBLa57KYRgc8wFm4LlqboC2yttWeYzSnMCTqWWMiC8JHSAJ4cunjI5hG6LQjtruSm4/Z/xqbxx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UuLIWdKA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E151C433F1; Fri, 8 Mar 2024 05:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709876512; bh=YY0ngKqwHmUqwvnA4WlChAL0cHrU5iop01IV/D1Icmc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UuLIWdKAa8zcUN4HxBW5lzHPWCaFYsn58FHrIoGLj/7/DMtt6jCMmU0U66+zJuuGY OIb6ziXVPUicx7PTbInbOpwtIBqb16dTeW9VrUBrs+IeXRYnrioU8uqKcGoNI+pC8i NtJpGokO7satK5ho8IeDspYk6JGSqWoPSwQvMR8ACoiJ2F+eKvliE9rAU4/HnEENmE seGpCfM6KjIw7mQCmQvi4ldvItCMx6A0rezbjKl5LhnvPtbBrULReLMtQ1NjJysczo /VsWDTKIrMHu+8rpvmA62LTwmNo/oUYhny2xDpQizg6oPmpG1R6oBaMDPgFKQrvlcQ bP32jzuMPpAww== Date: Fri, 8 Mar 2024 14:41:46 +0900 From: Masami Hiramatsu (Google) To: Rasmus Villemoes Cc: Andrew Morton , Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: Re: [PATCH] bootconfig: do not put quotes on cmdline items unless necessary Message-Id: <20240308144146.7875c1a3092846111c6ca690@kernel.org> In-Reply-To: <40914a69-d4b7-4fdd-bc58-cf9b28271ac3@rasmusvillemoes.dk> References: <20240306122452.1664709-1-linux@rasmusvillemoes.dk> <20240306124211.b490ea3c2372d89cff8c287c@linux-foundation.org> <40914a69-d4b7-4fdd-bc58-cf9b28271ac3@rasmusvillemoes.dk> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 7 Mar 2024 09:18:17 +0100 Rasmus Villemoes wrote: > On 07/03/2024 09.10, Rasmus Villemoes wrote: > > >>> +static int has_space(const char *v) > >>> +{ > >>> + for (; *v; v++) > >>> + if (isspace(*v)) > >>> + return 1; > >>> + return 0; > >>> +} > >> > >> Do we already have something which does this? > > > > Well, 'value[strcspn(value, " \t\r\n")] ? "\"" : ""' would be a > > oneliner, but not particularly readable. Also that list of characters > > doesn't necessarily match isspace(), see below. > > I didn't look close enough. We do have strpbrk(), so strpbrk(value, " > \t\r\n") ? .. : .. , but that still leaves the question of just what set > of characters to search for. But there's no harm in just making it " > \t\n\v\f\r\xa0" except it requires a comment saying "these are precisely > the isspace() characters in the kernel's ctype". I think strpbrk(" \t\r\n") is good enough. Some may not work in cmdline but as you said, since next_arg()@lib/cmdline.c uses isspace() to separate the argument, it is better to use the same rule. Thank you, > > Rasmus > -- Masami Hiramatsu (Google)