unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#67764: 30.0.50; Opening image in eww no longer works
@ 2023-12-11  6:26 john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-12-11 11:40 ` Visuwesh
  0 siblings, 1 reply; 8+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-12-11  6:26 UTC (permalink / raw)
  To: 67764

In Emacs 29.1 the image opens as expected:

  emacs -Q
  M-: (eww "https://www.gnu.org/software/emacs/images/emacs.png")

On master it fails with "Wrong type argument: stringp, nil".
Bisect says 4254544 is the first bad commit.


In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2023-12-11 built on localhost
Repository revision: cd702556759b33662cd6536c89ef02ddcd93d4ff
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12302002
System Description: Fedora Linux 39 (Thirty Nine)

Configured using:
 'configure --with-native-compilation=no'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS
HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT
MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB






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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-11  6:26 bug#67764: 30.0.50; Opening image in eww no longer works john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-12-11 11:40 ` Visuwesh
  2023-12-11 15:03   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-12-11 15:47   ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Visuwesh @ 2023-12-11 11:40 UTC (permalink / raw)
  To: john muhl; +Cc: 67764

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

[Monday December 11, 2023] john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> In Emacs 29.1 the image opens as expected:
>
>   emacs -Q
>   M-: (eww "https://www.gnu.org/software/emacs/images/emacs.png")
>
> On master it fails with "Wrong type argument: stringp, nil".
> Bisect says 4254544 is the first bad commit.

Recent changes in shr-put-image didn't account for the possible nil
value for ALT.  Attached patch fixes the issue on my end.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-shr-put-image-with-nil-value-for-ALT.patch --]
[-- Type: text/x-diff, Size: 885 bytes --]

From f6d3fc0de572a1039e83df0389c1c7efce0ef0cf Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Mon, 11 Dec 2023 17:09:03 +0530
Subject: [PATCH] ; Fix shr-put-image with nil value for ALT

