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 C07434C98; Sat, 15 Nov 2025 15:21:02 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id CBD254BFE; Sat, 15 Nov 2025 15:20:58 +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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.149]) by atuin.qyliss.net (Postfix) with ESMTPS id ED2B34BFD for ; Sat, 15 Nov 2025 15:20:56 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 48B4EEC011A; Sat, 15 Nov 2025 10:20:55 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Sat, 15 Nov 2025 10:20:55 -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=1763220055; x=1763306455; bh=BGBKtQSID0 GKKJTR9xGJhPlNOuAtjw7UneU5jwlcQ40=; b=ZDDAdVjsQJTHQp1xYOj2yF30mA RW2FSWqaDByUUo+nBlOaFnrPi7K+J/+hl0u7zgSlPR44DQ5KvuVm2jjjrXpOJ0ZG TSAWlyM8t2pSPWEjj90p8/8PQz/aJlRB02nVJu9mhlqYWu/v8Pusq1lddRQuMjDc MTBvTmhhvkXvJKOs1+XLaIKy58DqbbPXH6fxPxOPQwKJR0xBsX/dAnYrNZBfz+iz 9UYPbmKf5wagOMbcZaynRAPmpEkdsWp9YZPn7Y8PB5yqMErhfFy9Fj5seuT8m37B +EIS6PO/CeFXRKyGijbAQQqpstzboRUrsRqK4+TNy2BcBVK6dUlcMKlGE9cQ== 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= 1763220055; x=1763306455; bh=BGBKtQSID0GKKJTR9xGJhPlNOuAtjw7UneU 5jwlcQ40=; b=pCvsKO1QtkM8bS/UPC9ZLV+mfglXKuQ8K26IyVHv5HVZuuylqcN 2z9pGZJQvMpoYs9Sqs6Bq8t42JHVl2Y0Ua1cKQvYN/SDfXvOYglbb0ULt76RDlcg YozsxBgMT28lVeW4cPf0NNt5dexNQ0vMTr7zSZ657qMQ/AYgcklB+0PTcEuxaY0R IvTLEQuEkRewqnOIx9fSW3+BS32rFy4q+wcS+FyF7uw+We7nNudQ3JH+XhvtB5jP fBIWx/fEcCVrbXugGnEABJvGGFI59SCzD2vSj1vIrbVMa6aH7BAHpBIq3Y0BSdYR e+Ge+5xpV0J+LCqnwjEEuBUdgUUXt0Lq+wA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvudeftdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkgggtsehgtderredttddtnecuhfhrohhmpeetlhihshhsrgcu tfhoshhsuceohhhisegrlhihshhsrgdrihhsqeenucggtffrrghtthgvrhhnpeeiudffue eilefgtefgtddttdekkeehkefgheekudefveetgeefiefftedvteeuveenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehhihesrghlhihsshgrrd hishdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohep uggvmhhiohgsvghnohhurhesghhmrghilhdrtghomhdprhgtphhtthhopeguvghvvghlse hsphgvtghtrhhumhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 15 Nov 2025 10:20:54 -0500 (EST) Received: by mbp.qyliss.net (Postfix, from userid 1000) id ABB18698B0D1; Sat, 15 Nov 2025 16:20:51 +0100 (CET) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH v2 3/8] tools: Add directory checker for updates In-Reply-To: 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> <87bjl4rcbt.fsf@alyssa.is> Date: Sat, 15 Nov 2025 16:20:42 +0100 Message-ID: <87qztz8gqd.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: PDBDSSDE7ZECQTWM22OBQAWFCQDV7XFE X-Message-ID-Hash: PDBDSSDE7ZECQTWM22OBQAWFCQDV7XFE 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/14/25 08:08, Alyssa Ross wrote: >> Demi Marie Obenour writes: >>=20 >>> On 11/13/25 13:01, Alyssa Ross wrote: >>>> Demi Marie Obenour writes: >>>> >>>>> 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 abou= t. >>>> >>>> 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. >>=20 >> Is it a safe assumption, at least on all Linux architectures? > > I believe this assumption is hard-coded into GCC and Clang, so it's > pretty safe. Cool, okay. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaRiaSgAKCRBbRZGEIw/w oqlEAP9PNyIvUpMHKN4vt0l8yExlPQsyE1czMvfdgSgasO9n2QD9H0/kJT957ieN zkEBnxd1lXdekfIe+LTwxWcQQnqq7AI= =1Hv5 -----END PGP SIGNATURE----- --=-=-=--