unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46838: 28.0.50; nonstandard constant value in puny.el sometimes problematic
@ 2021-02-28 23:46 J.P.
  2021-03-01 13:05 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: J.P. @ 2021-02-28 23:46 UTC (permalink / raw)
  To: 46838

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


Severity: minor
Tags: patch

In rare cases, puny.el appears to convert domains incorrectly (both
human to puny and vice versa). The updated tests in the attached patch
demonstrate one such case. This may just be a typo because changing
`puny-skew' to the value prescribed by RFC3492 [1] makes the issue go
away. Converted names then match those returned by libidn and dig.

Thanks,
J.P.


[1] https://tools.ietf.org/html/rfc3492#section-5


In GNU Emacs 28.0.50 (build 2, x86_64-redhat-linux-gnu, GTK+ Version 3.24.25, cairo version 1.16.0)
 of 2021-02-28 built on localhost
Repository revision: aad8ffafa89fe46ff5d63bd0127274f74019d50f
Repository branch: master
Windowing system distributor 'Fedora Project', version 11.0.12010000
System Description: Fedora 33 (Workstation Edition)

Configured using:
 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs
 --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu
 --program-prefix= --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 --with-xwidgets --with-modules --with-harfbuzz
 --with-cairo --with-json build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O0
 -flto=auto -ffat-lto-objects -fexceptions -g3 -grecord-gcc-switches
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

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

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
  global-eldoc-mode: t
  eldoc-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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame minibuffer
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese composite
charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev
obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 51730 6592)
 (symbols 48 6587 1)
 (strings 32 18212 1566)
 (string-bytes 1 606914)
 (vectors 16 12733)
 (vector-slots 8 172128 8290)
 (floats 8 21 38)
 (intervals 56 336 0)
 (buffers 992 11))

[-- Attachment #2: 0001-Fix-Bootstring-skew-parameter.patch --]
[-- Type: text/x-patch, Size: 1853 bytes --]

From afea12fb0cd4fc62a8dcf3e280de9be871f5fb5b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Sun, 28 Feb 2021 01:17:05 -0800
Subject: [PATCH] Fix Bootstring skew parameter in puny.el

* lisp/net/puny.el: change puny-skew to match value given in RFC3492.
* test/lisp/net/puny-tests.el (puny-test-encode-domain)
(puny-test-decode-domain): add regression case for popular domain.
---
 lisp/net/puny.el            | 2 +-
 test/lisp/net/puny-tests.el | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index 6b3663a5fb2..1cdefc08f02 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -75,7 +75,7 @@ puny-base
 (defconst puny-damp 700)
 (defconst puny-tmin 1)
 (defconst puny-tmax 26)
-(defconst puny-skew 28)
+(defconst puny-skew 38)
 
 ;; 0-25  a-z
 ;; 26-36 0-9
diff --git a/test/lisp/net/puny-tests.el b/test/lisp/net/puny-tests.el
index b37168f5ca7..28c0d49cbee 100644
--- a/test/lisp/net/puny-tests.el
+++ b/test/lisp/net/puny-tests.el
@@ -39,10 +39,12 @@ puny-test-decode2
   (should (string= (puny-decode-string "xn--9dbdkw") "חנוך")))
 
 (ert-deftest puny-test-encode-domain ()
-  (should (string= (puny-encode-domain "åäö.se") "xn--4cab6c.se")))
+  (should (string= (puny-encode-domain "åäö.se") "xn--4cab6c.se"))
+  (should (string= (puny-encode-domain "яндекс.рф") "xn--d1acpjx3f.xn--p1ai")))
 
 (ert-deftest puny-test-decode-domain ()
-  (should (string= (puny-decode-domain "xn--4cab6c.se") "åäö.se")))
+  (should (string= (puny-decode-domain "xn--4cab6c.se") "åäö.se"))
+  (should (string= (puny-decode-domain "xn--d1acpjx3f.xn--p1ai") "яндекс.рф")))
 
 (ert-deftest puny-highly-restrictive-domain-p ()
   (should (puny-highly-restrictive-domain-p "foo.bar.org"))
-- 
2.29.2


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

* bug#46838: 28.0.50; nonstandard constant value in puny.el sometimes problematic
  2021-02-28 23:46 bug#46838: 28.0.50; nonstandard constant value in puny.el sometimes problematic J.P.
@ 2021-03-01 13:05 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-01 13:05 UTC (permalink / raw)
  To: J.P.; +Cc: 46838

"J.P." <jp@neverwas.me> writes:

> In rare cases, puny.el appears to convert domains incorrectly (both
> human to puny and vice versa). The updated tests in the attached patch
> demonstrate one such case. This may just be a typo because changing
> `puny-skew' to the value prescribed by RFC3492 [1] makes the issue go
> away. Converted names then match those returned by libidn and dig.

Thank; looks like a typo to me, too.  I've applied your patch to Emacs
28.

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





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

end of thread, other threads:[~2021-03-01 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28 23:46 bug#46838: 28.0.50; nonstandard constant value in puny.el sometimes problematic J.P.
2021-03-01 13:05 ` Lars Ingebrigtsen

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