From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Fix make-custom-port in case encoding is #f Date: Sun, 2 Feb 2025 21:01:22 +0100 Message-ID: <0b60f59f-fcb9-44ca-8459-2c41fad8a17d@telenet.be> References: <4021eb7fafef7d55a4a8c5c610d9513036f2e0e0.camel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9761"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: =?UTF-8?Q?H=2E_M=C3=BCller?= , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sun Feb 02 21:01:55 2025 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tegAE-0002Mh-RM for guile-devel@m.gmane-mx.org; Sun, 02 Feb 2025 21:01:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1teg9q-0007dZ-Gp; Sun, 02 Feb 2025 15:01:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1teg9o-0007dF-MP for guile-devel@gnu.org; Sun, 02 Feb 2025 15:01:28 -0500 Original-Received: from michel.telenet-ops.be ([2a02:1800:110:4::f00:18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1teg9m-0002B9-Rb for guile-devel@gnu.org; Sun, 02 Feb 2025 15:01:28 -0500 Original-Received: from [IPV6:2a02:1811:8c0e:ef00:3534:9048:e5b:c5c2] ([IPv6:2a02:1811:8c0e:ef00:3534:9048:e5b:c5c2]) by michel.telenet-ops.be with cmsmtp id 8k1N2E00G3xy2ZH06k1PbL; Sun, 02 Feb 2025 21:01:23 +0100 Content-Language: en-US In-Reply-To: <4021eb7fafef7d55a4a8c5c610d9513036f2e0e0.camel@gmail.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r25; t=1738526483; bh=aB1p0VwlWyjzOgGowzfTjsfXMpiPJ/H19ZHQp4m+Qfk=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding:From; b=VdqnKuJA+UtHr+1IAbiC7tVV6SQKUOpBHliBUVltSWjsAz0Z/6a/TUamuCQyAHoKJ Y62T/kAbIFs295GqzVrkfRYpBq1ghfe7ZZaWhJrl7NyjGu50YIo0pJTuAgmkcxkhGw +yHYjcsC6s+sFLQoRl4e9eaw73dS4INMwNaX/wxCmZyr4PKzM3+J9e5X+ztLQPm3j4 5XA0VCXoFyZisCjgRHVLpwkcxdqeEyHQyIbENSExAKFwg1pFJcJgJqtcW9+kU8sC81 8tJh7wrprV1qZSpS8LqmkNns47eFN+WYk/iHt1UUiTPG60Y6zomamBmbrQ2Fn9AKOX RMS+VogOfBdSA== Received-SPF: pass client-ip=2a02:1800:110:4::f00:18; envelope-from=maximedevos@telenet.be; helo=michel.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22904 Archived-At: On 2/02/2025 20:51, H. Müller wrote: > - (encoding (string->symbol (fluid-ref %default-port-encoding))) > + (encoding (if (string? (fluid-ref %default-port-encoding)) > + (string->symbol (fluid-ref %default-port-encoding)) > + (fluid-ref %default-port-encoding))) Probably 'and=>' would be clearer - as-is, it looks like it expects a symbol but also accepts a string (to be converted into a symbol). But that's not the case - it accepts strings, but also the boolean #false.  'and=>' is specifically about apply a function to non-false things and leaving false in-place, so 'and=>' would avoid the potential misconception. There is TOCTTOU bug here -  an async could mutate the current value of the %default-port-encoding fluid in-between the first fluid-ref invocation and the second fluid-ref invocation. and=> would avoid that. Best regards, Maxime Devos