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.bugs Subject: bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode Date: Sun, 19 Mar 2023 16:11:02 +0200 Message-ID: <83jzzcal1l.fsf@gnu.org> References: <87v8iynl5c.fsf@ledu-giraud.fr> <83h6uiawvv.fsf@gnu.org> <87r0tlnbtz.fsf@ledu-giraud.fr> <83bkkpc2x6.fsf@gnu.org> <83a609c2q7.fsf@gnu.org> <87ilexn9tc.fsf@ledu-giraud.fr> <838rftbzj3.fsf@gnu.org> <837cvdbykw.fsf@gnu.org> <87edplm0ft.fsf@ledu-giraud.fr> <83sfe19bmk.fsf@gnu.org> <87r0tksyma.fsf@gmx.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22836"; mail-complaints-to="usenet@ciao.gmane.io" Cc: manuel@ledu-giraud.fr, 62260@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 19 15:12:21 2023 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 1pdtlk-0005kK-QI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Mar 2023 15:12:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdtlU-0007EO-Tu; Sun, 19 Mar 2023 10:12:04 -0400 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 1pdtlT-0007EE-55 for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2023 10:12:03 -0400 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 1pdtlS-0007kf-T1 for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2023 10:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pdtlS-0004y1-Am for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2023 10:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Mar 2023 14:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62260 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62260-submit@debbugs.gnu.org id=B62260.167923506519014 (code B ref 62260); Sun, 19 Mar 2023 14:12:02 +0000 Original-Received: (at 62260) by debbugs.gnu.org; 19 Mar 2023 14:11:05 +0000 Original-Received: from localhost ([127.0.0.1]:52546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdtkX-0004wc-6G for submit@debbugs.gnu.org; Sun, 19 Mar 2023 10:11:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdtkU-0004w7-Pr for 62260@debbugs.gnu.org; Sun, 19 Mar 2023 10:11:03 -0400 Original-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 1pdtkO-0005lK-L0; Sun, 19 Mar 2023 10:10:56 -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=yTNliXfTWcu827C8wuWeKrtZnTLp8F4mSCAGWSPa/KE=; b=Ok1rLMn3/w8R 2EXZOyZtnQSWhoOHSZ2EPHUoUNFJfqfQzc+N4jtehGOuhwhvRiOURBk5uHiWe01RcNNmsStYpf/Yj +fl9WBMp9/VQe9mmSwAjlZYsjSoez36d8VcH+mSPPI0YCYJd1Isd+rCDRxuYVA7xMGeLVUCnBUgdi DZqPl+0zWdwqV6ZYukqwcm87xoP6nLLeuQH9uSmt5jzg5xBU18ospcx49u4JL2H72hQx8LfUn88q4 j2N/fTRgm98AZK9plL3dwo77WcIZD2lu4YZ2pDYSx9rF4loIagira4a6GAiWwQFxSktYzvXG5qv7R VJdT1F85pYijlkD6uG9oVg==; Original-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 1pdtkO-0003XA-5r; Sun, 19 Mar 2023 10:10:56 -0400 In-Reply-To: <87r0tksyma.fsf@gmx.de> (message from Michael Albinus on Sun, 19 Mar 2023 13:40:29 +0100) 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:258238 Archived-At: > From: Michael Albinus > Cc: Manuel Giraud , 62260@debbugs.gnu.org > Date: Sun, 19 Mar 2023 13:40:29 +0100 > > Tramp has no influence on the permissions of the auto-saved file. My reading of the code in auto_save_1 is that the permission modes of the auto-saved files for remote files are determined from their original files, by calling file-modes (which I believe Tramp implements?). See the 'else' branch of this part of auto_save_1: /* Get visited file's mode to become the auto save file's mode. */ if (! NILP (BVAR (current_buffer, filename))) { if (emacs_fstatat (AT_FDCWD, SSDATA (BVAR (current_buffer, filename)), &st, 0) == 0) /* But make sure we can overwrite it later! */ auto_save_mode_bits = (st.st_mode | 0600) & 0777; else if (modes = Ffile_modes (BVAR (current_buffer, filename), Qnil), FIXNUMP (modes)) /* Remote files don't cooperate with fstatat. */ auto_save_mode_bits = (XFIXNUM (modes) | 0600) & 0777; } If by "Tramp has no influence on the permissions of the auto-saved file" you mean the permissions are determined by the file, not by Tramp, then I agree. This simply follows what we do with local files, just by calling an Emacs primitive instead of fstatat.