Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jan 2019 20:40:43 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r490604 - in head/shells/fish: . files
Message-ID:  <201901172040.x0HKehox051285@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers (src committer)
Date: Thu Jan 17 20:40:43 2019
New Revision: 490604
URL: https://svnweb.freebsd.org/changeset/ports/490604

Log:
  shells/fish: patch upstream issue #5453
  
  This change fixes a segfault that would happen from operations like
  'printf "%f" 7.0'.  Also, this change removes Python as a runtime
  dependency.  That was supposed to have been done in r488840, but there was a
  typo.
  
  https://github.com/fish-shell/fish-shell/issues/5453
  
  Reported by:	Mahmoud Al-Qudsi <mqudsi@neosmart.net>
  MFH:		2019Q1

Added:
  head/shells/fish/files/patch-src_fallback.cpp   (contents, props changed)
  head/shells/fish/files/patch-src_fallback.h   (contents, props changed)
Modified:
  head/shells/fish/Makefile

Modified: head/shells/fish/Makefile
==============================================================================
--- head/shells/fish/Makefile	Thu Jan 17 20:25:26 2019	(r490603)
+++ head/shells/fish/Makefile	Thu Jan 17 20:40:43 2019	(r490604)
@@ -3,6 +3,7 @@
 
 PORTNAME=	fish
 PORTVERSION=	3.0.0
+PORTREVISION=	1
 CATEGORIES=	shells
 MASTER_SITES=	https://github.com/fish-shell/fish-shell/releases/download/${PORTVERSION}/
 
@@ -15,7 +16,7 @@ LIB_DEPENDS+=	libpcre2-32.so:devel/pcre2
 
 # The python dependency is only needed by shebangfix.  At runtime python is
 # only needed by some optional scripts that aren't in PATH.
-USES=		cmake cpe ncurses python:3.4+:build \
+USES=		cmake cpe ncurses python:3.4+,build \
 		localbase compiler:c++11-lang shebangfix
 
 SHEBANG_FILES=	share/tools/*.py share/tools/web_config/webconfig.py

Added: head/shells/fish/files/patch-src_fallback.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/shells/fish/files/patch-src_fallback.cpp	Thu Jan 17 20:40:43 2019	(r490604)
@@ -0,0 +1,16 @@
+--- src/fallback.cpp
++++ src/fallback.cpp
+@@ -390,9 +390,10 @@ int flock(int fd, int op) {
+ #endif  // HAVE_FLOCK
+ 
+ #ifndef HAVE_WCSTOD_L
+-// musl doesn't feature wcstod_l,
+-// so we just wrap wcstod.
+-double wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc) {
++#undef wcstod_l
++// For platforms without wcstod_l C extension, wrap wcstod after changing the
++// thread-specific locale.
++double fish_compat::wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc) {
+     char *saved_locale = strdup(setlocale(LC_NUMERIC, NULL));
+     // Yes, this is hardcoded to use the "C" locale.
+     // That's the only thing we need, and uselocale(loc) broke in my testing.

Added: head/shells/fish/files/patch-src_fallback.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/shells/fish/files/patch-src_fallback.h	Thu Jan 17 20:40:43 2019	(r490604)
@@ -0,0 +1,19 @@
+--- src/fallback.h
++++ src/fallback.h
+@@ -200,5 +200,15 @@ int flock(int fd, int op);
+ #endif
+ 
+ #ifndef HAVE_WCSTOD_L
+-double wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc);
++// On some platforms if this is incorrectly detected and a system-defined
++// defined version of `wcstod_l` exists, calling `wcstod` from our own
++// `wcstod_l` can call back into `wcstod_l` causing infinite recursion.
++// e.g. FreeBSD defines `wcstod(x, y)` as `wcstod_l(x, y, __get_locale())`.
++// Solution: namespace our implementation to make sure there is no symbol
++// duplication.
++#undef wcstod_l
++namespace fish_compat {
++    double wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc);
++}
++#define wcstod_l(x, y, z) fish_compat::wcstod_l(x, y, z)
+ #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901172040.x0HKehox051285>