From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Hyatt Newsgroups: gmane.emacs.bugs Subject: bug#59346: Adding sqlite-backup Date: Fri, 18 Nov 2022 09:05:58 -0300 Message-ID: References: <837czsd7sr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000006b37b05edbd8808" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1265"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59346@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 18 13:07:32 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow09a-00005A-On for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Nov 2022 13:07:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ow09A-0005T3-Hr; Fri, 18 Nov 2022 07:07:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow098-0005S6-Ov for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 07:07:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ow098-0000Kd-Gi for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 07:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ow098-00033P-Bw for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 07:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Nov 2022 12:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59346 X-GNU-PR-Package: emacs Original-Received: via spool by 59346-submit@debbugs.gnu.org id=B59346.166877317911666 (code B ref 59346); Fri, 18 Nov 2022 12:07:02 +0000 Original-Received: (at 59346) by debbugs.gnu.org; 18 Nov 2022 12:06:19 +0000 Original-Received: from localhost ([127.0.0.1]:35542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow08Q-000326-Ju for submit@debbugs.gnu.org; Fri, 18 Nov 2022 07:06:19 -0500 Original-Received: from mail-yb1-f176.google.com ([209.85.219.176]:38575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow08O-00031s-9F for 59346@debbugs.gnu.org; Fri, 18 Nov 2022 07:06:17 -0500 Original-Received: by mail-yb1-f176.google.com with SMTP id v123so5398582ybv.5 for <59346@debbugs.gnu.org>; Fri, 18 Nov 2022 04:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IvonamIerSDIPc2BFwGB9jwXohqkv01eQM6NrQMy0kM=; b=g1QkBNyV0zI2py4x45u5o2nDPypjenKBh3BWtXOVxe9kG5ztC7AFwVSD2kpjPgTP2R AD8WyibsA1qz48YNNnBfHGJDvcE81+ly64mZQ8NPVOPGeGp/z21crCNqBzDIFTXz/+OI ZaYuxvSHKwRUhmDUhjDquOkq0osxVXd7NdfEC0CykVFRIc47U+St0XQr/sEtmO8mmmf1 msGLQZpOlVLnh0UcEnlEC7mlKkJv/xBeoKiq3dI3YbodcCeCI3CERch/BGZiASHaIeeo meldWSX9wbWVhhaGIdDv5q/xEoIppOmJAS30r3XsaaTkOajLshLTfqsC5iZuFIoBjAPd wmng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IvonamIerSDIPc2BFwGB9jwXohqkv01eQM6NrQMy0kM=; b=UdXfwuOfwveJ9fL6b+ETVtOpriusIlxW4mdSBITglUUmCqAlBFOrkNP529EKLVZDcX VJlESKRJP41R8Edisaav6O5E97Mg8fezRHzD41BwTylP6g3h7GyFtmSehWrOtXRYrxm7 HxEhKBc8xkSMvoJUnNU90ndb0UzeuXAtavhEWFTRf3PXWU8RqhCkaIrSrkxxqkEOld0a skAllMqevMe8okWDMTDJ9VmUwEkwcQUs0Vrefr7ACxdKajTeb1CykKggB1CNOt0WYDZ+ wJxCSdDygC+MiqgQT8aPrXlncwYk7nP5vHBlyXZ3pxsqcZ4+hCCuFwS9tAT6pI1/08r8 nDSQ== X-Gm-Message-State: ANoB5plbQOjsTugyjJpT7+KUhCQRejldJkRcJs7Ixu5fZ/BOU/m9SSwq yRDqs+fA+PRE0QxdHU3NvqoCA3wO1mBAjk6mmFswYIlNLOQ= X-Google-Smtp-Source: AA0mqf7gPgsSI5pYFs5ATDwc0tlk0UO771H9cJimEF5aKAuWSitqd3qOub5MpJfabXRrFcTUAW+3VkkEnebsWbCnyMA= X-Received: by 2002:a25:6641:0:b0:6ca:b03:7111 with SMTP id z1-20020a256641000000b006ca0b037111mr6062100ybm.598.1668773170293; Fri, 18 Nov 2022 04:06:10 -0800 (PST) In-Reply-To: <837czsd7sr.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248213 Archived-At: --00000000000006b37b05edbd8808 Content-Type: text/plain; charset="UTF-8" On Fri, Nov 18, 2022 at 4:46 AM Eli Zaretskii wrote: > > From: Andrew Hyatt > > Date: Thu, 17 Nov 2022 23:40:11 -0300 > > > > Currently there's no great way to perform a proper backup of a sqlite > database if you use the built-in sqlite in > > emacs 29. If you just copy the file, there's a chance another database > user is in the middle of something, > > and the database could be corrupted. > > > > I've included a patch that fixes this. I would the sqlite-backup > function to exist so I can use it in the ELPA > > triples package. > > Thanks, but I'm not sure Emacs should support DB administration > functions of sqlite. Aren't there utilities out there which can be > used for this? Why should we have this built-in in Emacs? why not > simply use shell-command or somesuch to invoke the necessary external > program? > Good questions. Let me respond to your two questions: why does emacs need to be involved in backups, and why can't it control backups some other way? Emacs already has a file backup facility, but if emacs is primarily working with data in sqlite, there is no mechanism for backups, which seems scary to me. I'd like modules that rely on sqlite for data to be able to back up their data, because the user would like to have some security, knowing if something goes wrong they can always restore a recent backup. But why can't we do this by invoking backup via the binary? Certainly a possibility, and in fact that's how I would implement it if the sqlite library was instead emacsql-sqlite. However, I have no idea how to locate the binary; that isn't part of the current built-in sqlite implementation. For good reason, too, it's a built-in implementation, including a variable holding the executable path seems odd. I could add one, but this solution seems better to me, since it doubles down on the built-in sqlite, and doesn't provide an alternative mechanism for doing things with sqlite. Hope this clarifies things, let me know if you have any other questions. --00000000000006b37b05edbd8808 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Nov 18, 2022 at 4:46 AM Eli Zaret= skii <eliz@gnu.org> wrote:
> From: Andrew Hyatt <ahyatt@gmail.com>
> Date: Thu, 17 Nov 2022 23:40:11 -0300
>
> Currently there's no great way to perform a proper backup of a sql= ite database if you use the built-in sqlite in
> emacs 29.=C2=A0 If you just copy the file, there's a chance anothe= r database user is in the middle of something,
> and the database could be corrupted.
>
> I've included a patch that fixes this. I would the sqlite-backup f= unction to exist so I can use it in the ELPA
> triples package.

