From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 560CE25803; Fri, 14 Nov 2025 13:08:47 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 6B6892577C; Fri, 14 Nov 2025 13:08:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) by atuin.qyliss.net (Postfix) with ESMTPS id 1D17E25777 for ; Fri, 14 Nov 2025 13:08:43 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 57F417A00BA; Fri, 14 Nov 2025 08:08:41 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Fri, 14 Nov 2025 08:08:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1763125721; x=1763212121; bh=zNeJcB0fY9 5uEfVpN5t+C+iYHCnQoNv+pahLyYkPmpo=; b=FFEhfREU0DcHJXlkNZ8UwCSkPo K+Mw4ov7NzV6N/W3ZnOaPSh3ZTxld3U7p3SKkbfYDvErrGbuc0c0sAo5MGEdD714 DrVFdH2UckvElZH+s0c6EjEW83wy1BhMRTXn34NfkrpQoR2hrra4xUHXyARVN78V z3K/kGjX+JKRFsVerKp2gGjgzh4drvSwQ9y2i3iom84ntS7KO1UZ67gDxUcquDUv BvefEkPMm+OkRb0eYzFdvcAYMmWgyXrJdR32XgkKk/f/ySYda6nQYP1ajF0H9+LJ K2KyaRT8XoHwxizun+S5xWyZCYFuSpali43zP2hBUtDeCLGnYDxdnbnRPGRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1763125721; x=1763212121; bh=zNeJcB0fY95uEfVpN5t+C+iYHCnQoNv+pah LyYkPmpo=; b=BL8FaaNgL9+oO6XPBv/0MZk1QaXKvzCv2IgDGXPV2Bck95dShV1 NnELcoL0Fd6ZJr/R4RomNHPr4dmZSnp9TIKf2YIVnrp/2EqBiky98IbMsYP/eaie efkGi/C5Q1D6hfULKUOPLMO8hq2uPWQlAlumpcxN9zeFYPC7IGfnS9ttJZ1/oQ+r dcyudnR1ANqGubPa5qX8zav+nZ1GFUhRS5TR+P3yFCRWsoxjH1kvXbbsd1dJilxc b5y6vVSHbUTUFYWZqs7VyhJjyhggapTBtZbPoSj/cKb/3FAJE1c4wcXD7qlopEXj hC+iLPyyskVVOxk97tuZehkLrSZ4hZeuB1w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvtdelledtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkgggtsehgtderredttddtnecuhfhrohhmpeetlhihshhsrgcu tfhoshhsuceohhhisegrlhihshhsrgdrihhsqeenucggtffrrghtthgvrhhnpeeiudffue eilefgtefgtddttdekkeehkefgheekudefveetgeefiefftedvteeuveenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehhihesrghlhihsshgrrd hishdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohep uggvmhhiohgsvghnohhurhesghhmrghilhdrtghomhdprhgtphhtthhopeguvghvvghlse hsphgvtghtrhhumhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Nov 2025 08:08:40 -0500 (EST) Received: by mbp.qyliss.net (Postfix, from userid 1000) id CAD0969893D0; Fri, 14 Nov 2025 14:08:39 +0100 (CET) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH v2 3/8] tools: Add directory checker for updates In-Reply-To: <1741e796-734a-4c9d-af87-78b573210ace@gmail.com> References: <20251112-updates-v2-0-88d96bf81b79@gmail.com> <20251112-updates-v2-3-88d96bf81b79@gmail.com> <87h5uygjax.fsf@alyssa.is> <87cy5lbymk.fsf@alyssa.is> <1741e796-734a-4c9d-af87-78b573210ace@gmail.com> Date: Fri, 14 Nov 2025 14:08:38 +0100 Message-ID: <87bjl4rcbt.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: GVVP6SJ7QNK7EIUVJDINSLX5N67YCP4Z X-Message-ID-Hash: GVVP6SJ7QNK7EIUVJDINSLX5N67YCP4Z X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Spectrum OS Development X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > On 11/13/25 13:01, Alyssa Ross wrote: >> Demi Marie Obenour writes: >>=20 >>> On 11/13/25 08:21, Alyssa Ross wrote: >>>> Demi Marie Obenour writes: >>>> >>>>> + if (entry->d_name[0] =3D=3D '.') >>>>> + if (len =3D=3D 1 || (len =3D=3D 2 && entry->d_name[1] =3D=3D '.')) >>>>> + continue; >>>>> + unsigned char c =3D (unsigned char)entry->d_name[0]; >>>>> + if (!((c >=3D 'A' && c <=3D 'Z') || >>>>> + (c >=3D 'a' && c <=3D 'z'))) >>>>> + errx(EXIT_FAILURE, "Filename must begin with an ASCII letter"); >>>> >>>> Would the comparison not be valid without the cast? >>> >>> It would be in this case, but the subsequent cast to int in the error >>> path assumes that the cast was done. Signed characters are much >>> trickier and casting to unsigned makes the code easier to reason about. >>=20 >> Is it safe to assume 'A' etc. are representable and comparable as >> unsigned values? (I'm sure it is in practice, but I'd like it if I >> could be confident this is being done strictly correctly.) > > I don't know if the C standard requires it, but we assume it. Is it a safe assumption, at least on all Linux architectures? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaRcp1gAKCRBbRZGEIw/w ogxuAP49y/2hNhbvp6JIkdALsVB93ah5wKLt87hOB3WpEQU/XAEAvgusYapAXXFh 3TzrNWMlsl2gApo3clyivMLyCLpU2wA= =s7sU -----END PGP SIGNATURE----- --=-=-=--