From unknown Fri Jun 20 07:26:31 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#58363 <58363@debbugs.gnu.org> To: bug#58363 <58363@debbugs.gnu.org> Subject: Status: 29.0.50; sqlite-select does not signal errors and errors should be improved Reply-To: bug#58363 <58363@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:26:31 +0000 retitle 58363 29.0.50; sqlite-select does not signal errors and errors shou= ld be improved reassign 58363 emacs submitter 58363 Jonas Bernoulli severity 58363 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 07 14:53:11 2022 Received: (at submit) by debbugs.gnu.org; 7 Oct 2022 18:53:11 +0000 Received: from localhost ([127.0.0.1]:37366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogsT9-0002j3-B7 for submit@debbugs.gnu.org; Fri, 07 Oct 2022 14:53:11 -0400 Received: from lists.gnu.org ([209.51.188.17]:59694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogsT8-0002iw-3a for submit@debbugs.gnu.org; Fri, 07 Oct 2022 14:53:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogsT7-000600-UQ for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 14:53:09 -0400 Received: from mail.hostpark.net ([212.243.197.30]:47162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogsT5-0003p5-VJ for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 14:53:09 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 21E5A16916 for ; Fri, 7 Oct 2022 20:53:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :subject:subject:from:from:received:received; s=sel2011a; t= 1665168779; bh=8wq841dmX4bJ9VFK6CFSyYmsdqR0woMWEqAC4aOhpdg=; b=b DNIN+j8luXGUNOiEXRkc+oocDw3yzrR0yhdJ4qyBR/mf/D9Czrm5vwOfY6uEU4t6 f+X6idZMVPGHB/VG8YvUqXjjX87JXvGSl1CTWrZmSYs9WD/dVqFfBY+1lxEwhwV4 F2pQAGCUlI/Wi9LAGgQHk6KyQ16vKgTJm5XQMVA/IU= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id qNWG_Vw7fYd3 for ; Fri, 7 Oct 2022 20:52:59 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id E965216910 for ; Fri, 7 Oct 2022 20:52:59 +0200 (CEST) From: Jonas Bernoulli To: bug-gnu-emacs@gnu.org Subject: 29.0.50; sqlite-select does not signal errors and errors should be improved Date: Fri, 07 Oct 2022 20:52:59 +0200 Message-ID: <87mta7lb3o.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) sqlite-select does not signal any errors. This just returns nil for example: (sqlite-select (sqlite-open nil) "SELECT * FROM no_such_table") At least some of the other functions do signal errors when appropriate. (sqlite-execute db "bla") -error-> (error "near \"bla\": syntax error") It would be nice if a dedicated error type were used and if the error code was included in the error data. Maybe it would even make sense to use dedicated error types for all of the "primary result codes" as per https://sqlite.org/rescode.html. Thanks for considering, Jonas From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 08 09:42:05 2022 Received: (at 58363) by debbugs.gnu.org; 8 Oct 2022 13:42:05 +0000 Received: from localhost ([127.0.0.1]:38645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohA5d-0004zX-23 for submit@debbugs.gnu.org; Sat, 08 Oct 2022 09:42:05 -0400 Received: from quimby.gnus.org ([95.216.78.240]:34528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohA5Z-0004yw-7T for 58363@debbugs.gnu.org; Sat, 08 Oct 2022 09:42:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pj33P8g6PT0Fx/IWxQTHhvczk2/RD+Y0+v0EdyXyfG4=; b=OW1V5jbsqOXKJ04dgobmYF0dK7 2ZvaJKq9OR4+InT2YjXXf+BbzlvywcnUWHpMwlFgTl9XdUv4wvhwiQKUlVWCLpQfNwZkhakzkBmal oAFdSHVOMjPKZPDSog0HvZdZOs5k7otrAnv+jYE4YlIfNJd04wY2CA7+njDm2Tp5w9LE=; Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohA5P-0000LN-J2; Sat, 08 Oct 2022 15:41:53 +0200 From: Lars Ingebrigtsen To: Jonas Bernoulli Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <87mta7lb3o.fsf@bernoul.li> (Jonas Bernoulli's message of "Fri, 07 Oct 2022 20:52:59 +0200") References: <87mta7lb3o.fsf@bernoul.li> X-Now-Playing: Joni Mitchell's _Blue_: "California" Date: Sat, 08 Oct 2022 15:41:51 +0200 Message-ID: <87k05asa8w.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Jonas Bernoulli writes: > sqlite-select does not signal any errors. This just returns nil for > example: > > (sqlite-select (sqlite-open nil) "SELECT * FROM no_such_table") > > At least some of the other functions do signal [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jonas Bernoulli writes: > sqlite-select does not signal any errors. This just returns nil for > example: > > (sqlite-select (sqlite-open nil) "SELECT * FROM no_such_table") > > At least some of the other functions do signal errors when appropriate. I've now made this signal an error: Debugger entered--Lisp error: (error "SQL logic error") Eli, this also required changes for the Windows macrology at the start of src/sqlite.c -- can you check whether I broke anything? From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 08 10:35:53 2022 Received: (at 58363) by debbugs.gnu.org; 8 Oct 2022 14:35:53 +0000 Received: from localhost ([127.0.0.1]:41139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohAvg-0000kT-JM for submit@debbugs.gnu.org; Sat, 08 Oct 2022 10:35:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohAve-0000kE-SX for 58363@debbugs.gnu.org; Sat, 08 Oct 2022 10:35:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohAvY-0005JI-QC; Sat, 08 Oct 2022 10:35:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=YuS/T4CRrR1ap3A8ZcRxFqY0s93sqCGaQ18dsW2YnGg=; b=X2hHfnkSw7U7 HMHtYWH5vwgVZM2I/s13SHijMaE5VV5NurOwiRNtkHpkdFNNxemHBcAlJvKbeNkBtsQ2haJgtQpyM 9jg058mYntdk+BrL6BSdZOGEcLdEMY5nvh2uTf8sCLj5SrDfHgYBEOqOgexcmmhma/lwfj/ZROQv3 AevuXroCGwjv5CvPtCFq6cVnaWrJB9Wy/7HFR3mePO4IJEhsiCkuyJBhKn0AuGU4J4ZVBk73Dyeoi dAlvRN1Rmu0l1peL09s5mHXWeESnjNpckV8iYX8VlvuSR3pwanFHEvs3WqQwjIoVvS+7HtAqt5YLU kh2DkdlXaTaqq4EFWxgnWQ==; Received: from [87.69.77.57] (port=2455 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohAvY-0002mU-2g; Sat, 08 Oct 2022 10:35:44 -0400 Date: Sat, 08 Oct 2022 17:35:46 +0300 Message-Id: <83y1tqjscd.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87k05asa8w.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 08 Oct 2022 15:41:51 +0200) Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, jonas@bernoul.li X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Cc: 58363@debbugs.gnu.org, Eli Zaretskii > Date: Sat, 08 Oct 2022 15:41:51 +0200 > > Eli, this also required changes for the Windows macrology at the start > of src/sqlite.c -- can you check whether I broke anything? Nothing's broken, your changes are fine. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 08 10:51:18 2022 Received: (at 58363) by debbugs.gnu.org; 8 Oct 2022 14:51:18 +0000 Received: from localhost ([127.0.0.1]:41148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohBAc-0001AN-Gc for submit@debbugs.gnu.org; Sat, 08 Oct 2022 10:51:18 -0400 Received: from quimby.gnus.org ([95.216.78.240]:35126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohBAW-0001A1-Um for 58363@debbugs.gnu.org; Sat, 08 Oct 2022 10:51:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=5g9CtrWk6/I/Pxo7N9CTmzq0oX2ZdWjb5h1yugdxq14=; b=k5DF5yPyY2M+IjUcryekhqAdxP lQAEC387P7vMt5EGEtUrEPtECwN9SG5jLKoC/yB3Rts1z+36KU4Xw67x8T9PDkKmtd7S5catbUkMK 70EKbM6FnVM8jLWQZmyFU4sFjnjFuAti9bbU3ylTgwAyr7oH/8yZ6VD+/tjWrl1fbIYQ=; Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohBAM-0000ry-R9; Sat, 08 Oct 2022 16:51:05 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <83y1tqjscd.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Oct 2022 17:35:46 +0300") References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> <83y1tqjscd.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJ1BMVEX0uWz8x3TapWKo cUXJkle2jF391IGOWDduTjCaZTy4pYW2hjr///8gnOpWAAAAAWJLR0QMgbNRYwAAAAd0SU1FB+YK CA4yLSH8R38AAAGOSURBVDjLndI9T8JAGAfwPgdJjdP9GwNhawsR3FSqho1iEzVsAgmMJC5sxpJA 4ugAjpgm4AdgYfULen1/ZdAn1yZ3vz5399xVkvJB3G25UUjwWjbghsSRTwiiMCGGcC0iDvAEMIOj pAEK3UwhJ8Cqs/K4a+gy7OtuywyBHOdxufye2YvP5npp74wI5g2dqV1OXNWfOLQTigAgrwFMPHKc wVM1pAGchyU048UFUFxcCqKjyMNUrKxKOQAqUHSVcosnZjoO1QR49bn7db+oUgq8MpiuJsFxB91H saxeDkRP2Q/1PIBpp4fRcwI4eRfAmaYc9gMnBiLREafFNIwm648YEALQWq3egZoP4v0mQPVOt//j RCD244N/g5QAfAUj4ZGkgBeB4//IIdXSEKfEYCAVmYwsUApIlO9BJYALEyZKZ+XbzqsALcwwXswN lE57ct+72wCzczfDnWCrz5fty4fRdrHYbcrWWGRMvYy6Kdv9K1bq6QNTqw/FlQQADDRkIoAGjgD+ ANI/oHgyCcVQ+QXOAGak/arHkAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0xMC0wOFQxNDo1MDo0 NSswMDowMM4rDYQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMTAtMDhUMTQ6NTA6NDUrMDA6MDC/ drU4AAAAAElFTkSuQmCC X-Now-Playing: Joni Mitchell's _Court and Spark_: "Same Situation" Date: Sat, 08 Oct 2022 16:51:02 +0200 Message-ID: <877d1as71l.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > Nothing's broken, your changes are fine. Thanks for checking; I'm closing this bug report, then. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, jonas@bernoul.li X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Nothing's broken, your changes are fine. Thanks for checking; I'm closing this bug report, then. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 08 10:51:21 2022 Received: (at control) by debbugs.gnu.org; 8 Oct 2022 14:51:21 +0000 Received: from localhost ([127.0.0.1]:41151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohBAe-0001Ab-PI for submit@debbugs.gnu.org; Sat, 08 Oct 2022 10:51:20 -0400 Received: from quimby.gnus.org ([95.216.78.240]:35142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohBAd-0001AC-6B for control@debbugs.gnu.org; Sat, 08 Oct 2022 10:51:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dd5eub8650YoAG3A4GHqirNwA/pzQhjHMdB/fXYWDVo=; b=M+v6iT0IMwCkfVsdzgeFIHb6hQ t1mVFwJkbJ5RAQqxQlTMd4Ytk2QCgfNh0XsN7aTjM74NrYmt/RDrUzY9ygJWGXJxLj+vmUxL6p2s8 SjOde61X5rtcoEmRXbzTOjdiZr/uqyDUDZp7v6eaU3ysKakxqVeqhCEyJv+hvJqNlks8=; Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohBAV-0000s7-1k for control@debbugs.gnu.org; Sat, 08 Oct 2022 16:51:13 +0200 Date: Sat, 08 Oct 2022 16:51:10 +0200 Message-Id: <875ygus71d.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #58363 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 58363 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 58363 29.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 08 18:47:31 2022 Received: (at 58363) by debbugs.gnu.org; 8 Oct 2022 22:47:31 +0000 Received: from localhost ([127.0.0.1]:41603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohIbS-00056w-O8 for submit@debbugs.gnu.org; Sat, 08 Oct 2022 18:47:31 -0400 Received: from mail.hostpark.net ([212.243.197.30]:57756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohIbP-00056m-G3 for 58363@debbugs.gnu.org; Sat, 08 Oct 2022 18:47:29 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id B491016910; Sun, 9 Oct 2022 00:47:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1665269244; bh=uYM58HPyox5N5a9djoufZiPA bv4fy6QsmhcZvKDFrw0=; b=uX2gvfqKjQv5EFz/ziQec4A10noKo3z4cSaPMxJq O6RxrRKNXuC85MycxjhB47ZI9wtIof5l1VGrkOHDx6dPz/BC3OdnQNEvsVjTmkdd RdQcROtATlFbsNJUAfVUzh3O5998A0ZfRbc0BmotPkQIreFIoDGX0ongnOmglRYW npA= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id Q6Wyqn1UwDNI; Sun, 9 Oct 2022 00:47:24 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 7D3C8163CB; Sun, 9 Oct 2022 00:47:24 +0200 (CEST) From: Jonas Bernoulli To: Lars Ingebrigtsen Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <87k05asa8w.fsf@gnus.org> References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> Date: Sun, 09 Oct 2022 00:47:24 +0200 Message-ID: <871qrivsoz.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Lars Ingebrigtsen writes: > Jonas Bernoulli writes: > >> sqlite-select does not signal any errors. This just returns nil for >> example: >> >> (sqlite-select (sqlite-open nil) "SELECT * FROM no_such_table") >> >> At least some of the other functions do signal errors when appropriate. > > I've now made this signal an error: > > Debugger entered--Lisp error: (error "SQL logic error") Thanks, but what about my suggestion to use a dedicated signal? (Suggesting that different signals be used for different error codes, may have been a bit excessive though.) More importantly though, please also include the actual error message from SQLite in the error data. Currently only a string is included, which represents the _kind_ of error that occurred, something like "SQL logic error". Unfortunately that only tells the user that they made a mistake when writing their SQL. When using pekingduck's module or EmacSQL's custom binary, the error data includes the error code and the error message, such as the very useful "no such table: missing". Please include the message in the error data. Including the error code would also be useful as that would make it easier to look it up at https://www.sqlite.org/rescode.html. I am adding two new SQLite backends to EmacSQL, one using the module and the other using the new builtin support. Currently (emacsql (emacsql-sqlite nil) "SELECT * FROM missing") and (emacsql (emacsql-sqlite-module nil) "SELECT * FROM missing") both signal (emacsql-error "no such table: nono" 1) and I considering extending that to (emacsql-error "no such table: nono" 1 "SQL logic error") However, the best I can do for (emacsql (emacsql-sqlite-builtin nil) "SELECT * FROM missing") is (emacsql-error nil 1 "SQL logic error") From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 09 10:18:22 2022 Received: (at 58363) by debbugs.gnu.org; 9 Oct 2022 14:18:23 +0000 Received: from localhost ([127.0.0.1]:44701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohX8I-0006Mn-KF for submit@debbugs.gnu.org; Sun, 09 Oct 2022 10:18:22 -0400 Received: from quimby.gnus.org ([95.216.78.240]:44934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohX8G-0006MZ-JH for 58363@debbugs.gnu.org; Sun, 09 Oct 2022 10:18:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+6NRHco2ifTXMKSCCuocJsc/1RA1gdWoE/WFCpoY7bU=; b=glgFkpfLUvQtqo/dNsAinfbwGg GpgBv8rkJTtY9sUBxNk4z4B3l5zr+sWmWQsqXOlRyGKOOONW2PXmXMv4XYvz7t+q2ahF2pkAP7sR6 QZ6ax5JM6xJwgptnxiKLEC5qwIiHpPk/Tx8IbrxSp7ukncZwrp9Mw4nqQTKVjg25Kqz8=; Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohX86-0002yv-FZ; Sun, 09 Oct 2022 16:18:13 +0200 From: Lars Ingebrigtsen To: Jonas Bernoulli Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <871qrivsoz.fsf@bernoul.li> (Jonas Bernoulli's message of "Sun, 09 Oct 2022 00:47:24 +0200") References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> <871qrivsoz.fsf@bernoul.li> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEUqHCJVMjPAnmv/ ///dSr/NAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YKCQ4PBygToXIAAAFlSURBVCjPTZK/asMwEMbv StTZBivQzJ3yFArEu1x8gnrq0AzVU6RD9w7xksmBuOB7yt6dXKjAln989+fTyQC2XF922MjjFdDw /T88h1ogOIOq0jQogFcOsjUGD8xnuECAU+rokYfpUUXmH/7ky9uORwIaOzrwJWbmBbKm8v2FOd8N HN995usEzpSpYebvYo+nKBAK5BEFVuP76JjHVdmDKHMP0QDdwMsARAJPxzZZkicKriWBGeQoLSGR 2LkBxQDYkaw8axSgJynb7KRAgFbeVjVqNdGtX619cQVvsKUW5aM3SNQdJEv1iDT6HiuQYhiwH9WH ghe4USsNJacOrp/Vg9iRMEezp/Sq4KLrVPmwawt+KGGlc5rpdBXHNgYX/cCiVCWyTnJSu6TKh4oU NjKgxnce8gKoN++oayHJdAIEPOixIav/M/61aAC/ZDjdCoDaPeqfsKnAqZej+FDYLsVYMmcFXPoF Gpl5Wv37VTkAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjItMTAtMDlUMTQ6MTU6MDcrMDA6MDAlZjsA AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTEwLTA5VDE0OjE1OjA3KzAwOjAwVDuDvAAAAABJRU5E rkJggg== X-Now-Playing: Egg's _The Polite Force_: "Long Piece =?utf-8?Q?N=C2=BA?= 3 (Part 1)" Date: Sun, 09 Oct 2022 16:18:09 +0200 Message-ID: <87ilktqdwe.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Jonas Bernoulli writes: > Thanks, but what about my suggestion to use a dedicated signal? > (Suggesting that different signals be used for different error > codes, may have been a bit excessive though.) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jonas Bernoulli writes: > Thanks, but what about my suggestion to use a dedicated signal? > (Suggesting that different signals be used for different error > codes, may have been a bit excessive though.) I'm not sure adding a separate signal would be valuable here. > More importantly though, please also include the actual error > message from SQLite in the error data. Currently only a string > is included, which represents the _kind_ of error that occurred, > something like "SQL logic error". Ah, I missed that it was possible to get more data out of sqlite about what's wrong. I've now added the extra error string to the value. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 10 06:56:44 2022 Received: (at 58363) by debbugs.gnu.org; 10 Oct 2022 10:56:44 +0000 Received: from localhost ([127.0.0.1]:46226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohqSh-0006ka-Sd for submit@debbugs.gnu.org; Mon, 10 Oct 2022 06:56:44 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohqSf-0006jR-DD for 58363@debbugs.gnu.org; Mon, 10 Oct 2022 06:56:42 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 5A421165A6; Mon, 10 Oct 2022 12:56:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1665399399; bh=oTdN2je9bbpoaMqfM7a8evjx WRutD8mB0kOYf7A9aI4=; b=omKDhIqNBQzKwmZiFK6Uy6d8h3W1VzrJP4/3bOmf yr7q2C0lqcuaThYj2bOwAO+9Vl/RLylhhVrBMi/f8ANAuyTrJG4uqxs+U+OqMV/6 TGKkeG2IEZttoUtA9A8NEiXzbr88DtrZuV84E8qM7rHuDCnZN/R0Qx6RgjncZ4So BY8= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 4ebOvrr52OOY; Mon, 10 Oct 2022 12:56:39 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 2446716591; Mon, 10 Oct 2022 12:56:39 +0200 (CEST) From: Jonas Bernoulli To: Lars Ingebrigtsen Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <87ilktqdwe.fsf@gnus.org> References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> <871qrivsoz.fsf@bernoul.li> <87ilktqdwe.fsf@gnus.org> Date: Mon, 10 Oct 2022 12:56:38 +0200 Message-ID: <87pmf0c5g9.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Lars Ingebrigtsen writes: > Jonas Bernoulli writes: > >> More importantly though, please also include the actual error >> message from SQLite in the error data. Currently only a string >> is included, which represents the _kind_ of error that occurred, >> something like "SQL logic error". > > Ah, I missed that it was possible to get more data out of sqlite about > what's wrong. > > I've now added the extra error string to the value. Thanks! You should probably do the same for sqlite-execute. The functions that return error codes and messages are documented at https://www.sqlite.org/c3ref/errcode.html and the error codes at https://www.sqlite.org/rescode.html. - sqlite3_errcode() - sqlite3_extended_errcode() return the numeric result code or extended result code for that API call. - sqlite3_errstr() returns the English-language text that describes the result code - sqlite3_errmsg() - sqlite3_errmsg16() return English-language text that describes error - sqlite3_error_offset() >> Thanks, but what about my suggestion to use a dedicated signal? >> (Suggesting that different signals be used for different error >> codes, may have been a bit excessive though.) > > I'm not sure adding a separate signal would be valuable here. Currently sqlite.c intentionally withhold information from elisp, needlessly making sophisticated error handling harder and less reliable. Not using a separate signal is part of that. I can see no benefit in withholding information. Maybe you feel that no user of sqlite.c would ever need/should implement more than rudimentary error handling. Currently my end-user packages only use rudimentary error handling; basically they simply bail on any sql error. (They use sqlite.c via emacsql-sqlite-builtin.el.) However as the new maintainer of EmacSQL, I would like to give users of the new builtin backend the same feature sets as for the other backends, not least because maybe some current or future users make use of that. This is possible to an extend because EmacSQL wraps directly around the call to sqlite-select and similar functions from different backends, so it knows that every error it encounters there comes from the respective backend and can then (in the case of sqlite-select) make an attempt to decrypt the provided error data. With the most recent change to that function it can, for example, resignal (error "SQL logic error (no such table)") as (emacsql-error "no such table: nono" 1). To do this it has to extract the two pieces of information from the one string and because we include the errcode in the error data instead of the equivalent errstr, we have to maintain an alist to translate from errstr to errcode. Including the human readable errstr is probably better than using the errcode, but changing that would be a breaking change, so going forward I will provide both, which actually is better than providing just either one: (emacsql-error "no such table: nono" 1 "SQL logic error"). I think it would be a good idea for sqlite.c to do the same. But I am not just thinking of the needs of EmacSQL here. In the future I (and others) likely will use sqlite.c directly. In order to implement anything but rudimentary error handling, all those callers would have to wrap sqlite.c's functions to resignal its errors. Without doing that it becomes impossible to reliably tell errors that originate from SQL (or sqlite.c itself) apart from other errors. So I would encourage you to always (i.e., not only in sqlite-select) signal (sqlite-error sqlite_errstr() sqlite_errmsg() sqlite_errcode()) for any error originating from sqlite3_prepare_v2() or similar, and e.g., (sqlite-error "Invalid set object" nil nil) or (sqlite-error "Invalid set object") for errors originating from check_sqlite() and other places, where the error doesn't originate from a call to sqlite3_prepare_v2() or similar. By the way, for one particular error sqlite-execute already uses a separate signal: Qsqlite_locked_error. But only that function does it and only for that one error. That seems highly inconsistent. I would recommend removing this signal and replacing it with Qsqlite_error and using that for every error and to always include all available data, filling in nil when a particular piece is not available. Actually, in the spirit of forward thinking, you might just as well include the sqlite3_extended_errcode() and sqlite3_error_offset(): (sqlite-error sqlite_errstr() sqlite_errmsg() sqlite_errcode() sqlite3_extended_errcode() sqlite3_error_offset()) Thanks for considering, Jonas From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 10 20:23:33 2022 Received: (at 58363) by debbugs.gnu.org; 11 Oct 2022 00:23:34 +0000 Received: from localhost ([127.0.0.1]:50255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oi33V-000571-IW for submit@debbugs.gnu.org; Mon, 10 Oct 2022 20:23:33 -0400 Received: from quimby.gnus.org ([95.216.78.240]:60340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oi33U-00056m-Fb for 58363@debbugs.gnu.org; Mon, 10 Oct 2022 20:23:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mz788a/uqg0y2Iv/+Q4zE4Lkeqs3iZX0uKNpVgDCATY=; b=cT+EtHLYo8QvDqTY9RsLC7QOB2 8qHoRzJ1B1FpI9ex+mUGcS/nKstW6vkE8viIq8k/Ba/BS56ZPKkWBJRVpDB7qRWphKV9fxX5I4Qia FNF45s+YmTxGX1986DLo275NVftxEqLxueJJL/riX2zSfnyuKiMbKOikcNq0Pv3wrJ9o=; Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oi33K-00069L-If; Tue, 11 Oct 2022 02:23:25 +0200 From: Lars Ingebrigtsen To: Jonas Bernoulli Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <87pmf0c5g9.fsf@bernoul.li> (Jonas Bernoulli's message of "Mon, 10 Oct 2022 12:56:38 +0200") References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> <871qrivsoz.fsf@bernoul.li> <87ilktqdwe.fsf@gnus.org> <87pmf0c5g9.fsf@bernoul.li> X-Now-Playing: Lemon D's _15 Years of Metalheadz_: "This Is LA" Date: Tue, 11 Oct 2022 02:23:21 +0200 Message-ID: <87v8orky2u.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Jonas Bernoulli writes: > You should probably do the same for sqlite-execute. Now done. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jonas Bernoulli writes: > You should probably do the same for sqlite-execute. Now done. > So I would encourage you to always (i.e., not only in sqlite-select) > signal > > (sqlite-error sqlite_errstr() sqlite_errmsg() sqlite_errcode()) Patches welcome. > By the way, for one particular error sqlite-execute already uses a > separate signal: Qsqlite_locked_error. But only that function does it > and only for that one error. That seems highly inconsistent. I would > recommend removing this signal and replacing it with Qsqlite_error and > using that for every error and to always include all available data, > filling in nil when a particular piece is not available. It's a retryable error, so it's nice to be able to differentiate easily. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 14 13:52:25 2022 Received: (at 58363) by debbugs.gnu.org; 14 Oct 2022 17:52:25 +0000 Received: from localhost ([127.0.0.1]:38556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojOrB-0002gz-48 for submit@debbugs.gnu.org; Fri, 14 Oct 2022 13:52:25 -0400 Received: from mail.hostpark.net ([212.243.197.30]:57892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojOr9-0002gq-3C for 58363@debbugs.gnu.org; Fri, 14 Oct 2022 13:52:24 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id C3EF8162AB; Fri, 14 Oct 2022 19:52:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1665769940; bh=CuCw87s76gXf7wQnjPQYXsX3 y4ES5YWqQDncwF4J0Ow=; b=awVUOLYzO8PUtK1ILKndb+t3dYvoHaEcG8anOFj4 BtyrxYHitaOyXfCFqfEH6VN+4WXdXHvK7UHfZiYUsWk6ZxFuP7/h/Z4IHf4Caj6I YylyQ19zfNxpmJ5V2qUWAABOx6sMk3wbbZgP1W3TtQCSRzu+xCSp4aOzgL0oimGE AHw= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id blI0E841T9-3; Fri, 14 Oct 2022 19:52:20 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 88D5A16910; Fri, 14 Oct 2022 19:52:20 +0200 (CEST) From: Jonas Bernoulli To: Lars Ingebrigtsen Subject: Re: bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved In-Reply-To: <87v8orky2u.fsf@gnus.org> References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.org> <871qrivsoz.fsf@bernoul.li> <87ilktqdwe.fsf@gnus.org> <87pmf0c5g9.fsf@bernoul.li> <87v8orky2u.fsf@gnus.org> Date: Fri, 14 Oct 2022 19:52:18 +0200 Message-ID: <871qrathrh.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Lars Ingebrigtsen writes: > Patches welcome. I'll send some. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 21 17:06:44 2022 Received: (at 58363) by debbugs.gnu.org; 21 Oct 2022 21:06:44 +0000 Received: from localhost ([127.0.0.1]:39088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzE4-0000Nu-Fs for submit@debbugs.gnu.org; Fri, 21 Oct 2022 17:06:44 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzE2-0000Nl-DK for 58363@debbugs.gnu.org; Fri, 21 Oct 2022 17:06:43 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 04B1D16591; Fri, 21 Oct 2022 23:06:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1666386399; bh=5OzrWxAgzfM1CNi qc4gUo3KY2l/AJzK2TThte3c0zF8=; b=a+ZQDTjYuWTTBnAGsZW3AzaRlQla80z ECCExLhfEgDZ/bc1dj/tiKqVzS6Qdq55+CnnjsqDP0/aOhpe1o2Tk+4rHqSxretJ HjhrkIMbsYf3dSGs9TwUZRdeCSw+xZG+a+mCQ7OrHh0oXEMvr3rTWFiK3vwyFob3 kjvMLhSiyvYk= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id eS_KLGF31BtO; Fri, 21 Oct 2022 23:06:39 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id C4A5116572; Fri, 21 Oct 2022 23:06:39 +0200 (CEST) From: Jonas Bernoulli To: 58363@debbugs.gnu.org Subject: [PATCH 0/3] Improve error data signaled by sqlite-execute et al. Date: Fri, 21 Oct 2022 23:06:33 +0200 Message-Id: <20221021210636.13329-1-jonas@bernoul.li> X-Mailer: git-send-email 2.38.0 In-Reply-To: <87v8orky2u.fsf@gnus.org> References: <87v8orky2u.fsf@gnus.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> So I would encourage you to always (i.e., not only in sqlite-select) >> signal >> >> (sqlite-error sqlite_errstr() sqlite_errmsg() sqlite_errcode()) > > Patches welcome. I hope these changes make sense to someone more experienced. I have included the value of sqlite3_extended_errcode() in the error data, but have left out sqlite3_error_offset() because that function is too new (but we could append it at a later time). Cheers, Jonas Jonas Bernoulli (3): Use xsignal1 as required by argument type Introduce a new sqlite-error Improve error data signaled by sqlite-execute et al. src/sqlite.c | 57 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 24 deletions(-) -- 2.38.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 21 17:06:52 2022 Received: (at 58363) by debbugs.gnu.org; 21 Oct 2022 21:06:52 +0000 Received: from localhost ([127.0.0.1]:39091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzEB-0000OF-QM for submit@debbugs.gnu.org; Fri, 21 Oct 2022 17:06:52 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzE8-0000O6-N6 for 58363@debbugs.gnu.org; Fri, 21 Oct 2022 17:06:49 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 21CB516591; Fri, 21 Oct 2022 23:06:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1666386407; bh=ik81QpvTB1Dwf1a r8G/hVtv7zMCro2IV9Ho/vWs4Szg=; b=J6gLblqWPKv8gTl3/Aj3ORUEXRbK9vb Xm8LUMxgwlquGEL2ZE53WzFIvLxxuZHY0AlKCgLmt8K6/3ZG/FFuJmGXgZaAlqCE cN3v63VTX6RBUNMx3N3ey78r1my/iwSy6a0jpCF+ADYthfsuUcw3x41nzTNy50zm Jy9n+BvUGsmo= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id U0dyY8Kp4KuJ; Fri, 21 Oct 2022 23:06:47 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id E100E16572; Fri, 21 Oct 2022 23:06:47 +0200 (CEST) From: Jonas Bernoulli To: 58363@debbugs.gnu.org Subject: [PATCH 1/3] Use xsignal1 as required by argument type Date: Fri, 21 Oct 2022 23:06:34 +0200 Message-Id: <20221021210636.13329-2-jonas@bernoul.li> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221021210636.13329-1-jonas@bernoul.li> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * src/sqlite.c (sqlite-load-extension): Use xsignal1. --- src/sqlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sqlite.c b/src/sqlite.c index 1526e344e5..7861a699f4 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -675,7 +675,7 @@ DEFUN ("sqlite-load-extension", Fsqlite_load_extension, } if (!do_allow) - xsignal (Qerror, build_string ("Module name not on allowlist")); + xsignal1 (Qerror, build_string ("Module name not on allowlist")); int result = sqlite3_load_extension (XSQLITE (db)->db, -- 2.38.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 21 17:07:00 2022 Received: (at 58363) by debbugs.gnu.org; 21 Oct 2022 21:07:00 +0000 Received: from localhost ([127.0.0.1]:39094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzEK-0000Ob-3l for submit@debbugs.gnu.org; Fri, 21 Oct 2022 17:07:00 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzEG-0000OR-Q7 for 58363@debbugs.gnu.org; Fri, 21 Oct 2022 17:06:57 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 3C82616591; Fri, 21 Oct 2022 23:06:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1666386416; bh=U9ByohMrNvoNNEB WPgm+Q/XEB/38kY6tSlMrpFBpJwQ=; b=x53h3LbGIQYHVbwtsNGuNkSyxpjjqXu j3CBGN67oYC8RCMO+UpReMiFdAf0qNdHEQmOPdvKiQRlAfgwlRU5Xv3m4kPJD+24 zP+xLqv35Q83LeeXMRvAeqNZwhwAaaJzkvYP6774kDBN/z41+H4awtNNTtu1DMEY AFsBXVJcNVD8= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id ndwMTko-HcaG; Fri, 21 Oct 2022 23:06:56 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 0898B16572; Fri, 21 Oct 2022 23:06:56 +0200 (CEST) From: Jonas Bernoulli To: 58363@debbugs.gnu.org Subject: [PATCH 2/3] Introduce a new sqlite-error Date: Fri, 21 Oct 2022 23:06:35 +0200 Message-Id: <20221021210636.13329-3-jonas@bernoul.li> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221021210636.13329-1-jonas@bernoul.li> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * src/sqlite.c (check_sqlite, sqlite-open, bind_values) (sqlite-execute, sqlite-select, sqlite-load-extension) (sqlite-next): Use it. (syms_of_sqlite): Introduce a new error for all sqlite errors so that we can catch that condition on higher levels. --- src/sqlite.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/sqlite.c b/src/sqlite.c index 7861a699f4..78b261fb08 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -233,13 +233,13 @@ check_sqlite (Lisp_Object db, bool is_statement) init_sqlite_functions (); CHECK_SQLITE (db); if (is_statement && !XSQLITE (db)->is_statement) - xsignal1 (Qerror, build_string ("Invalid set object")); + xsignal1 (Qsqlite_error, build_string ("Invalid set object")); else if (!is_statement && XSQLITE (db)->is_statement) - xsignal1 (Qerror, build_string ("Invalid database object")); + xsignal1 (Qsqlite_error, build_string ("Invalid database object")); if (!is_statement && !XSQLITE (db)->db) - xsignal1 (Qerror, build_string ("Database closed")); + xsignal1 (Qsqlite_error, build_string ("Database closed")); else if (is_statement && !XSQLITE (db)->db) - xsignal1 (Qerror, build_string ("Statement closed")); + xsignal1 (Qsqlite_error, build_string ("Statement closed")); } static int db_count = 0; @@ -259,7 +259,7 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, #endif if (!init_sqlite_functions ()) - xsignal1 (Qerror, build_string ("sqlite support is not available")); + xsignal1 (Qsqlite_error, build_string ("sqlite support is not available")); if (!NILP (file)) name = ENCODE_FILE (Fexpand_file_name (file, Qnil)); @@ -272,7 +272,7 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, name = CALLN (Fformat, memory_fmt, make_int (++db_count)); flags |= SQLITE_OPEN_MEMORY; #else - xsignal1 (Qerror, build_string ("sqlite in-memory is not available")); + xsignal1 (Qsqlite_error, build_string ("sqlite in-memory is not available")); #endif } @@ -342,7 +342,7 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values) if (blob) { if (SBYTES (value) != SCHARS (value)) - xsignal1 (Qerror, build_string ("BLOB values must be unibyte")); + xsignal1 (Qsqlite_error, build_string ("BLOB values must be unibyte")); ret = sqlite3_bind_blob (stmt, i + 1, SSDATA (value), SBYTES (value), NULL); @@ -447,7 +447,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, check_sqlite (db, false); CHECK_STRING (query); if (!(NILP (values) || CONSP (values) || VECTORP (values))) - xsignal1 (Qerror, build_string ("VALUES must be a list or a vector")); + xsignal1 (Qsqlite_error, build_string ("VALUES must be a list or a vector")); sqlite3 *sdb = XSQLITE (db)->db; Lisp_Object errmsg = Qnil, @@ -505,7 +505,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, exit: sqlite3_finalize (stmt); xsignal1 (ret == SQLITE_LOCKED || ret == SQLITE_BUSY? - Qsqlite_locked_error: Qerror, + Qsqlite_locked_error: Qsqlite_error, errmsg); } @@ -540,7 +540,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, CHECK_STRING (query); if (!(NILP (values) || CONSP (values) || VECTORP (values))) - xsignal1 (Qerror, build_string ("VALUES must be a list or a vector")); + xsignal1 (Qsqlite_error, build_string ("VALUES must be a list or a vector")); sqlite3 *sdb = XSQLITE (db)->db; Lisp_Object retval = Qnil, errmsg = Qnil, @@ -589,7 +589,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, exit: if (! NILP (errmsg)) - xsignal1 (Qerror, errmsg); + xsignal1 (Qsqlite_error, errmsg); return retval; } @@ -675,7 +675,7 @@ DEFUN ("sqlite-load-extension", Fsqlite_load_extension, } if (!do_allow) - xsignal1 (Qerror, build_string ("Module name not on allowlist")); + xsignal1 (Qsqlite_error, build_string ("Module name not on allowlist")); int result = sqlite3_load_extension (XSQLITE (db)->db, @@ -695,7 +695,7 @@ DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, int ret = sqlite3_step (XSQLITE (set)->stmt); if (ret != SQLITE_ROW && ret != SQLITE_OK && ret != SQLITE_DONE) - xsignal1 (Qerror, build_string (sqlite3_errmsg (XSQLITE (set)->db))); + xsignal1 (Qsqlite_error, build_string (sqlite3_errmsg (XSQLITE (set)->db))); if (ret == SQLITE_DONE) { @@ -794,9 +794,15 @@ syms_of_sqlite (void) defsubr (&Ssqlitep); defsubr (&Ssqlite_available_p); + DEFSYM (Qsqlite_error, "sqlite-error"); + Fput (Qsqlite_error, Qerror_conditions, + Fpurecopy (list2 (Qsqlite_error, Qerror))); + Fput (Qsqlite_error, Qerror_message, + build_pure_c_string ("Database error")); + DEFSYM (Qsqlite_locked_error, "sqlite-locked-error"); Fput (Qsqlite_locked_error, Qerror_conditions, - Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); + Fpurecopy (list3 (Qsqlite_locked_error, Qsqlite_error, Qerror))); Fput (Qsqlite_locked_error, Qerror_message, build_pure_c_string ("Database locked")); -- 2.38.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 21 17:07:08 2022 Received: (at 58363) by debbugs.gnu.org; 21 Oct 2022 21:07:08 +0000 Received: from localhost ([127.0.0.1]:39100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzER-0000PX-LV for submit@debbugs.gnu.org; Fri, 21 Oct 2022 17:07:08 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olzEO-0000PO-SD for 58363@debbugs.gnu.org; Fri, 21 Oct 2022 17:07:05 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 4D1A516591; Fri, 21 Oct 2022 23:07:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1666386424; bh=s3APMfUFUt07NUK KTfY2Mp2mEqD6CAqY3IK9iSGQzXY=; b=QlCaDlaUdh9WVHM7eo0iJQdN+VbMBQG MO703f99DlZCU6AdntAbQnlzp70xT2GHunDdyqWy/WsIToR0OyiH7YadgdPyLZ2q K1CXKHy9vC+QSEGJm9FmG/tE2zQorfl726IUYBHpsmul/ijowk9jVzb8NctIiQE6 TZ5/RlXVVZos= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id b7xaRGEEMSXe; Fri, 21 Oct 2022 23:07:04 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 1B91016572; Fri, 21 Oct 2022 23:07:04 +0200 (CEST) From: Jonas Bernoulli To: 58363@debbugs.gnu.org Subject: [PATCH 3/3] Improve error data signaled by sqlite-execute et al. Date: Fri, 21 Oct 2022 23:06:36 +0200 Message-Id: <20221021210636.13329-4-jonas@bernoul.li> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221021210636.13329-1-jonas@bernoul.li> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * src/sqlite.c (load_dll_functions): Update. (sqlite_prepare_errdata): New function. (sqlite_prepare_errmsg): Remove function. (sqlite-execute, sqlite-select): Use new function. --- src/sqlite.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/sqlite.c b/src/sqlite.c index 78b261fb08..d6cb38a29a 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -50,6 +50,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int64, DEF_DLL_FN (SQLITE_API int, sqlite3_bind_double, (sqlite3_stmt*, int, double)); DEF_DLL_FN (SQLITE_API int, sqlite3_bind_null, (sqlite3_stmt*, int)); DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int, (sqlite3_stmt*, int, int)); +DEF_DLL_FN (SQLITE_API int, sqlite3_extended_errcode, (sqlite3*)); DEF_DLL_FN (SQLITE_API const char*, sqlite3_errmsg, (sqlite3*)); DEF_DLL_FN (SQLITE_API const char*, sqlite3_errstr, (int)); DEF_DLL_FN (SQLITE_API int, sqlite3_step, (sqlite3_stmt*)); @@ -88,6 +89,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # undef sqlite3_bind_double # undef sqlite3_bind_null # undef sqlite3_bind_int +# undef sqlite3_extended_errcode # undef sqlite3_errmsg # undef sqlite3_errstr # undef sqlite3_step @@ -113,6 +115,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # define sqlite3_bind_double fn_sqlite3_bind_double # define sqlite3_bind_null fn_sqlite3_bind_null # define sqlite3_bind_int fn_sqlite3_bind_int +# define sqlite3_extended_errcode fn_sqlite3_extended_errcode # define sqlite3_errmsg fn_sqlite3_errmsg # define sqlite3_errstr fn_sqlite3_errstr # define sqlite3_step fn_sqlite3_step @@ -141,6 +144,7 @@ load_dll_functions (HMODULE library) LOAD_DLL_FN (library, sqlite3_bind_double); LOAD_DLL_FN (library, sqlite3_bind_null); LOAD_DLL_FN (library, sqlite3_bind_int); + LOAD_DLL_FN (library, sqlite3_extended_errcode); LOAD_DLL_FN (library, sqlite3_errmsg); LOAD_DLL_FN (library, sqlite3_errstr); LOAD_DLL_FN (library, sqlite3_step); @@ -422,16 +426,15 @@ row_to_value (sqlite3_stmt *stmt) } static Lisp_Object -sqlite_prepare_errmsg (int code, sqlite3 *sdb) +sqlite_prepare_errdata (int code, sqlite3 *sdb) { - Lisp_Object errmsg = build_string (sqlite3_errstr (code)); + Lisp_Object errstr = build_string (sqlite3_errstr (code)); + Lisp_Object errcode = make_fixnum (code); /* More details about what went wrong. */ - const char *sql_error = sqlite3_errmsg (sdb); - if (sql_error) - return CALLN (Fformat, build_string ("%s (%s)"), - errmsg, build_string (sql_error)); - else - return errmsg; + Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); + const char *errmsg = sqlite3_errmsg (sdb); + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, + errcode, ext_errcode); } DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, @@ -466,7 +469,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, sqlite3_reset (stmt); } - errmsg = sqlite_prepare_errmsg (ret, sdb); + errmsg = sqlite_prepare_errdata (ret, sdb); goto exit; } @@ -553,7 +556,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, { if (stmt) sqlite3_finalize (stmt); - errmsg = sqlite_prepare_errmsg (ret, sdb); + errmsg = sqlite_prepare_errdata (ret, sdb); goto exit; } -- 2.38.0 From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 02:46:31 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 06:46:31 +0000 Received: from localhost ([127.0.0.1]:39581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1om8H9-0000a8-En for submit@debbugs.gnu.org; Sat, 22 Oct 2022 02:46:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1om8H7-0000Zv-Mf for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 02:46:30 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1om8H2-0007sX-1U; Sat, 22 Oct 2022 02:46:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=E3EL0EiB3Z6lqHROUeKzhbPB4+HZW8A3I8y0lYzZPuk=; b=bJbt5CcXTD3J RF8PfFzGCqIYyhyn8Rvoc28bVuVzPo/nTxza+R+/tpgveiY2ZwY/bDCG78tG1+huB5ckaWPw0iVc5 dSSKpLadx+prxUQSZIbQs0CnjZHE1AOXc5M0rl2RSU+9bMlv/kho7BnD0viexMER2pvtktHwuVOyY 3oCe2ECr2f3YD9D8Wm29VpEy6Yg38u6uJqmA6Z6raE9H4KpxqIz7d6+gxotTyp26ReGaiDB2mCQpi NSW5PW328owILIiX0iv0yuM1mI+QeKUMfOPqMK7iZWZcMiPlWXcBzJEp7v6gEOjFzCqqZzyt+Oyg5 rHFa/zqFStOfEkA1Z9gpfA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1om8Gd-00079Q-MZ; Sat, 22 Oct 2022 02:46:21 -0400 Date: Sat, 22 Oct 2022 09:45:59 +0300 Message-Id: <83czakuziw.fsf@gnu.org> From: Eli Zaretskii To: Jonas Bernoulli In-Reply-To: <20221021210636.13329-2-jonas@bernoul.li> (message from Jonas Bernoulli on Fri, 21 Oct 2022 23:06:34 +0200) Subject: Re: bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-2-jonas@bernoul.li> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jonas Bernoulli > Date: Fri, 21 Oct 2022 23:06:34 +0200 > > * src/sqlite.c (sqlite-load-extension): Use xsignal1. > --- > src/sqlite.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/sqlite.c b/src/sqlite.c > index 1526e344e5..7861a699f4 100644 > --- a/src/sqlite.c > +++ b/src/sqlite.c > @@ -675,7 +675,7 @@ DEFUN ("sqlite-load-extension", Fsqlite_load_extension, > } > > if (!do_allow) > - xsignal (Qerror, build_string ("Module name not on allowlist")); > + xsignal1 (Qerror, build_string ("Module name not on allowlist")); Why Qerror here and not Qsqlite_error? And if the more general Qerror is deliberate, then why not Qmodule_load_failed, for instance? From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 02:49:36 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 06:49:36 +0000 Received: from localhost ([127.0.0.1]:39587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1om8K8-0000gU-0R for submit@debbugs.gnu.org; Sat, 22 Oct 2022 02:49:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54672) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1om8Ju-0000g4-4a for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 02:49:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1om8Jo-0008BJ-Uu; Sat, 22 Oct 2022 02:49:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=vHjOxnsyOORxi3KK87ZncYeRGs0lCH6ZV1nknnCGWE4=; b=Wqh2+L8jbpRD FHyZ1Jb3AveytQo4KLTrqjalUXtKw83A+DhHq6jNikbBqaBTvnDt7owq4F11Shom2qDLfYW5Wt68a DKvWf3TkjVTZFT5KEa4sgGdc6F0ml/527eWTWNHJ3nJ8VthjIX6iZfTDkVdbMSj5osO7AF7MldA2q z6eHf8qpBfbvBRX1HJ7d3KGtlZlHiVV3gdmTeAqmgtfK77IuqiJXIbkU8kwTf1sHzQPrRI3zBvDAg EhXFWnikE43aSGJoLnBViimaPtgNmnPNhApE8riTrxUeY+18I4ErAEBN52iMtybJziXVfm7SSDGqH jDyYUrLUO/VYnbOeujI0Ag==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1om8Jo-0007YE-6N; Sat, 22 Oct 2022 02:49:16 -0400 Date: Sat, 22 Oct 2022 09:49:17 +0300 Message-Id: <83bkq4uzde.fsf@gnu.org> From: Eli Zaretskii To: Jonas Bernoulli In-Reply-To: <20221021210636.13329-4-jonas@bernoul.li> (message from Jonas Bernoulli on Fri, 21 Oct 2022 23:06:36 +0200) Subject: Re: bug#58363: [PATCH 3/3] Improve error data signaled by sqlite-execute et al. References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-4-jonas@bernoul.li> X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jonas Bernoulli > Date: Fri, 21 Oct 2022 23:06:36 +0200 > > + Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); > + const char *errmsg = sqlite3_errmsg (sdb); > + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, > + errcode, ext_errcode); ^^^^ Is that Qnil really a good idea here? What will an error message look like in that case? We may wish replacing Qnil with some standard text, if it looks better. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 05:15:06 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 09:15:06 +0000 Received: from localhost ([127.0.0.1]:39690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omAaw-0004Hd-0S for submit@debbugs.gnu.org; Sat, 22 Oct 2022 05:15:06 -0400 Received: from mout.gmx.net ([212.227.15.19]:37005) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omAaf-0004GZ-MW for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 05:15:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666430082; bh=ZXsBKq4EzJg0uj+BsyCl6NhrCYpopeGIXfj27tRrvxo=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=Qr5cqyTLsNMhbPp6DkIwTxMZ0QiES/kjM4BkuD/SvgcLGCsiHSm1hGOxsixP6ykz2 G7iE++zR52+ew77T2slZP0Ch3UzGfzjh+64L9lKs4IMVrrB31dBknWfH7x8PzDLuMP zaOrlUPNlf5q5ijtrXpXM/VmIPc1XM4i7c5o8KwI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gandalf.gmx.de ([79.140.125.83]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbirE-1pNzBM2A62-00dEvA; Sat, 22 Oct 2022 11:14:42 +0200 From: Michael Albinus To: Jonas Bernoulli Subject: Re: bug#58363: [PATCH 2/3] Introduce a new sqlite-error In-Reply-To: <20221021210636.13329-3-jonas@bernoul.li> (Jonas Bernoulli's message of "Fri, 21 Oct 2022 23:06:35 +0200") References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-3-jonas@bernoul.li> Date: Sat, 22 Oct 2022 11:14:41 +0200 Message-ID: <8735bg8bjy.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:bn7FQU/2LlgjsRR1Q0sroZzB3tIkJy0iFEq5m4SaKnB42+aANpV KVj31qbyG1hYRhgt2KZzFwD2Pd27lKA5g4twH7IBBLKsfpF1lQYlMlS3xuFuuLZ9t90I5AA Z9D3v4ouHGOVPCvyNmovsFwvJn4UxD2ehBJyj1lAjcXA+B6GZNE1ie0BUVe/uwxECj6GNs3 iMBN8q2FI0pfsHntwDCLw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Mp0NAqm+yh4=:ssLmhvbPnHo/zuJb3GYzcD 8XtRMDWnIjOxtiyLeX1NprZJTMFgVLx8rckjiidZo7JyRHlD8MXPSGCumNEwwtZGVFjanAv34 GLV3gaEptzG4/O/cyet6Vkk7MnnqOBui+0tYbsm14z48fiBS3KIJQqGNnSlWV/dBN9dnD/N33 NxRH6rOTOmmgNRSJy1Hi+P7WlKWP8B5pug3Ca+aDKTfKBrd9xsS91uFIZLzXrQ4DzruTP5hPj hYM8oveQkaS/o1ge4B1Psnx7hYSzubeKbeDIhbJKehWbhlgGO+YN/r+jK4pJyzYseyb0OHsYs Ael3i/YmUvNzst5tPrSCjnhKoY5D7HbXR7wz+CnHrOYvdO+SM05cXxuEVxpbE/hn8wzkGOxJb EENThqsQctHaDZnPB212rHHb95J/HxFHk+OBtxlAADBoSA5DOk1w1TmvPrshPdJxJqxYkO5Ih D1pm5dGmduaRmWt4BMRw4o9No0/4wi35Si//Q1HQhrmEjra9awWw1Vq/woG/zP3hD3dajix6w dfaN6hJeF6Stq9KuBIpE1CnWT2dmVX220ai0gXaD5tKHoof27JX2siwwXcK7TmBVv/7L5QCMO IsvSAagEe9OFwCkqG2hdL3US178vLeU/IOSyAiBwLeOnKOBtaZKTftGhiIsNvdULWKdaOlUFb cb49sDdp+wXip4TVItoZUv3EWO7WV8W84TniChJFoHWm4J4AseVFulDX9CaN2Ih695r/3e+bp Ao1q81DTdmfVTblw89IGv81W8BoVlMo/LmDBBQ1YHB32MUsE0yTprl7DYFNlHn83qHuBj0be6 IAv9CZYVKWteDfrVOfwoE+T2U68NJ2aWS2LRGYfvx9pirV9o9ySGXJWJpdUA7E+2OFyamSGqW A5Lb73BumNQzZVk387sWwe52F1oz+tgCq9/pJuMY2FTuOvwMpx++bpckbqnsfxNxPNzkFMz6c 7hE+lTkcCR0IIwPsxNT6ykjxFBcGVdnaBG3HLo9wYVAjoRMGxz710DIqMVEdezaFa2EY1uUCk +MJHO2Q5OfmKMGZXefEdIuCUe0yCuuyQhTGfrOjqtx3fo0aTim1lLsuWDsNrFgr85ABpkpQgE eYJ2U6isQ/wIDXgiibZ8sO5s8k/mLsRNqKrggj+A0OfPKiRWco+hEjtQFPmwnIjJB78hIC7n8 Xq6fHE6Sks4MeSb54lYfDmRAZjIrvH4P2DM2YMxUvr9nCPqFQZDUWUuE5PNRnQL9daRWC8pBN clVOPTodevdzKCJRUdhqYMUQh6OInNkOv6MT2sZI9BSU951ygJ1lueRKdSNmhpycnR74dmnn8 cZY03LrW9unwdlbEyhDD4K7wurr6QdNNNDWvoniFTBoN4o1wJLiFCJwulEColu86nrdnVOJPY xzwrdqoPok84hBs5xIDSmtwSyJcj4+QjbQ9uFQ2cq0tUvsYndKN57u+jnmfVy2aUt9qLki9dI Lq4P6a5AUwVa/UHe6eP45F7i9EjsUEpGNGlX3tRxUDnX+lJJmvw1WQrORnvdeF6FUupEGxEGk Aur8ArJORe7P48DnjmlspvAyrg5bNXlHd03on0PJ7mspo X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Jonas Bernoulli writes: Hi Jonas, > + DEFSYM (Qsqlite_error, "sqlite-error"); > + Fput (Qsqlite_error, Qerror_conditions, > + Fpurecopy (list2 (Qsqlite_error, Qerror))); > + Fput (Qsqlite_error, Qerror_message, > + build_pure_c_string ("Database error")); > + > DEFSYM (Qsqlite_locked_error, "sqlite-locked-error"); > Fput (Qsqlite_locked_error, Qerror_conditions, > - Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); > + Fpurecopy (list3 (Qsqlite_locked_error, Qsqlite_error, Qerror))); > Fput (Qsqlite_locked_error, Qerror_message, > build_pure_c_string ("Database locked")); I'm not sure about our policy, but shouldn't error symbols in the C core be documented in the manual, node "(elisp) Standard Errors"? Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 06:45:08 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 10:45:08 +0000 Received: from localhost ([127.0.0.1]:39781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omC04-0000VL-46 for submit@debbugs.gnu.org; Sat, 22 Oct 2022 06:45:08 -0400 Received: from mail.hostpark.net ([212.243.197.30]:58058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omC01-0000VC-Ua for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 06:45:06 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 898B8162AB; Sat, 22 Oct 2022 12:45:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1666435503; bh=Px7mWrj4E3AXf01U1LwA5TDJ FzQOhrwFybAK5Ud1EvQ=; b=yL9spEb76udNAk5c4SpMAiiNQTAp4n0gAjWngelm PgCtZGeJHJLwMsbyQIhOdAXJ5Ysy4ioTlYX9M6/KBmTG9ESDwyM0Ey4B1/5mL/2J xd2TWAv4EJVD5oKvaVTib3brFygC0pThJr+Ry9YffSOFyvcv8t8hXDPz/5sNTJZy 99s= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 0p0csr1BUy0Y; Sat, 22 Oct 2022 12:45:03 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 5706C163CB; Sat, 22 Oct 2022 12:45:03 +0200 (CEST) From: Jonas Bernoulli To: Eli Zaretskii Subject: Re: bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type In-Reply-To: <83czakuziw.fsf@gnu.org> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-2-jonas@bernoul.li> <83czakuziw.fsf@gnu.org> Date: Sat, 22 Oct 2022 12:45:02 +0200 Message-ID: <874jvwrvbl.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Jonas Bernoulli >> Date: Fri, 21 Oct 2022 23:06:34 +0200 >> >> * src/sqlite.c (sqlite-load-extension): Use xsignal1. >> --- >> src/sqlite.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/src/sqlite.c b/src/sqlite.c >> index 1526e344e5..7861a699f4 100644 >> --- a/src/sqlite.c >> +++ b/src/sqlite.c >> @@ -675,7 +675,7 @@ DEFUN ("sqlite-load-extension", Fsqlite_load_extension, >> } >> >> if (!do_allow) >> - xsignal (Qerror, build_string ("Module name not on allowlist")); >> + xsignal1 (Qerror, build_string ("Module name not on allowlist")); > > Why Qerror here and not Qsqlite_error? And if the more general Qerror > is deliberate, then why not Qmodule_load_failed, for instance? This commit just fixes a bug. Qsqlite_error is introduced in the next commit. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 06:47:14 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 10:47:15 +0000 Received: from localhost ([127.0.0.1]:39785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omC26-0000Yi-J6 for submit@debbugs.gnu.org; Sat, 22 Oct 2022 06:47:14 -0400 Received: from mail.hostpark.net ([212.243.197.30]:58060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omC24-0000YZ-Fz for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 06:47:13 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id E0025163CB; Sat, 22 Oct 2022 12:47:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1666435630; bh=4ETCfYe3XdVPJgae7pLLS/i2 PO9+sRsOThcndZwuHVg=; b=D7k9NExMYOK13y1fgkVbhV+WEvodUZU6cs3HA4mW bae7XFCWNUG+bGKbOxDS1pKZmrLOPgmtKXCJINyE2K3swa9aA7shMQJciJkcny1K H1xEHqysTHUPbg+qLuEOC4AOX3RjIWskf++h5PLi6UxcC/7c+FQR9y46QuKSV6qW xUM= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id y8ZLsKZGSEVC; Sat, 22 Oct 2022 12:47:10 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id AFA2A162AB; Sat, 22 Oct 2022 12:47:10 +0200 (CEST) From: Jonas Bernoulli To: Michael Albinus Subject: Re: bug#58363: [PATCH 2/3] Introduce a new sqlite-error In-Reply-To: <8735bg8bjy.fsf@gmx.de> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-3-jonas@bernoul.li> <8735bg8bjy.fsf@gmx.de> Date: Sat, 22 Oct 2022 12:47:10 +0200 Message-ID: <871qr0rv81.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Michael Albinus writes: > Jonas Bernoulli writes: > > Hi Jonas, > >> + DEFSYM (Qsqlite_error, "sqlite-error"); >> + Fput (Qsqlite_error, Qerror_conditions, >> + Fpurecopy (list2 (Qsqlite_error, Qerror))); >> + Fput (Qsqlite_error, Qerror_message, >> + build_pure_c_string ("Database error")); >> + >> DEFSYM (Qsqlite_locked_error, "sqlite-locked-error"); >> Fput (Qsqlite_locked_error, Qerror_conditions, >> - Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); >> + Fpurecopy (list3 (Qsqlite_locked_error, Qsqlite_error, Qerror))); >> Fput (Qsqlite_locked_error, Qerror_message, >> build_pure_c_string ("Database locked")); > > I'm not sure about our policy, but shouldn't error symbols in the C core > be documented in the manual, node "(elisp) Standard Errors"? > > Best regards, Michael. I don't know but that section begins with > Here is a list of the more important error symbols in standard Emacs, Maybe this new error symbol falls into that category. sqlite-locked-error wasn't documented on that page, so I didn't do it for this either, for now. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 07:07:22 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 11:07:22 +0000 Received: from localhost ([127.0.0.1]:39790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omCLa-00013y-Gc for submit@debbugs.gnu.org; Sat, 22 Oct 2022 07:07:22 -0400 Received: from mail.hostpark.net ([212.243.197.30]:58062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omCLW-00013o-H5 for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 07:07:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 6EA65163CB; Sat, 22 Oct 2022 13:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1666436836; bh=QP4yd/HtfDgaafR9FsjX2To9 lcCJKzcFCzhknsymIHY=; b=gNFydv7P2Ibl6PCZ0yYC5xjgAT78QhQPcxIyDvku mJsuMknmW6o+fnhV6iIBiily6cCj+QmcCfSR3WiOf3x7N6U2DhznJhWQjRUO2SMb j6evJ07jS7dil7iAEJp8dtBO97LhUvHd852OUX9Ybjds8qaXDlernWaLnJVWAq1z +BE= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id R8iyfy6lI8w4; Sat, 22 Oct 2022 13:07:16 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 3DBD6162AB; Sat, 22 Oct 2022 13:07:16 +0200 (CEST) From: Jonas Bernoulli To: Eli Zaretskii Subject: Re: bug#58363: [PATCH 3/3] Improve error data signaled by sqlite-execute et al. In-Reply-To: <83bkq4uzde.fsf@gnu.org> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-4-jonas@bernoul.li> <83bkq4uzde.fsf@gnu.org> Date: Sat, 22 Oct 2022 13:07:15 +0200 Message-ID: <87y1t8qfq4.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Jonas Bernoulli >> Date: Fri, 21 Oct 2022 23:06:36 +0200 >> >> + Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); >> + const char *errmsg = sqlite3_errmsg (sdb); >> + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, >> + errcode, ext_errcode); ^^^^ > > Is that Qnil really a good idea here? What will an error message look > like in that case? We may wish replacing Qnil with some standard > text, if it looks better. Based on some data I collected from SQLite documentation and code, this is only relevant in some rare cases: ((1 SQLITE_ERROR "SQL logic error") (2 SQLITE_INTERNAL nil) (3 SQLITE_PERM "access permission denied") (4 SQLITE_ABORT "query aborted") (5 SQLITE_BUSY "database is locked") (6 SQLITE_LOCKED "database table is locked") (7 SQLITE_NOMEM "out of memory") (8 SQLITE_READONLY "attempt to write a readonly database") (9 SQLITE_INTERRUPT "interrupted") (10 SQLITE_IOERR "disk I/O error") (11 SQLITE_CORRUPT "database disk image is malformed") (12 SQLITE_NOTFOUND "unknown operation") (13 SQLITE_FULL "database or disk is full") (14 SQLITE_CANTOPEN "unable to open database file") (15 SQLITE_PROTOCOL "locking protocol") (16 SQLITE_EMPTY nil) (17 SQLITE_SCHEMA "database schema has changed") (18 SQLITE_TOOBIG "string or blob too big") (19 SQLITE_CONSTRAINT "constraint failed") (20 SQLITE_MISMATCH "datatype mismatch") (21 SQLITE_MISUSE "bad parameter or other API misuse") (22 SQLITE_NOLFS "large file support is disabled") (23 SQLITE_AUTH "authorization denied") (24 SQLITE_FORMAT nil) (25 SQLITE_RANGE "column index out of range") (26 SQLITE_NOTADB "file is not a database") (27 SQLITE_NOTICE "notification message") (28 SQLITE_WARNING "warning message")) We would get nil for SQLITE_INTERNAL ("internal malfunction ... application should never see this"), SQLITE_EMPTY ("not currently used"), and SQLITE_FORMAT ("not currently used"). The comments in parentheses are from https://www.sqlite.org/rescode.html. We will "never" see these error codes, and if we do see 2/SQLITE_INTERNAL, it is IMO okay if the shown error is a bit ugly. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 07:46:35 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 11:46:35 +0000 Received: from localhost ([127.0.0.1]:39833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omCxW-0004EU-Sc for submit@debbugs.gnu.org; Sat, 22 Oct 2022 07:46:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omCxR-0004ED-FS for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 07:46:33 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omCxK-00050y-15; Sat, 22 Oct 2022 07:46:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=dIME3ZVtC+YYoOwRm72qxaAegH3Sm2G+1Tb6dAuGDEk=; b=A0rGmfnknvwp SZkPV8C/1dpJf/JE/6R+Gx3FTU9M+PNowNLtgNlj0JrJbvRpN2XMtalijdCMRKQ6/OZFKRLdTjbaI gEW9bCBQkKlt3R2xb0/DBQgYpZalT99jKACajUcOn3psWTKEbIHnVrnymnMk+gzWO18WdM8BiYzA+ p36GlqbFm8JkLCFhNwAL7MXXc2KIYynOpsbS0jylXXYPwT0BsaVZ3MGPDyvrLTVi0fCZeemQhKGol tVczvW3nwwOwwiGx0y1HCUpsJBAnrHABIWOFc0d6zIEN1YvHTjoAuosk4rBCrjh8oBaoM96op4GzL bMnYdqAFXzzVd4pYt2EUhg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omCwb-0000bv-NA; Sat, 22 Oct 2022 07:45:55 -0400 Date: Sat, 22 Oct 2022 14:45:39 +0300 Message-Id: <83y1t8t730.fsf@gnu.org> From: Eli Zaretskii To: Jonas Bernoulli In-Reply-To: <874jvwrvbl.fsf@bernoul.li> (message from Jonas Bernoulli on Sat, 22 Oct 2022 12:45:02 +0200) Subject: Re: bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-2-jonas@bernoul.li> <83czakuziw.fsf@gnu.org> <874jvwrvbl.fsf@bernoul.li> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jonas Bernoulli > Cc: 58363@debbugs.gnu.org > Date: Sat, 22 Oct 2022 12:45:02 +0200 > > Eli Zaretskii writes: > > >> - xsignal (Qerror, build_string ("Module name not on allowlist")); > >> + xsignal1 (Qerror, build_string ("Module name not on allowlist")); > > > > Why Qerror here and not Qsqlite_error? And if the more general Qerror > > is deliberate, then why not Qmodule_load_failed, for instance? > > This commit just fixes a bug. > Qsqlite_error is introduced in the next commit. This is one reason why I prefer a single patch to series of patches. (I believe Lars prefers that as well.) It avoids the need to review patches that are superseded by the following ones, especially when network delays cause the different parts of the series to be delivered out of sequence. So, unless this totally disrupts your workflows, please post patches as a single coherent changeset, bypassing intermediate steps that are later superseded. TIA. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 11:32:13 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 15:32:13 +0000 Received: from localhost ([127.0.0.1]:42193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omGTs-0001wg-UO for submit@debbugs.gnu.org; Sat, 22 Oct 2022 11:32:13 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omGTq-0001wX-96 for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 11:32:11 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id E5A83165D1; Sat, 22 Oct 2022 17:32:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1666452727; bh=FVh94vm9+URXGNOSo2s+DJpB +4kM31pVNesWKgS6KmI=; b=WnMYXLzLHeCOdhWmRDxOeM45CjRLOIKr9gA4P6Hn 2HlxHY8uXmzczlL02VL0SOcvaWdlBz3oUlEPwNH4fqvtedJyY2ShdYW6IL/7QEdY q9OxrHAu3CQ4UQfaTbaVQW/zVrsfcEt/0KfJjJn7XW9R1N/Xnvt/7PSD8aeqYVZb hlA= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id Vfo-Iy-4bJi8; Sat, 22 Oct 2022 17:32:07 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id B808416572; Sat, 22 Oct 2022 17:32:07 +0200 (CEST) From: Jonas Bernoulli To: Eli Zaretskii Subject: Re: bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type In-Reply-To: <83y1t8t730.fsf@gnu.org> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-2-jonas@bernoul.li> <83czakuziw.fsf@gnu.org> <874jvwrvbl.fsf@bernoul.li> <83y1t8t730.fsf@gnu.org> Date: Sat, 22 Oct 2022 17:32:07 +0200 Message-ID: <87v8obri14.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Jonas Bernoulli >> Cc: 58363@debbugs.gnu.org >> Date: Sat, 22 Oct 2022 12:45:02 +0200 >> >> Eli Zaretskii writes: >> >> >> - xsignal (Qerror, build_string ("Module name not on allowlist")); >> >> + xsignal1 (Qerror, build_string ("Module name not on allowlist")); >> > >> > Why Qerror here and not Qsqlite_error? And if the more general Qerror >> > is deliberate, then why not Qmodule_load_failed, for instance? >> >> This commit just fixes a bug. >> Qsqlite_error is introduced in the next commit. > > This is one reason why I prefer a single patch to series of patches. > (I believe Lars prefers that as well.) It avoids the need to review > patches that are superseded by the following ones, especially when > network delays cause the different parts of the series to be delivered > out of sequence. > > So, unless this totally disrupts your workflows, please post patches > as a single coherent changeset, bypassing intermediate steps that are > later superseded. TIA. I will do as you wish but I completely disagree that this is the right thing to do. But let's agree to disagree, and since you are the maintainer, you get to say how it ought to be done around here. (Is there anything you would like me to do, aside from squashing these two (or all three?) commits?) From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 11:59:25 2022 Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 15:59:25 +0000 Received: from localhost ([127.0.0.1]:42198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omGuD-0002ac-Es for submit@debbugs.gnu.org; Sat, 22 Oct 2022 11:59:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omGu9-0002aM-56 for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 11:59:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omGu3-0005rJ-3O; Sat, 22 Oct 2022 11:59:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mAxhDHWejH8ZX/nonTSVvIl+hvq06GAa75GXT/FPYg0=; b=Bk6qqmy1NSyR ovR4xdHYs/l2JyYfaL/jwqLNn5eAp3P5w874gjMhWQ4ObcXwzSwbODw8a7nf/qAfPEByka5XeRRrf UT2gFRldU/weR/FZzdUAqEgTfNkLrYRoRQfN3w9Iwn67ORsZV1+/wHzmn42YVgjXHtdlywrGCG24k VaEH3rwnviHtCRQy73ZDfJP1BhBFSDTNO8cuYPzzhxdfXgkbFwc7CFX+mDQldjIyV1DUwximgocQm diujBXMzQIYhEEJ5fkUOcdzPJEaMJLXZfO49RBtaLBQoTV+Raf1RMagcqNaWNBrNIcC+Y5rBDn5dQ lDr82O/kih+XNCFr5OBEWQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omGty-0007dR-5o; Sat, 22 Oct 2022 11:59:14 -0400 Date: Sat, 22 Oct 2022 18:59:04 +0300 Message-Id: <83r0yzu9x3.fsf@gnu.org> From: Eli Zaretskii To: Jonas Bernoulli In-Reply-To: <87v8obri14.fsf@bernoul.li> (message from Jonas Bernoulli on Sat, 22 Oct 2022 17:32:07 +0200) Subject: Re: bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-2-jonas@bernoul.li> <83czakuziw.fsf@gnu.org> <874jvwrvbl.fsf@bernoul.li> <83y1t8t730.fsf@gnu.org> <87v8obri14.fsf@bernoul.li> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58363 Cc: 58363@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jonas Bernoulli > Cc: 58363@debbugs.gnu.org > Date: Sat, 22 Oct 2022 17:32:07 +0200 > > Eli Zaretskii writes: > > > So, unless this totally disrupts your workflows, please post patches > > as a single coherent changeset, bypassing intermediate steps that are > > later superseded. TIA. > > I will do as you wish but I completely disagree that this is the > right thing to do. But let's agree to disagree, and since you are > the maintainer, you get to say how it ought to be done around here. If the request causes you significant inconvenience, I won't insist. > (Is there anything you would like me to do, aside from squashing > these two (or all three?) commits?) For these patch series, you don't need to do anything: the series is small enough to not produce any significant problems (and I think you will be submitting v2 anyway?). My request was for the future. TIA From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 24 10:39:47 2022 Received: (at 58363) by debbugs.gnu.org; 24 Oct 2022 14:39:48 +0000 Received: from localhost ([127.0.0.1]:49236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omycF-0000Kg-At for submit@debbugs.gnu.org; Mon, 24 Oct 2022 10:39:47 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omycD-0000KY-CR for 58363@debbugs.gnu.org; Mon, 24 Oct 2022 10:39:46 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id C98BB16607; Mon, 24 Oct 2022 16:39:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1666622383; bh=ZN1KFhLs10vDSmJ J9iwxdV8GGicpbAOH6FoVs86RcsU=; b=1OD6Mc5rTdi6nAXefPwX3oTb2WHQNuX pGHVT9DQ7IFTeXcqX/tX3fLPwrkfxOJO6winvHAty7JnoI5lwfvx678TDADGebvJ C6YFLkOEaIM3ECRXQ3MJGUMYf0kVmc5vWkzCdcloCR/hl7wLDk8wmNydvOuWLIdz VMT2/AULetic= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id uakULg81jNXu; Mon, 24 Oct 2022 16:39:43 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 981D316574; Mon, 24 Oct 2022 16:39:43 +0200 (CEST) From: Jonas Bernoulli To: 58363@debbugs.gnu.org Subject: [PATCH] Include more information in error data for sqlite errors Date: Mon, 24 Oct 2022 16:39:40 +0200 Message-Id: <20221024143940.21934-1-jonas@bernoul.li> X-Mailer: git-send-email 2.38.0 In-Reply-To: <87tu3twak4.fsf@bernoul.li> References: <87tu3twak4.fsf@bernoul.li> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Introduce a new 'sqlite-error' and use it for all errors signaled in 'src/sqlite.c', except those that already used 'sqlite-locked-error'. Include the values of 'sqlite3_errcode', 'sqlite3_extended_errcode', 'sqlite3_errstr' and 'sqlite3_errmsg' in the error data. * src/sqlite.c (load_dll_functions): Load 'sqlite3_extended_errcode'. (sqlite-load-extension): Use 'xsignal1' as required by argument type. (syms_of_sqlite): Introduce a new error type 'sqlite-error'. (check_sqlite, sqlite-open, bind_values, sqlite-execute) (sqlite-select, sqlite-load-extension, sqlite-next): Use it. (sqlite_prepare_errdata): New function. (sqlite_prepare_errmsg): Remove function. (sqlite-execute, sqlite-select): Use new function. (sqlite-locked-error): Derive from 'sqlite-error'. --- src/sqlite.c | 57 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/src/sqlite.c b/src/sqlite.c index 1526e344e5..d6cb38a29a 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -50,6 +50,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int64, DEF_DLL_FN (SQLITE_API int, sqlite3_bind_double, (sqlite3_stmt*, int, double)); DEF_DLL_FN (SQLITE_API int, sqlite3_bind_null, (sqlite3_stmt*, int)); DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int, (sqlite3_stmt*, int, int)); +DEF_DLL_FN (SQLITE_API int, sqlite3_extended_errcode, (sqlite3*)); DEF_DLL_FN (SQLITE_API const char*, sqlite3_errmsg, (sqlite3*)); DEF_DLL_FN (SQLITE_API const char*, sqlite3_errstr, (int)); DEF_DLL_FN (SQLITE_API int, sqlite3_step, (sqlite3_stmt*)); @@ -88,6 +89,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # undef sqlite3_bind_double # undef sqlite3_bind_null # undef sqlite3_bind_int +# undef sqlite3_extended_errcode # undef sqlite3_errmsg # undef sqlite3_errstr # undef sqlite3_step @@ -113,6 +115,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # define sqlite3_bind_double fn_sqlite3_bind_double # define sqlite3_bind_null fn_sqlite3_bind_null # define sqlite3_bind_int fn_sqlite3_bind_int +# define sqlite3_extended_errcode fn_sqlite3_extended_errcode # define sqlite3_errmsg fn_sqlite3_errmsg # define sqlite3_errstr fn_sqlite3_errstr # define sqlite3_step fn_sqlite3_step @@ -141,6 +144,7 @@ load_dll_functions (HMODULE library) LOAD_DLL_FN (library, sqlite3_bind_double); LOAD_DLL_FN (library, sqlite3_bind_null); LOAD_DLL_FN (library, sqlite3_bind_int); + LOAD_DLL_FN (library, sqlite3_extended_errcode); LOAD_DLL_FN (library, sqlite3_errmsg); LOAD_DLL_FN (library, sqlite3_errstr); LOAD_DLL_FN (library, sqlite3_step); @@ -233,13 +237,13 @@ check_sqlite (Lisp_Object db, bool is_statement) init_sqlite_functions (); CHECK_SQLITE (db); if (is_statement && !XSQLITE (db)->is_statement) - xsignal1 (Qerror, build_string ("Invalid set object")); + xsignal1 (Qsqlite_error, build_string ("Invalid set object")); else if (!is_statement && XSQLITE (db)->is_statement) - xsignal1 (Qerror, build_string ("Invalid database object")); + xsignal1 (Qsqlite_error, build_string ("Invalid database object")); if (!is_statement && !XSQLITE (db)->db) - xsignal1 (Qerror, build_string ("Database closed")); + xsignal1 (Qsqlite_error, build_string ("Database closed")); else if (is_statement && !XSQLITE (db)->db) - xsignal1 (Qerror, build_string ("Statement closed")); + xsignal1 (Qsqlite_error, build_string ("Statement closed")); } static int db_count = 0; @@ -259,7 +263,7 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, #endif if (!init_sqlite_functions ()) - xsignal1 (Qerror, build_string ("sqlite support is not available")); + xsignal1 (Qsqlite_error, build_string ("sqlite support is not available")); if (!NILP (file)) name = ENCODE_FILE (Fexpand_file_name (file, Qnil)); @@ -272,7 +276,7 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, name = CALLN (Fformat, memory_fmt, make_int (++db_count)); flags |= SQLITE_OPEN_MEMORY; #else - xsignal1 (Qerror, build_string ("sqlite in-memory is not available")); + xsignal1 (Qsqlite_error, build_string ("sqlite in-memory is not available")); #endif } @@ -342,7 +346,7 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values) if (blob) { if (SBYTES (value) != SCHARS (value)) - xsignal1 (Qerror, build_string ("BLOB values must be unibyte")); + xsignal1 (Qsqlite_error, build_string ("BLOB values must be unibyte")); ret = sqlite3_bind_blob (stmt, i + 1, SSDATA (value), SBYTES (value), NULL); @@ -422,16 +426,15 @@ row_to_value (sqlite3_stmt *stmt) } static Lisp_Object -sqlite_prepare_errmsg (int code, sqlite3 *sdb) +sqlite_prepare_errdata (int code, sqlite3 *sdb) { - Lisp_Object errmsg = build_string (sqlite3_errstr (code)); + Lisp_Object errstr = build_string (sqlite3_errstr (code)); + Lisp_Object errcode = make_fixnum (code); /* More details about what went wrong. */ - const char *sql_error = sqlite3_errmsg (sdb); - if (sql_error) - return CALLN (Fformat, build_string ("%s (%s)"), - errmsg, build_string (sql_error)); - else - return errmsg; + Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); + const char *errmsg = sqlite3_errmsg (sdb); + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, + errcode, ext_errcode); } DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, @@ -447,7 +450,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, check_sqlite (db, false); CHECK_STRING (query); if (!(NILP (values) || CONSP (values) || VECTORP (values))) - xsignal1 (Qerror, build_string ("VALUES must be a list or a vector")); + xsignal1 (Qsqlite_error, build_string ("VALUES must be a list or a vector")); sqlite3 *sdb = XSQLITE (db)->db; Lisp_Object errmsg = Qnil, @@ -466,7 +469,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, sqlite3_reset (stmt); } - errmsg = sqlite_prepare_errmsg (ret, sdb); + errmsg = sqlite_prepare_errdata (ret, sdb); goto exit; } @@ -505,7 +508,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, exit: sqlite3_finalize (stmt); xsignal1 (ret == SQLITE_LOCKED || ret == SQLITE_BUSY? - Qsqlite_locked_error: Qerror, + Qsqlite_locked_error: Qsqlite_error, errmsg); } @@ -540,7 +543,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, CHECK_STRING (query); if (!(NILP (values) || CONSP (values) || VECTORP (values))) - xsignal1 (Qerror, build_string ("VALUES must be a list or a vector")); + xsignal1 (Qsqlite_error, build_string ("VALUES must be a list or a vector")); sqlite3 *sdb = XSQLITE (db)->db; Lisp_Object retval = Qnil, errmsg = Qnil, @@ -553,7 +556,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, { if (stmt) sqlite3_finalize (stmt); - errmsg = sqlite_prepare_errmsg (ret, sdb); + errmsg = sqlite_prepare_errdata (ret, sdb); goto exit; } @@ -589,7 +592,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, exit: if (! NILP (errmsg)) - xsignal1 (Qerror, errmsg); + xsignal1 (Qsqlite_error, errmsg); return retval; } @@ -675,7 +678,7 @@ DEFUN ("sqlite-load-extension", Fsqlite_load_extension, } if (!do_allow) - xsignal (Qerror, build_string ("Module name not on allowlist")); + xsignal1 (Qsqlite_error, build_string ("Module name not on allowlist")); int result = sqlite3_load_extension (XSQLITE (db)->db, @@ -695,7 +698,7 @@ DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, int ret = sqlite3_step (XSQLITE (set)->stmt); if (ret != SQLITE_ROW && ret != SQLITE_OK && ret != SQLITE_DONE) - xsignal1 (Qerror, build_string (sqlite3_errmsg (XSQLITE (set)->db))); + xsignal1 (Qsqlite_error, build_string (sqlite3_errmsg (XSQLITE (set)->db))); if (ret == SQLITE_DONE) { @@ -794,9 +797,15 @@ syms_of_sqlite (void) defsubr (&Ssqlitep); defsubr (&Ssqlite_available_p); + DEFSYM (Qsqlite_error, "sqlite-error"); + Fput (Qsqlite_error, Qerror_conditions, + Fpurecopy (list2 (Qsqlite_error, Qerror))); + Fput (Qsqlite_error, Qerror_message, + build_pure_c_string ("Database error")); + DEFSYM (Qsqlite_locked_error, "sqlite-locked-error"); Fput (Qsqlite_locked_error, Qerror_conditions, - Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); + Fpurecopy (list3 (Qsqlite_locked_error, Qsqlite_error, Qerror))); Fput (Qsqlite_locked_error, Qerror_message, build_pure_c_string ("Database locked")); -- 2.38.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 24 13:04:36 2022 Received: (at 58363) by debbugs.gnu.org; 24 Oct 2022 17:04:36 +0000 Received: from localhost ([127.0.0.1]:49374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1on0sN-0004JF-CR for submit@debbugs.gnu.org; Mon, 24 Oct 2022 13:04:36 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1on0sJ-0004J4-11 for 58363@debbugs.gnu.org; Mon, 24 Oct 2022 13:04:32 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 9CA73165D1; Mon, 24 Oct 2022 19:04:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1666631068; bh=qu2wUHr2tE3I0+urLqSqVBZB PQlZNsjC2h92HhTL4XU=; b=zCKOafwLfnuE8dN11OY3n5+mmfXGbIxErKjYKvlX AF2W4kPXXc2apudQ7HqwQjA6AdOhmZZXrW466Ja8mE+Kn6uzuFZGJsyG6Je7fUds oJZ2iVzsDaxzmQjKwFd8Tto97V+JUELldua749UXDHikK+JEYYEhl+ITeRBVJaB6 w08= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id vk-ur7J9-Xx4; Mon, 24 Oct 2022 19:04:28 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 6983516595; Mon, 24 Oct 2022 19:04:28 +0200 (CEST) From: Jonas Bernoulli To: 58363@debbugs.gnu.org Subject: Re: [PATCH] Include more information in error data for sqlite errors In-Reply-To: <20221024143940.21934-1-jonas@bernoul.li> References: <87tu3twak4.fsf@bernoul.li> <20221024143940.21934-1-jonas@bernoul.li> Date: Mon, 24 Oct 2022 19:04:27 +0200 Message-ID: <874jvtp2zo.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58363 Cc: Lars Ingebrigtsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Lars, I accidentally send a previous mail only to Eli. Unless you object, I intend to push this in a few days. Cheers, Jonas Jonas Bernoulli writes: > Introduce a new 'sqlite-error' and use it for all errors signaled in > 'src/sqlite.c', except those that already used 'sqlite-locked-error'. > Include the values of 'sqlite3_errcode', 'sqlite3_extended_errcode', > 'sqlite3_errstr' and 'sqlite3_errmsg' in the error data. > > * src/sqlite.c (load_dll_functions): Load 'sqlite3_extended_errcode'. > (sqlite-load-extension): Use 'xsignal1' as required by argument type. > (syms_of_sqlite): Introduce a new error type 'sqlite-error'. > (check_sqlite, sqlite-open, bind_values, sqlite-execute) > (sqlite-select, sqlite-load-extension, sqlite-next): Use it. > (sqlite_prepare_errdata): New function. > (sqlite_prepare_errmsg): Remove function. > (sqlite-execute, sqlite-select): Use new function. > (sqlite-locked-error): Derive from 'sqlite-error'. > --- > src/sqlite.c | 57 ++++++++++++++++++++++++++++++---------------------- > 1 file changed, 33 insertions(+), 24 deletions(-) > > diff --git a/src/sqlite.c b/src/sqlite.c > index 1526e344e5..d6cb38a29a 100644 > --- a/src/sqlite.c > +++ b/src/sqlite.c > @@ -50,6 +50,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int64, > DEF_DLL_FN (SQLITE_API int, sqlite3_bind_double, (sqlite3_stmt*, int, double)); > DEF_DLL_FN (SQLITE_API int, sqlite3_bind_null, (sqlite3_stmt*, int)); > DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int, (sqlite3_stmt*, int, int)); > +DEF_DLL_FN (SQLITE_API int, sqlite3_extended_errcode, (sqlite3*)); > DEF_DLL_FN (SQLITE_API const char*, sqlite3_errmsg, (sqlite3*)); > DEF_DLL_FN (SQLITE_API const char*, sqlite3_errstr, (int)); > DEF_DLL_FN (SQLITE_API int, sqlite3_step, (sqlite3_stmt*)); > @@ -88,6 +89,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, > # undef sqlite3_bind_double > # undef sqlite3_bind_null > # undef sqlite3_bind_int > +# undef sqlite3_extended_errcode > # undef sqlite3_errmsg > # undef sqlite3_errstr > # undef sqlite3_step > @@ -113,6 +115,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, > # define sqlite3_bind_double fn_sqlite3_bind_double > # define sqlite3_bind_null fn_sqlite3_bind_null > # define sqlite3_bind_int fn_sqlite3_bind_int > +# define sqlite3_extended_errcode fn_sqlite3_extended_errcode > # define sqlite3_errmsg fn_sqlite3_errmsg > # define sqlite3_errstr fn_sqlite3_errstr > # define sqlite3_step fn_sqlite3_step > @@ -141,6 +144,7 @@ load_dll_functions (HMODULE library) > LOAD_DLL_FN (library, sqlite3_bind_double); > LOAD_DLL_FN (library, sqlite3_bind_null); > LOAD_DLL_FN (library, sqlite3_bind_int); > + LOAD_DLL_FN (library, sqlite3_extended_errcode); > LOAD_DLL_FN (library, sqlite3_errmsg); > LOAD_DLL_FN (library, sqlite3_errstr); > LOAD_DLL_FN (library, sqlite3_step); > @@ -233,13 +237,13 @@ check_sqlite (Lisp_Object db, bool is_statement) > init_sqlite_functions (); > CHECK_SQLITE (db); > if (is_statement && !XSQLITE (db)->is_statement) > - xsignal1 (Qerror, build_string ("Invalid set object")); > + xsignal1 (Qsqlite_error, build_string ("Invalid set object")); > else if (!is_statement && XSQLITE (db)->is_statement) > - xsignal1 (Qerror, build_string ("Invalid database object")); > + xsignal1 (Qsqlite_error, build_string ("Invalid database object")); > if (!is_statement && !XSQLITE (db)->db) > - xsignal1 (Qerror, build_string ("Database closed")); > + xsignal1 (Qsqlite_error, build_string ("Database closed")); > else if (is_statement && !XSQLITE (db)->db) > - xsignal1 (Qerror, build_string ("Statement closed")); > + xsignal1 (Qsqlite_error, build_string ("Statement closed")); > } > > static int db_count = 0; > @@ -259,7 +263,7 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, > #endif > > if (!init_sqlite_functions ()) > - xsignal1 (Qerror, build_string ("sqlite support is not available")); > + xsignal1 (Qsqlite_error, build_string ("sqlite support is not available")); > > if (!NILP (file)) > name = ENCODE_FILE (Fexpand_file_name (file, Qnil)); > @@ -272,7 +276,7 @@ DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, > name = CALLN (Fformat, memory_fmt, make_int (++db_count)); > flags |= SQLITE_OPEN_MEMORY; > #else > - xsignal1 (Qerror, build_string ("sqlite in-memory is not available")); > + xsignal1 (Qsqlite_error, build_string ("sqlite in-memory is not available")); > #endif > } > > @@ -342,7 +346,7 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values) > if (blob) > { > if (SBYTES (value) != SCHARS (value)) > - xsignal1 (Qerror, build_string ("BLOB values must be unibyte")); > + xsignal1 (Qsqlite_error, build_string ("BLOB values must be unibyte")); > ret = sqlite3_bind_blob (stmt, i + 1, > SSDATA (value), SBYTES (value), > NULL); > @@ -422,16 +426,15 @@ row_to_value (sqlite3_stmt *stmt) > } > > static Lisp_Object > -sqlite_prepare_errmsg (int code, sqlite3 *sdb) > +sqlite_prepare_errdata (int code, sqlite3 *sdb) > { > - Lisp_Object errmsg = build_string (sqlite3_errstr (code)); > + Lisp_Object errstr = build_string (sqlite3_errstr (code)); > + Lisp_Object errcode = make_fixnum (code); > /* More details about what went wrong. */ > - const char *sql_error = sqlite3_errmsg (sdb); > - if (sql_error) > - return CALLN (Fformat, build_string ("%s (%s)"), > - errmsg, build_string (sql_error)); > - else > - return errmsg; > + Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); > + const char *errmsg = sqlite3_errmsg (sdb); > + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, > + errcode, ext_errcode); > } > > DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, > @@ -447,7 +450,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, > check_sqlite (db, false); > CHECK_STRING (query); > if (!(NILP (values) || CONSP (values) || VECTORP (values))) > - xsignal1 (Qerror, build_string ("VALUES must be a list or a vector")); > + xsignal1 (Qsqlite_error, build_string ("VALUES must be a list or a vector")); > > sqlite3 *sdb = XSQLITE (db)->db; > Lisp_Object errmsg = Qnil, > @@ -466,7 +469,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, > sqlite3_reset (stmt); > } > > - errmsg = sqlite_prepare_errmsg (ret, sdb); > + errmsg = sqlite_prepare_errdata (ret, sdb); > goto exit; > } > > @@ -505,7 +508,7 @@ DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, > exit: > sqlite3_finalize (stmt); > xsignal1 (ret == SQLITE_LOCKED || ret == SQLITE_BUSY? > - Qsqlite_locked_error: Qerror, > + Qsqlite_locked_error: Qsqlite_error, > errmsg); > } > > @@ -540,7 +543,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, > CHECK_STRING (query); > > if (!(NILP (values) || CONSP (values) || VECTORP (values))) > - xsignal1 (Qerror, build_string ("VALUES must be a list or a vector")); > + xsignal1 (Qsqlite_error, build_string ("VALUES must be a list or a vector")); > > sqlite3 *sdb = XSQLITE (db)->db; > Lisp_Object retval = Qnil, errmsg = Qnil, > @@ -553,7 +556,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, > { > if (stmt) > sqlite3_finalize (stmt); > - errmsg = sqlite_prepare_errmsg (ret, sdb); > + errmsg = sqlite_prepare_errdata (ret, sdb); > goto exit; > } > > @@ -589,7 +592,7 @@ DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, > > exit: > if (! NILP (errmsg)) > - xsignal1 (Qerror, errmsg); > + xsignal1 (Qsqlite_error, errmsg); > > return retval; > } > @@ -675,7 +678,7 @@ DEFUN ("sqlite-load-extension", Fsqlite_load_extension, > } > > if (!do_allow) > - xsignal (Qerror, build_string ("Module name not on allowlist")); > + xsignal1 (Qsqlite_error, build_string ("Module name not on allowlist")); > > int result = sqlite3_load_extension > (XSQLITE (db)->db, > @@ -695,7 +698,7 @@ DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, > > int ret = sqlite3_step (XSQLITE (set)->stmt); > if (ret != SQLITE_ROW && ret != SQLITE_OK && ret != SQLITE_DONE) > - xsignal1 (Qerror, build_string (sqlite3_errmsg (XSQLITE (set)->db))); > + xsignal1 (Qsqlite_error, build_string (sqlite3_errmsg (XSQLITE (set)->db))); > > if (ret == SQLITE_DONE) > { > @@ -794,9 +797,15 @@ syms_of_sqlite (void) > defsubr (&Ssqlitep); > defsubr (&Ssqlite_available_p); > > + DEFSYM (Qsqlite_error, "sqlite-error"); > + Fput (Qsqlite_error, Qerror_conditions, > + Fpurecopy (list2 (Qsqlite_error, Qerror))); > + Fput (Qsqlite_error, Qerror_message, > + build_pure_c_string ("Database error")); > + > DEFSYM (Qsqlite_locked_error, "sqlite-locked-error"); > Fput (Qsqlite_locked_error, Qerror_conditions, > - Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); > + Fpurecopy (list3 (Qsqlite_locked_error, Qsqlite_error, Qerror))); > Fput (Qsqlite_locked_error, Qerror_message, > build_pure_c_string ("Database locked")); > > -- > 2.38.0 From unknown Fri Jun 20 07:26:31 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 22 Nov 2022 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator