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


Reply via email to