Subject: bug#25769: 24.5; netrc-parse assumes machine/login/password all appear on one line

From: [email-masked] (Trent W. Buck)
Date: Fri, 17 Feb 2017 12:22:10 +1100

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))