GNU bug report logs - #51579
Mark variable as safe only in one file or directory

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Wed, 3 Nov 2021 04:11:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 51579 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51579; Package emacs. (Wed, 03 Nov 2021 04:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Nov 2021 04:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: Mark variable as safe only in one file or directory
Date: Tue, 2 Nov 2021 21:10:03 -0700
Severity: wishlist

I'd like a way to mark a variable as safe only when read from a
particular directory or file.

I create a .dir-locals.el file with some unsafe variable, e.g.

tmp=`mktemp -d`
echo "((nil . ((epa-file-cache-passphrase-for-symmetric-encryption . t))))" \
    > $tmp/.dir-locals.el
echo $tmp

Now I visit a file in the created directory and get this message:

     The local variables list in /tmp/tmp.qakuGgnFPH/
     contains values that may not be safe (*).

     Do you want to apply it?  You can type
     y  -- to apply the local variables list.
     n  -- to ignore the local variables list.
     !  -- to apply the local variables list, and permanently mark these
           values (*) as safe (in the future, they will be set automatically.)
     i  -- to ignore the local variables list, and permanently mark these
           values (*) as ignored

       * epa-file-cache-passphrase-for-symmetric-encryption : t

According to (info "(emacs) Safe File Variables"), hitting "i" means
that:

       You can also tell Emacs to permanently ignore all the variable/value
    pairs in the file, by typing ā€˜i’ at the confirmation prompt – these
    pairs will thereafter be ignored in this file and in all other files.

I would like to be able to mark this variable/value pair as safe *only*
when read from this file, and not in any file.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51579; Package emacs. (Thu, 04 Nov 2021 18:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 51579 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 51579 <at> debbugs.gnu.org
Subject: Re: bug#51579: Mark variable as safe only in one file or directory
Date: Thu, 04 Nov 2021 19:10:16 +0100
Stefan Kangas <stefan <at> marxist.se> writes:

> I would like to be able to mark this variable/value pair as safe *only*
> when read from this file, and not in any file.

Yes, that sounds like a good idea to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.