bug#22906: 24.5; eww SGML validate error

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#22906: 24.5; eww SGML validate error

Live System User

Hi,

While just playing around with eww...

When using eww on https://www.fsf.org and clicking on menus:

  Eww->View page source
  SGML->Validate

I get the error:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string("[^-0-9a-zA-Z_./\n]" "\\\\\\&" nil)
  shell-quote-argument(nil)
  (concat sgml-validate-command " " (shell-quote-argument (let ((name (buffer-file-name))) (and name (file-name-nondirectory name)))))
  (or sgml-saved-validate-command (concat sgml-validate-command " " (shell-quote-argument (let ((name (buffer-file-name))) (and name (file-name-nondirectory name))))))
  (read-string "Validate command: " (or sgml-saved-validate-command (concat sgml-validate-command " " (shell-quote-argument (let ((name (buffer-file-name))) (and name (file-name-nondirectory name)))))))
  (list (read-string "Validate command: " (or sgml-saved-validate-command (concat sgml-validate-command " " (shell-quote-argument (let ((name ...)) (and name (file-name-nondirectory name))))))))
  call-interactively(sgml-validate nil nil)
  command-execute(sgml-validate)




In GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.18.7)
 of 2016-02-03 on buildhw-05.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11799901
Configured using:
 `configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -m64 -mtune=generic' LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail epa-file epa derived epg
epg-config auth-source eieio byte-opt bytecomp byte-compile cl-extra
cconv eieio-core sieve sieve-mode sieve-manage password-cache nnir
gnus-sum gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec
gnus-int gnus-range message format-spec rfc822 mml easymenu mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems
wid-edit cl-loaddefs cl-lib nnoo nnheader gnus-util mm-util help-fns
mail-prsvr mail-utils misearch multi-isearch time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
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 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 122422 11314)
 (symbols 48 23829 0)
 (miscs 40 41 143)
 (strings 32 26352 4090)
 (string-bytes 1 846056)
 (vectors 16 16033)
 (vector-slots 8 451957 8256)
 (floats 8 161 304)
 (intervals 56 339 9)
 (buffers 960 12)
 (heap 1024 20539 998))



Reply | Threaded
Open this post in threaded view
|

bug#22906: 24.5; eww SGML validate error

Simen Heggestøyl-2
I can reproduce this on the current master branch (ec12c670).

The issue seems to be that `sgml-validate' assumes that the buffer is
visiting a file, which is not the case when you view a web page's source
from eww.

Maybe we could offer to save the buffer when it's not visiting a file?

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 990c09b..b98db7e 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1109,8 +1109,10 @@ sgml-validate
   " "
   (shell-quote-argument
    (let ((name (buffer-file-name)))
-     (and name
-  (file-name-nondirectory name)))))))))
+                                     (unless name
+                                       (save-buffer)
+                                       (setq name (buffer-file-name)))
+     (file-name-nondirectory name))))))))
   (setq sgml-saved-validate-command command)
   (save-some-buffers (not compilation-ask-about-save) nil)
   (compilation-start command))


-- Simen



Reply | Threaded
Open this post in threaded view
|

bug#22906: 24.5; eww SGML validate error

Lars Ingebrigtsen
Simen Heggestøyl <[hidden email]> writes:

> I can reproduce this on the current master branch (ec12c670).
>
> The issue seems to be that `sgml-validate' assumes that the buffer is
> visiting a file, which is not the case when you view a web page's source
> from eww.
>
> Maybe we could offer to save the buffer when it's not visiting a file?

I think that would be unusual for commands like this (that have to be
written out to work).  Instead it could save the buffer to a temporary
file, validate and then delete it again.

I'm not sure it's worth it, though.

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



Reply | Threaded
Open this post in threaded view
|

bug#22906: 24.5; eww SGML validate error

Lars Ingebrigtsen
Lars Ingebrigtsen <[hidden email]> writes:

>> I can reproduce this on the current master branch (ec12c670).
>>
>> The issue seems to be that `sgml-validate' assumes that the buffer is
>> visiting a file, which is not the case when you view a web page's source
>> from eww.
>>
>> Maybe we could offer to save the buffer when it's not visiting a file?
>
> I think that would be unusual for commands like this (that have to be
> written out to work).  Instead it could save the buffer to a temporary
> file, validate and then delete it again.

Actually, looking at the code again, I think it's just a simple bug.  It
checks whether buffer-file-name is non-nil, but then it ends up with
(shell-quote-argument nil), which is invalid.

I've now fixed this in Emacs 28.

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