yeti Some days ago I had a white-space after a packages repository line in /usr/pkg/etc/pkgin/repositories.conf
That should be easy to fix. Try (note: not even compile-tested):
diff -urN pkgin-22.10.0.orig/fsops.c pkgin-22.10.0/fsops.c
--- pkgin-22.10.0.orig/fsops.c	2022-10-05 17:19:10.000000000 +0000
+++ pkgin-22.10.0/fsops.c	2023-03-24 07:12:52.029452000 +0000
@@ -112,6 +112,12 @@
 		if (fgets(buf, BUFSIZ, fp) == NULL)
 			continue;
 
+		for (tmp = buf; isspace((unsigned char )*tmp); tmp++)
+			/* EMPTY */ ;
+		if (strlen(tmp) == 0)
+			continue;
+		memmove(buf, tmp, strlen(tmp) + 1);
+
 		if (strncmp(buf, "ftp://", 6) != 0 &&
 			strncmp(buf, "http://", 7) != 0 &&
 			strncmp(buf, "https://", 8) != 0 &&
diff -urN pkgin-22.10.0.orig/tools.c pkgin-22.10.0/tools.c
--- pkgin-22.10.0.orig/tools.c	2022-10-05 17:19:10.000000000 +0000
+++ pkgin-22.10.0/tools.c	2023-03-24 07:09:32.862474000 +0000
@@ -46,25 +46,15 @@
 }
 
 /*
- * Remove trailing \n or \r\n, returning length of resulting string.
+ * Remove all trailing space chars., returning length of resulting string.
  */
 size_t
 trimcr(char *str)
 {
-	size_t len;
-
-	if (str == NULL)
-		return (0);
-
-	len = strlen(str);
-
-	if (str[len - 1] == '\n')
-		str[--len] = '\0';
-
-	if (str[len - 1] == '\r')
-		str[--len] = '\0';
-
-	return (len);
+	char* p = str + strlen(str);
+	while (p > str && isspace((unsigned char )*(p - 1)))
+		*--p = '\0';
+	return (size_t)(p - str);
 }
 
 void