Public bug reported:

Package: guile-sqlite3
Ubuntu version: 26.04

In sqlite3.scm, the cond branch:
  ((number? val)
   (bind-double p idx (exact->inexact val)))

does not match inexact floats like 17.45, causing them to fall through
to the else branch and raise "unexpected value".

Workaround: replacing (number? val) with (real? val) fixes the issue.

Steps to reproduce:
  guile -c "
  (use-modules (sqlite3))
  (let* ((db (sqlite-open \"/tmp/test.db\" (logior SQLITE_OPEN_READWRITE 
SQLITE_OPEN_CREATE)))
         (stmt (sqlite-prepare db \"SELECT :v\")))
    (sqlite-bind stmt \":v\" 17.45)
    (display (sqlite-step stmt))
    (sqlite-finalize stmt)
    (sqlite-close db))"

Expected: #(17.45)
Got: sqlite3.scm:466:10: unexpected value 17.45

Please note:
guile --version
dpkg -l guile-sqlite3 | grep ^ii

philip@server[~/PowerDashboard]$ guile --version
dpkg -l guile-sqlite3 | grep ^ii
guile (GNU Guile) 3.0.11
Packaged by Debian (3.0.11-2)
Copyright (C) 2024 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ii  guile-sqlite3  0.1.3-5build1 amd64        guile bindings for sqlite3
philip@server[~/PowerDashboard]$ 


This bug was found by Claude AI. I encountered it after upgrading ubuntu 24.04 
to ubuntu 26.04 on my home server.

** Affects: guile-sqlite3 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2152100

Title:
  guile-sqlite3: sqlite-bind rejects inexact floats (real? predicate
  broken in sqlite-bind cond)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/guile-sqlite3/+bug/2152100/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to