Thanks, but I'm not sure Emacs should support DB administration
functions of sqlite.=C2=A0 Aren't there utilities out there which can b= e
used for this?=C2=A0 Why should we have this built-in in Emacs? why not
simply use shell-command or somesuch to invoke the necessary external
program?

Good questions. Let me respond= to your two questions: why does emacs need to be involved in backups, and = why can't it control backups some other way?

E= macs already has a file backup facility, but if emacs is primarily working = with data in sqlite, there is no mechanism for backups, which seems scary t= o me.=C2=A0 I'd like modules that rely on sqlite for data to be able to= back up their data,=C2=A0because the user would like to have some security= , knowing if something goes wrong they can always restore a recent backup.<= /div>

But why can't we do this by invoking backup vi= a the binary?=C2=A0 Certainly a possibility, and in fact that's how I w= ould implement it if the=C2=A0sqlite library was instead emacsql-sqlite.=C2= =A0 However, I have no idea how to locate the binary; that isn't part o= f the current built-in sqlite implementation.=C2=A0 For good reason, too, i= t's a built-in implementation, including a variable holding the executa= ble path seems odd.=C2=A0 I could add one, but this solution seems better t= o me, since it doubles down on the built-in sqlite, and doesn't provide= an alternative mechanism for doing things with sqlite.

Hope this clarifies things, let me know if you have any other questio= ns.

--00000000000006b37b05edbd8808--