all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line
@ 2017-02-17  1:22 Trent W. Buck
  2017-02-17 15:34 ` Ted Zlatanov
  2021-08-14 14:11 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Trent W. Buck @ 2017-02-17  1:22 UTC (permalink / raw)
  To: 25769

With a file /tmp/test.netrc like this:

    # -*- conf-space-keywords: "machine\\|login\\|password" -*-
    machine XM login XL password XP

    machine YM
      login YL
      password YP

The first record is parsed correctly; the second is not:

    *** Welcome to IELM ***  Type (describe-mode) for help.
    ELISP> (require 'netrc)
    netrc
    ELISP> (netrc-parse "/tmp/test.netrc")
    ((("machine" . "XM")
      ("login" . "XL")
      ("password" . "XP"))
     (("machine" . "YM"))
     (("login" . "YL"))
     (("password" . "YP")))

The python netrc parser has no problem with this:

    bash4$ python -c 'import netrc;print(netrc.netrc("/tmp/test.netrc"))'
    machine YM
            login 'YL'
            password 'YP'
    machine XM
            login 'XL'
            password 'XP'

For the last seven years I have used fugly workarounds like this:

    (eval-after-load "rcirc"
      '(setq rcirc-authinfo
             (let ((f (lambda (host)
                        (list
                         (shell-command-to-string
                          (concat
                           "python -c \"import netrc,sys; sys.stdout.write(netrc.netrc().authenticators('" host "')[0])\""))
                         (shell-command-to-string
                          (concat
                           "python -c \"import netrc,sys; sys.stdout.write(netrc.netrc().authenticators('" host "')[2])\""))))))
               `(("freenode" nickserv ,@(funcall f "irc.freenode.net"))
                 ("oftc"     nickserv ,@(funcall f "irc.oftc.net"))))))


...but now I'm finally annoyed enough to actually report this and get a formal WONTFIX.


In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu)
 of 2016-03-20 on trouble, modified by Debian
System Description:	Debian GNU/Linux 8.0 (jessie)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=no --without-gconf --without-gsettings 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_AU.utf8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  xterm-mouse-mode: t
  global-hl-todo-mode: t
  ido-everywhere: t
  savehist-mode: t
  icomplete-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading /etc/emacs/site-start.d/50pylint.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
Loading /etc/emacs/site-start.d/50w3m-el-snapshot.el (source)...done
Loading /etc/emacs/site-start.d/50yaml-mode.el (source)...done
Loading /etc/emacs/site-start.d/51debian-el.el (source)...done
Loading term/xterm...done
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Saving file /tmp/test.netrc...
Wrote /tmp/test.netrc

Load-path shadows:
/usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.5/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.5/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.5/lisp/textmodes/flyspell

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader windmove netrc eldoc paredit ielm easymenu pp
mule-util image xterm advice sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils jka-compr edmacro kmacro cl-loaddefs
cl-lib disp-table xt-mouse hl-todo ido savehist icomplete time-date
paren delsel saveplace debian-el debian-el-loaddefs w3m-load pylint
compile comint regexp-opt ansi-color ring tool-bar 50magit
emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode
dpkg-dev-el dpkg-dev-el-loaddefs tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify multi-tty emacs)

Memory information:
((conses 16 146933 5210)
 (symbols 48 20215 0)
 (miscs 40 56 107)
 (strings 32 57672 5010)
 (string-bytes 1 1690448)
 (vectors 16 9578)
 (vector-slots 8 359325 11742)
 (floats 8 84 606)
 (intervals 56 380 0)
 (buffers 960 13)
 (heap 1024 11972 909))





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

* bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line
  2017-02-17  1:22 bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line Trent W. Buck
@ 2017-02-17 15:34 ` Ted Zlatanov
  2017-02-20  0:02   ` Trent W. Buck
  2021-08-14 14:11 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2017-02-17 15:34 UTC (permalink / raw)
  To: Trent W. Buck; +Cc: 25769

On Fri, 17 Feb 2017 12:22:10 +1100 trentbuck@gmail.com (Trent W. Buck) wrote: 

TWB> ...but now I'm finally annoyed enough to actually report this and get a formal WONTFIX.

Please see
https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-12/msg00266.html
(the whole discussion is pertinent)