* lisp/net/shr.el (shr-put-image): Account for nil value for ALT.
(Bug#6774)
---
 lisp/net/shr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 9f030b4c743..19c52ac8802 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1137,7 +1137,7 @@ shr-put-image
         (when image
           ;; The trailing space can confuse shr-insert into not
           ;; putting any space after inline images.
-	  (setq alt (string-trim alt))
+	  (setq alt (string-trim (or alt "*")))
 	  ;; When inserting big-ish pictures, put them at the
 	  ;; beginning of the line.
 	  (let ((inline (shr--inline-image-p image)))
-- 
2.42.0


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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-11 11:40 ` Visuwesh
@ 2023-12-11 15:03   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-12-11 15:47   ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-12-11 15:03 UTC (permalink / raw)
  To: Visuwesh; +Cc: 67764

Visuwesh <visuweshm@gmail.com> writes:

> [Monday December 11, 2023] john muhl via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" wrote:
>
>> In Emacs 29.1 the image opens as expected:
>>
>>   emacs -Q
>>   M-: (eww "https://www.gnu.org/software/emacs/images/emacs.png")
>>
>> On master it fails with "Wrong type argument: stringp, nil".
>> Bisect says 4254544 is the first bad commit.
>
> Recent changes in shr-put-image didn't account for the possible nil
> value for ALT.  Attached patch fixes the issue on my end.

Thanks. That fixes it here too.





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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-11 11:40 ` Visuwesh
  2023-12-11 15:03   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-12-11 15:47   ` Eli Zaretskii
  2023-12-12  4:12     ` Visuwesh
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2023-12-11 15:47 UTC (permalink / raw)
  To: Visuwesh; +Cc: 67764, jm

> Cc: 67764@debbugs.gnu.org
> From: Visuwesh <visuweshm@gmail.com>
> Date: Mon, 11 Dec 2023 17:10:01 +0530
> 
> >   emacs -Q
> >   M-: (eww "https://www.gnu.org/software/emacs/images/emacs.png")
> >
> > On master it fails with "Wrong type argument: stringp, nil".
> > Bisect says 4254544 is the first bad commit.
> 
> Recent changes in shr-put-image didn't account for the possible nil
> value for ALT.  Attached patch fixes the issue on my end.
> 
> 
> >From f6d3fc0de572a1039e83df0389c1c7efce0ef0cf Mon Sep 17 00:00:00 2001
> From: Visuwesh <visuweshm@gmail.com>
> Date: Mon, 11 Dec 2023 17:09:03 +0530
> Subject: [PATCH] ; Fix shr-put-image with nil value for ALT
> 
> * lisp/net/shr.el (shr-put-image): Account for nil value for ALT.
> (Bug#6774)
> ---
>  lisp/net/shr.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
> index 9f030b4c743..19c52ac8802 100644
> --- a/lisp/net/shr.el
> +++ b/lisp/net/shr.el
> @@ -1137,7 +1137,7 @@ shr-put-image
>          (when image
>            ;; The trailing space can confuse shr-insert into not
>            ;; putting any space after inline images.
> -	  (setq alt (string-trim alt))
> +	  (setq alt (string-trim (or alt "*")))
>  	  ;; When inserting big-ish pictures, put them at the
>  	  ;; beginning of the line.
>  	  (let ((inline (shr--inline-image-p image)))

Thanks, but can we please avoid running a fixed string through
string-trim?

Also, I think the fallback on "*" deserves a comment to explain why
that is done.





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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-11 15:47   ` Eli Zaretskii
@ 2023-12-12  4:12     ` Visuwesh
  2023-12-12  8:14       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Visuwesh @ 2023-12-12  4:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 67764, jm

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

[Monday December 11, 2023] Eli Zaretskii wrote:

>> Cc: 67764@debbugs.gnu.org
>> From: Visuwesh <visuweshm@gmail.com>
>> Date: Mon, 11 Dec 2023 17:10:01 +0530
>> 
>> >   emacs -Q
>> >   M-: (eww "https://www.gnu.org/software/emacs/images/emacs.png")
>> >
>> > On master it fails with "Wrong type argument: stringp, nil".
>> > Bisect says 4254544 is the first bad commit.
>> 
>> Recent changes in shr-put-image didn't account for the possible nil
>> value for ALT.  Attached patch fixes the issue on my end.
>> 
>> 
>> >From f6d3fc0de572a1039e83df0389c1c7efce0ef0cf Mon Sep 17 00:00:00 2001
>> From: Visuwesh <visuweshm@gmail.com>
>> Date: Mon, 11 Dec 2023 17:09:03 +0530
>> Subject: [PATCH] ; Fix shr-put-image with nil value for ALT
>> 
>> [...]
>>
> Thanks, but can we please avoid running a fixed string through
> string-trim?
>
> Also, I think the fallback on "*" deserves a comment to explain why
> that is done.

OK, how about the attached instead?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-shr-put-image-with-nil-value-for-ALT.patch --]
[-- Type: text/x-diff, Size: 977 bytes --]

From 27cd2c4c028723009ebf19696825d22c15f59795 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Mon, 11 Dec 2023 17:09:03 +0530
Subject: [PATCH] Fix shr-put-image with nil value for ALT

* lisp/net/shr.el (shr-put-image): Account for nil value for ALT.
(Bug#6774)
---
 lisp/net/shr.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 9f030b4c743..bf5038a421d 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1137,7 +1137,9 @@ shr-put-image
         (when image
           ;; The trailing space can confuse shr-insert into not
           ;; putting any space after inline images.
-	  (setq alt (string-trim alt))
+          ;; ALT may be nil when visiting image URLs in eww
+          ;; (bug#6774).
+	  (setq alt (if alt (string-trim alt) "*"))
 	  ;; When inserting big-ish pictures, put them at the
 	  ;; beginning of the line.
 	  (let ((inline (shr--inline-image-p image)))
-- 
2.42.0


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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-12  4:12     ` Visuwesh
@ 2023-12-12  8:14       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-12-12  9:14         ` Visuwesh
  0 siblings, 1 reply; 8+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-12-12  8:14 UTC (permalink / raw)
  To: Visuwesh; +Cc: 67764, Eli Zaretskii, jm

Visuwesh <visuweshm@gmail.com> writes:

[...]

> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
> index 9f030b4c743..bf5038a421d 100644
> --- a/lisp/net/shr.el
> +++ b/lisp/net/shr.el
> @@ -1137,7 +1137,9 @@ shr-put-image
>          (when image
>            ;; The trailing space can confuse shr-insert into not
>            ;; putting any space after inline images.
> -	  (setq alt (string-trim alt))
> +          ;; ALT may be nil when visiting image URLs in eww
> +          ;; (bug#6774).

There is a 6 missing in the bug reference ;-)
-- 
Manuel Giraud





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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-12  8:14       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-12-12  9:14         ` Visuwesh
  2023-12-16 12:53           ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Visuwesh @ 2023-12-12  9:14 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 67764, Eli Zaretskii, jm

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]

[Tuesday December 12, 2023] Manuel Giraud wrote:

> Visuwesh <visuweshm@gmail.com> writes:
>
> [...]
>
>> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
>> index 9f030b4c743..bf5038a421d 100644
>> --- a/lisp/net/shr.el
>> +++ b/lisp/net/shr.el
>> @@ -1137,7 +1137,9 @@ shr-put-image
>>          (when image
>>            ;; The trailing space can confuse shr-insert into not
>>            ;; putting any space after inline images.
>> -	  (setq alt (string-trim alt))
>> +          ;; ALT may be nil when visiting image URLs in eww
>> +          ;; (bug#6774).
>
> There is a 6 missing in the bug reference ;-)

...and in the commit log.  I don't know how I managed to mess it up.
Thanks for catching the mistake.  Revised patch attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-shr-put-image-with-nil-value-for-ALT.patch --]
[-- Type: text/x-diff, Size: 979 bytes --]

From 4327fb4eae80b217437fbabae6c2ef7c6ac940a3 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Mon, 11 Dec 2023 17:09:03 +0530
Subject: [PATCH] Fix shr-put-image with nil value for ALT

* lisp/net/shr.el (shr-put-image): Account for nil value for ALT.
(Bug#67764)
---
 lisp/net/shr.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 9f030b4c743..d6ea5213337 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1137,7 +1137,9 @@ shr-put-image
         (when image
           ;; The trailing space can confuse shr-insert into not
           ;; putting any space after inline images.
-	  (setq alt (string-trim alt))
+          ;; ALT may be nil when visiting image URLs in eww
+          ;; (bug#67764).
+	  (setq alt (if alt (string-trim alt) "*"))
 	  ;; When inserting big-ish pictures, put them at the
 	  ;; beginning of the line.
 	  (let ((inline (shr--inline-image-p image)))
-- 
2.42.0


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

* bug#67764: 30.0.50; Opening image in eww no longer works
  2023-12-12  9:14         ` Visuwesh
@ 2023-12-16 12:53           ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2023-12-16 12:53 UTC (permalink / raw)
  To: Visuwesh; +Cc: jm, 67764-done, manuel

> From: Visuwesh <visuweshm@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  67764@debbugs.gnu.org,  jm@pub.pink
> Date: Tue, 12 Dec 2023 14:44:12 +0530
> 
> > Visuwesh <visuweshm@gmail.com> writes:
> >
> > [...]
> >
> >> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
> >> index 9f030b4c743..bf5038a421d 100644
> >> --- a/lisp/net/shr.el
> >> +++ b/lisp/net/shr.el
> >> @@ -1137,7 +1137,9 @@ shr-put-image
> >>          (when image
> >>            ;; The trailing space can confuse shr-insert into not
> >>            ;; putting any space after inline images.
> >> -	  (setq alt (string-trim alt))
> >> +          ;; ALT may be nil when visiting image URLs in eww
> >> +          ;; (bug#6774).
> >
> > There is a 6 missing in the bug reference ;-)
> 
> ...and in the commit log.  I don't know how I managed to mess it up.
> Thanks for catching the mistake.  Revised patch attached.

Thanks, installed on the master branch, and closing the bug.





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

end of thread, other threads:[~2023-12-16 12:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11  6:26 bug#67764: 30.0.50; Opening image in eww no longer works john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-11 11:40 ` Visuwesh
2023-12-11 15:03   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-11 15:47   ` Eli Zaretskii
2023-12-12  4:12     ` Visuwesh
2023-12-12  8:14       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12  9:14         ` Visuwesh
2023-12-16 12:53           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

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