Index | Thread | Search

From:
"Thomas L." <tom.longshine@web.de>
Subject:
ksh: unset IFS breaks tab-completion of filenames with spaces
To:
tech@openbsd.org
Date:
Fri, 19 Jul 2024 23:59:16 +0200

Download raw body.

Thread
  • Thomas L.:

    ksh: unset IFS breaks tab-completion of filenames with spaces

hi,

unset IFS behaves the same like IFS=" \t\n" wrt splitting things into
arguments, but when tab-completing a filename with spaces ksh does no
longer escape spaces. patch below fixes this.

kind regards

thomas


diff --git bin/ksh/edit.c bin/ksh/edit.c
index 3ed69e5375d..737c3489415 100644
--- bin/ksh/edit.c
+++ bin/ksh/edit.c
@@ -944,12 +944,11 @@ int
 x_escape(const char *s, size_t len, int (*putbuf_func) (const char *, size_t))
 {
 	size_t add, wlen;
-	const char *ifs = str_val(local("IFS", 0));
 	int rval = 0;

 	for (add = 0, wlen = len; wlen - add > 0; add++) {
 		if (strchr("!\"#$&'()*:;<=>?[\\]`{|}", s[add]) ||
-		    strchr(ifs, s[add])) {
+		    ctype(s[add], C_IFS)) {
 			if (putbuf_func(s, add) != 0) {
 				rval = -1;
 				break;