From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: sqlite3 Date: Sun, 19 Dec 2021 16:07:25 +0200 Message-ID: <838rwg8z8i.fsf@gnu.org> References: <87tufmjyai.fsf@gnus.org> <87mtl13vz2.fsf@gnus.org> <87ilvp3tzo.fsf@gnus.org> <83wnk5gduf.fsf@gnu.org> <87r1ab1y0r.fsf@gnus.org> <83sfurejs6.fsf@gnu.org> <871r2b1vu8.fsf@gnus.org> <83o85feitv.fsf@gnu.org> <87lf0jzifm.fsf@gnus.org> <83a6gze705.fsf@gnu.org> <87k0g2xsu9.fsf@gnus.org> <871r2axqp4.fsf@gnus.org> <83sfuqb5yo.fsf@gnu.org> <87fsqoyiao.fsf@gnus.org> <83v8zk96yh.fsf@gnu.org> <87zgowvmt5.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14096"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 19 15:08:09 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mywr9-0003M1-Ee for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Dec 2021 15:08:07 +0100 Original-Received: from localhost ([::1]:57670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mywr7-0000TQ-U7 for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Dec 2021 09:08:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mywqd-0008Eb-68 for emacs-devel@gnu.org; Sun, 19 Dec 2021 09:07:35 -0500 Original-Received: from [2001:470:142:3::e] (port=34874 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mywqc-00047V-U0; Sun, 19 Dec 2021 09:07:34 -0500 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=spVPQzi/j0VXsDyccDBWU+fxQnOXeNpZ8h2WTA38H+o=; b=UROxLrXm+gmz bfMMyG1MsCQDfdXlBmtfN2Jj5DXEC1qivh/tNhuRO4SRG368irkngwm3/K5HiDbzjVpuJPYVqVR+B 6IPucEZOcvcIfmM5RsxvruhkwVx9WSkRnwlLlycBwEH2rl1tP6qv0ksKdzKwvUK5POOzNIBmTPUct xMFn/W0XK6RneE56mRANHIMCUKhbZVmQn85ar+Ir22bcu7Uz+65TCzgsS3fx2ODXx0pFT08S9UXra Hh0e00jFS+msBXWZEQztk/L+bd4W4hYDjwja0dJAEmZvRarNjaquscTBtNyxwMXtU5qviYjXgCbw1 wXeAeKsqIV79wmjuFHW81g==; Original-Received: from [87.69.77.57] (port=1106 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 1mywqc-0005Jm-Pb; Sun, 19 Dec 2021 09:07:35 -0500 In-Reply-To: <87zgowvmt5.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 19 Dec 2021 12:47:18 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:282436 Archived-At: > From: Lars Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Sun, 19 Dec 2021 12:47:18 +0100 > > Eli Zaretskii writes: > > > We could invent a new symbol for EACCES (like 'file-missing' for > > ENOENT we already have), and return that instead in this case, instead > > of the general 'file-error'. > > Yes, I think that would be a good idea. Is the below good enough? If so, I will install it. diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index f848218..9dd052c 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -98,6 +98,10 @@ Standard Errors @item file-already-exists This is a subcategory of @code{file-error}. @xref{Writing to Files}. +@item permission-denied +This is a subcategory of @code{file-error}, which occurs when the OS +doesn't allow Emacs to access a file or a directory for some reason. + @item file-date-error This is a subcategory of @code{file-error}. It occurs when @code{copy-file} tries and fails to set the last-modification time of diff --git a/etc/NEWS b/etc/NEWS index 862621a..24f3da8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1186,6 +1186,12 @@ The events 'touchscreen-begin, 'touchscreen-update', and 'touchscreen-end' have been added to take better advantage of touch-capable display panels. ++++ +** New error symbol 'permission-denied'. +This is a subcategory of 'file-error', and is signaled when some file +operation fails because the OS doesn't allow Emacs to access a file or +a directory. + * Changes in Emacs 29.1 on Non-Free Operating Systems diff --git a/src/fileio.c b/src/fileio.c index a0563cc..03977ae 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -195,7 +195,11 @@ get_file_errno_data (char const *string, Lisp_Object name, int errorno) if (errorno == EEXIST) return Fcons (Qfile_already_exists, errdata); else - return Fcons (errorno == ENOENT ? Qfile_missing : Qfile_error, + return Fcons (errorno == ENOENT + ? Qfile_missing + : (errorno == EACCES + ? Qpermission_denied + : Qfile_error), Fcons (build_string (string), errdata)); } @@ -6380,6 +6384,7 @@ syms_of_fileio (void) DEFSYM (Qfile_already_exists, "file-already-exists"); DEFSYM (Qfile_date_error, "file-date-error"); DEFSYM (Qfile_missing, "file-missing"); + DEFSYM (Qpermission_denied, "permission-denied"); DEFSYM (Qfile_notify_error, "file-notify-error"); DEFSYM (Qremote_file_error, "remote-file-error"); DEFSYM (Qexcl, "excl");