← Commit list

8baa643a3

Ron Yorston
Ron Yorston
2020-12-16
SUCCESS Duration: 152s

Subject

lineedit: match local directories when searching PATH

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/lineedit.c+8 -1
@@ -753,7 +753,7 @@ static int path_parse(char ***p)
return 1;
tmp = (char*)pth;
- npth = 1; /* path component count */
+ npth = 2; /* path component count */
while (1) {
tmp = strchr(tmp, ':');
if (!tmp)
@@ -776,6 +776,8 @@ static int path_parse(char ***p)
break; /* :<empty> */
res[npth++] = tmp;
}
+ /* special case: match subdirectories of the current directory */
+ res[npth++] = NULL;
return npth;
}
@@ -843,6 +845,11 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
struct stat st;
char *found;
+ if (paths[i] == NULL) {
+ type = FIND_DIR_ONLY;
+ paths[i] = (char *)".";
+ }
+
dir = opendir(paths[i]);
if (!dir)
continue; /* don't print an error */