For your bug report specifically, maybe you mean
`auth-source-netrc-parse'? If you do mean `netrc-parse', please note
that it's only used in one place in the whole Emacs core AFAIK.
Otherwise, if you can come up with a patch against
`auth-source-netrc-parse' that handles multiline AND quoting as I
suggested, I see no problem with merging it. But I would rather not
patch or support netrc.el--better to remove it altogether.

Thanks
Ted





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

* bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line
  2017-02-17 15:34 ` Ted Zlatanov
@ 2017-02-20  0:02   ` Trent W. Buck
  2017-02-21  2:49     ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Trent W. Buck @ 2017-02-20  0:02 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: 25769

Ted Zlatanov wrote:
> On Fri, 17 Feb 2017 12:22:10 +1100 trentbuck@gmail.com (Trent W. Buck) wrote:
>
> TWB> ...but now I'm finally annoyed enough to actually report this and get a formal WONTFIX.
>
> Please see
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-12/msg00266.html
> (the whole discussion is pertinent)

Yes; I see the problem there.
This is a duplicate of that bug report.

> For your bug report specifically, maybe you mean
> `auth-source-netrc-parse'? If you do mean `netrc-parse', please note
> that it's only used in one place in the whole Emacs core AFAIK.

Ah, I didn't realize netrc.el had been replaced by auth-source.el.

As a simple test I tried feeding it my actual ~/.netrc — some entries
are newline delimited, and some are all-on-one-line — but it didn't
seem to find ANY of them:

    (auth-source-netrc-parse :file "~/.netrc") ⇒ nil

But if I open .netrc manually, go to point-min, and call

    (auth-source-netrc-parse-entries #'identity 999)

…it returns a correctly parsed list, handling comments & newlines between fields perfectly.

I'm a bit puzzled which bit of code is failing to handle newlines.
Am I missing something obvious?

(I haven't read auth.info yet because I've gotta go get it specially
due to the DFSG/GFDL dispute.)

> I would rather not patch or support netrc.el--better to remove it altogether.

Understood, and agreed.





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

* bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line
  2017-02-20  0:02   ` Trent W. Buck
@ 2017-02-21  2:49     ` Glenn Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2017-02-21  2:49 UTC (permalink / raw)
  To: Trent W. Buck; +Cc: Ted Zlatanov, 25769

"Trent W. Buck" wrote:

> Ah, I didn't realize netrc.el had been replaced by auth-source.el.

That's because it hasn't. No-one has obsoleted any netrc function, and
it's totally reasonable to assume that netrc.el is the Emacs netrc library.

As was pointed out in 12511, Emacs has multiple netrc parsers
(netrc-parse, tramp-parse-netrc, auth-source-netrc-parse,
ange-ftp-parse-netrc). It's a mess.

>> I would rather not patch or support netrc.el--better to remove it
>> altogether.

Then please start by making it obsolete and advertising a replacement.





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

* bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line
  2017-02-17  1:22 bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line Trent W. Buck
  2017-02-17 15:34 ` Ted Zlatanov
@ 2021-08-14 14:11 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-14 14:11 UTC (permalink / raw)
  To: Trent W. Buck; +Cc: 25769

trentbuck@gmail.com (Trent W. Buck) writes:

> With a file /tmp/test.netrc like this:
>
>     # -*- conf-space-keywords: "machine\\|login\\|password" -*-
>     machine XM login XL password XP
>
>     machine YM
>       login YL
>       password YP
>
> The first record is parsed correctly; the second is not:
>
>     *** Welcome to IELM ***  Type (describe-mode) for help.
>     ELISP> (require 'netrc)
>     netrc
>     ELISP> (netrc-parse "/tmp/test.netrc")
>     ((("machine" . "XM")
>       ("login" . "XL")
>       ("password" . "XP"))
>      (("machine" . "YM"))
>      (("login" . "YL"))
>      (("password" . "YP")))

This has apparently been fixed at some point after this was reported,
but I added your test case to Emacs 28, and I'm closing this bug report.

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





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

end of thread, other threads:[~2021-08-14 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17  1:22 bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line Trent W. Buck
2017-02-17 15:34 ` Ted Zlatanov
2017-02-20  0:02   ` Trent W. Buck
2017-02-21  2:49     ` Glenn Morris
2021-08-14 14:11 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.