unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs 29: Package netrc is deprecated
@ 2024-05-06 19:43 Steinar Bang
  2024-05-07  2:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 8+ messages in thread
From: Steinar Bang @ 2024-05-06 19:43 UTC (permalink / raw)
  To: help-gnu-emacs

Just upgraded from emacs 28 to emacs 29.3 and got the minibuffer
message:
 Package netrc is deprecated

Here is my netrc usage (it is to retrieve the username and password for
my wordpress blog for use with org2blog):

;; org-mode blogging setup
(when (and
       (locate-library "org2blog")
       (locate-library "metaweblog"))
  (require 'org2blog)
  (require 'netrc)
  (if (locate-library "ox-wp")
      (load-library "ox-wp"))
  (setq blog (netrc-machine (netrc-parse netrc-file) "blog.mydomain.com" t))
  (setq org2blog/wp-blog-alist
        (list
         (list "blogs-blogg"
               :url "http://blog.mydomain.com/xmlrpc.php"
               :username (netrc-get blog "login")
               :password (netrc-get blog "password")))))

Any suggestions for what i should replace netrc with are appreciated.

According to git I set this up om May 1 2012 so it is hard to remember
what I was thinking back then and why I used the netrc package (I
probably just wanted to get it working and, once it did, promptly forgot
about it).

Thanks!


- Steinar



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-06 19:43 Emacs 29: Package netrc is deprecated Steinar Bang
@ 2024-05-07  2:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-05-07 14:58   ` Steinar Bang
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-05-07  2:47 UTC (permalink / raw)
  To: help-gnu-emacs

>  Package netrc is deprecated
[...]
>   (setq blog (netrc-machine (netrc-parse netrc-file) "blog.mydomain.com" t))
[...]
> Any suggestions for what i should replace netrc with are appreciated.

The replacement package is `auth-source`.
`netrc-parse` says it's replaced by `auth-source-netrc-parse-all`.


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-07  2:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-05-07 14:58   ` Steinar Bang
  2024-05-07 15:12     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-05-14  7:35     ` Robert Pluim
  0 siblings, 2 replies; 8+ messages in thread
From: Steinar Bang @ 2024-05-07 14:58 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:

> The replacement package is `auth-source`.
> `netrc-parse` says it's replaced by `auth-source-netrc-parse-all`.

Thanks!  Got me part of the way (so far)

auth-source-netrc-parse-all seems to return a compatible result to what
netrc-parse returns.

But there were no replacements for netrc-machine and netrc-get that I
could see?

netrc-get is trivial, netrc-machine less so (though I could copy the
current one out of the emac source, I guess..? I would prefer not to).

In the auth-source code there is lots of talk about backends, which I
assume are Gnus backends, and little/nothing about using it as a netrc
file parser.

The experimentation/digging continues.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-07 14:58   ` Steinar Bang
@ 2024-05-07 15:12     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-05-19 11:36       ` Steinar Bang
  2024-05-14  7:35     ` Robert Pluim
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-05-07 15:12 UTC (permalink / raw)
  To: help-gnu-emacs

> In the auth-source code there is lots of talk about backends, which I
> assume are Gnus backends, and little/nothing about using it as a netrc
> file parser.

I don't know if that assumption is correct.  I think it's talking about
various services/formats to store credentials, where `~/.netrc` is just
one (old) such backend.


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-07 14:58   ` Steinar Bang
  2024-05-07 15:12     ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-05-14  7:35     ` Robert Pluim
  2024-05-19 11:58       ` Steinar Bang
  1 sibling, 1 reply; 8+ messages in thread
From: Robert Pluim @ 2024-05-14  7:35 UTC (permalink / raw)
  To: Steinar Bang; +Cc: help-gnu-emacs

>>>>> On Tue, 07 May 2024 16:58:33 +0200, Steinar Bang <sb@dod.no> said:

>>>>> Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:
    >> The replacement package is `auth-source`.
    >> `netrc-parse` says it's replaced by `auth-source-netrc-parse-all`.

    Steinar> Thanks!  Got me part of the way (so far)

    Steinar> auth-source-netrc-parse-all seems to return a compatible result to what
    Steinar> netrc-parse returns.

    Steinar> But there were no replacements for netrc-machine and netrc-get that I
    Steinar> could see?

    Steinar> netrc-get is trivial, netrc-machine less so (though I could copy the
    Steinar> current one out of the emac source, I guess..? I would prefer not to).

(auth-source-search :host "my.host.com" :port 993)

(I guess the return format is different)

    Steinar> In the auth-source code there is lots of talk about backends, which I
    Steinar> assume are Gnus backends, and little/nothing about using it as a netrc
    Steinar> file parser.

No, theyʼre auth source backends. .netrc, .authinfo, 'passʼ, oauth2
etc.

Robert
-- 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-07 15:12     ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-05-19 11:36       ` Steinar Bang
  0 siblings, 0 replies; 8+ messages in thread
From: Steinar Bang @ 2024-05-19 11:36 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:

>> In the auth-source code there is lots of talk about backends, which I
>> assume are Gnus backends, and little/nothing about using it as a netrc
>> file parser.

> I don't know if that assumption is correct.  I think it's talking about
> various services/formats to store credentials, where `~/.netrc` is just
> one (old) such backend.

I see! Thanks!



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-14  7:35     ` Robert Pluim
@ 2024-05-19 11:58       ` Steinar Bang
  2024-05-20  9:10         ` Robert Pluim
  0 siblings, 1 reply; 8+ messages in thread
From: Steinar Bang @ 2024-05-19 11:58 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Robert Pluim <rpluim@gmail.com>:

> (auth-source-search :host "my.host.com" :port 993)

> (I guess the return format is different)

Yep! But getting that function name put me on the track to a solution! :-)

Thanks!

The function name landed me here: https://www.gnu.org/software/emacs/manual/html_mono/auth.html

From examples there I replaced 
  (setq blog (netrc-machine (netrc-parse netrc-file) "blog.mydomain.com" t))
with
  (setq blog (car (auth-source-search :host "blog.mydomain.com")))
and
         (list "my-blog"
               :url "http://blog.mydomain.com/xmlrpc.php"
               :username (netrc-get blog "login")
               :password (netrc-get blog "password")))))
with
         (list "my-blog"
               :url "http://blog.mydomain.com/xmlrpc.php"
               :username (plist-get blog :user)
               :password (auth-info-password blog)))))

plist-get can be used for all clear text entries in the return from auth-source-search

auth-info-password also unobfuscates the password.

Full config here: https://gist.github.com/steinarb/e844560f5850612361431b4cdc1ffbec
Diff here: https://gist.github.com/steinarb/258106dbce7052ec8cd6c831aedc17a1

Steinar> In the auth-source code there is lots of talk about backends, which I
Steinar> assume are Gnus backends, and little/nothing about using it as a netrc
Steinar> file parser.

> No, theyʼre auth source backends. .netrc, .authinfo, 'passʼ, oauth2
> etc.

Right! Since there is now no mention of netrc anywhere in the config, I
can presumably transparently search and use any auth source supported by
emacs?  At least: any auth source that can somehow return a clear text
password?

Thanks again!



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Emacs 29: Package netrc is deprecated
  2024-05-19 11:58       ` Steinar Bang
@ 2024-05-20  9:10         ` Robert Pluim
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Pluim @ 2024-05-20  9:10 UTC (permalink / raw)
  To: Steinar Bang; +Cc: help-gnu-emacs

>>>>> On Sun, 19 May 2024 13:58:03 +0200, Steinar Bang <sb@dod.no> said:

    Steinar> Right! Since there is now no mention of netrc anywhere in the config, I
    Steinar> can presumably transparently search and use any auth source supported by
    Steinar> emacs?  At least: any auth source that can somehow return a clear text
    Steinar> password?

Yes, via appropriate customization of `auth-sources'. As far as I know
all the backends can return clear text passwords.

Robert
-- 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-20  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 19:43 Emacs 29: Package netrc is deprecated Steinar Bang
2024-05-07  2:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-05-07 14:58   ` Steinar Bang
2024-05-07 15:12     ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-05-19 11:36       ` Steinar Bang
2024-05-14  7:35     ` Robert Pluim
2024-05-19 11:58       ` Steinar Bang
2024-05-20  9:10         ` Robert Pluim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).