freebsd-ports/shells/fish/files/patch-src_fallback.h
Alan Somers facd31f44f 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
2019-01-17 20:40:43 +00:00

19 lines
767 B
C

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