summaryrefslogtreecommitdiff
path: root/lang/gnu-apl/files/patch-src_LibPaths.cc
diff options
context:
space:
mode:
authorAlexey Dokuchaev <danfe@FreeBSD.org>2025-06-04 06:51:24 +0000
committerAlexey Dokuchaev <danfe@FreeBSD.org>2025-06-04 06:51:24 +0000
commit5baf43483caeb86c42128d7ce0feeae825da671a (patch)
tree2f431e508bf6db96c6f09fa7ac908ce02a7fdffe /lang/gnu-apl/files/patch-src_LibPaths.cc
parentsecurity/vuxml: Add Chromium vulnerability (diff)
lang/gnu-apl: try to unbreak the port's build on recent -CURRENT
The base template for std::char_traits<> has been removed in LLVM 19; specializations are only provided for char, wchar_t, char8_t, char16_t, and char32_t. This had severely impacted GNU APL which derived its UTF8 and UCS string classes from std::basic_string<>. The author had made several attempts to convert these classes to use std::vector<> instead. Carefully cherry-pick required changes so these fixes could be applied on top of version 1.8 as trunk had diverged significantly. Obtained from: upstream (SVN revisions 1823, 1831, and 1837) Reported by: pkg-fallout
Diffstat (limited to 'lang/gnu-apl/files/patch-src_LibPaths.cc')
-rw-r--r--lang/gnu-apl/files/patch-src_LibPaths.cc58
1 files changed, 58 insertions, 0 deletions
diff --git a/lang/gnu-apl/files/patch-src_LibPaths.cc b/lang/gnu-apl/files/patch-src_LibPaths.cc
new file mode 100644
index 000000000000..b894ebb0a56c
--- /dev/null
+++ b/lang/gnu-apl/files/patch-src_LibPaths.cc
@@ -0,0 +1,58 @@
+--- src/LibPaths.cc.orig 2019-06-23 12:39:20 UTC
++++ src/LibPaths.cc
+@@ -70,33 +70,22 @@ LibPaths::compute_bin_path(const char * argv0, bool lo
+ //
+ // we fix this by searching argv0 in $PATH
+ //
+- const char * path = getenv("PATH"); // must NOT be modified
+-
+- if (path)
++ if (const char * paths = getenv("PATH"))
+ {
+ logit && CERR << "initializing paths from $PATH = "
+- << path << endl;
++ << paths << endl;
+
+- // we must not modify path, so we copy it to path1 and
+- // replace the semicolons in path1 by 0. That converts
+- // p1;p2; ... into a sequence of 0-terminated strings
+- // p1 p2 ... The variable next points to the start of each
+- // string.
+- //
+- const size_t plen = strlen(path);
+- std::string path1;
+- path1.reserve(plen + 1);
+- loop(p, (plen + 1)) path1 += path[p];
+- char * next = &path1[0];
+- for (;;)
+- {
+- char * semi = strchr(next, ':');
+- if (semi) *semi = 0;
+- UTF8_string filename;
+- for (const char * n = next; *n; ++n) filename += *n;
+- filename += '/';
+- for (const char * a = argv0; *a; ++a) filename += *a;
++ while (*paths)
++ {
++ size_t dir_len;
++ if (const char * colon = strchr(paths, ':'))
++ dir_len = colon - paths;
++ else
++ dir_len = strlen(paths);
+
++ std::string filename(paths, dir_len);
++ filename += '/';
++ filename.append(argv0);
+ if (access(filename.c_str(), X_OK) == 0)
+ {
+ strncpy(APL_bin_path, filename.c_str(),
+@@ -110,8 +99,7 @@ LibPaths::compute_bin_path(const char * argv0, bool lo
+ goto done;
+ }
+
+- if (semi == 0) break;
+- next = semi + 1;
++ paths += dir_len + 1; // next $PATH item
+ }
+ }
+ else