aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-10-26 11:47:42 +0100
committerRon Yorston <rmy@pobox.com>2022-10-26 11:47:42 +0100
commitd71cb67ff91762ae78e87440b87d7c9a160b2937 (patch)
treee378f71776199ff4fe44cb3bc020a8f43278bd2b /libbb
parent0b5bd6e1436c38a74c5294535d5f4d7a7cf79d54 (diff)
downloadbusybox-w32-d71cb67ff91762ae78e87440b87d7c9a160b2937.tar.gz
busybox-w32-d71cb67ff91762ae78e87440b87d7c9a160b2937.tar.bz2
busybox-w32-d71cb67ff91762ae78e87440b87d7c9a160b2937.zip
win32: revert special treatment of Unix-style absolute paths
Commit 605972390 (win32: handle Unix-style absolute paths for executables) added special treatment of paths for executables starting with a slash. Such paths are absolute on Unix but are relative to the current drive on Windows. On reflection this commit did more than necessary. Later commits provided special treatment only for paths starting with locations traditionally used to contain binaries on Unix. This is probably sufficient. Problems introduced by commit 605972390 include: - If the current drive isn't the system drive tab completion of a command starting with a slash confusingly references the system drive. - Building busybox-w32 with w64devkit fails on drives other than the system drive. Revert the changes introduced by commit 605972390. This saves 192 bytes. (GitHub issue #239)
Diffstat (limited to 'libbb')
-rw-r--r--libbb/executable.c2
-rw-r--r--libbb/lineedit.c3
2 files changed, 1 insertions, 4 deletions
diff --git a/libbb/executable.c b/libbb/executable.c
index 32b37f29d..770aedc0c 100644
--- a/libbb/executable.c
+++ b/libbb/executable.c
@@ -57,7 +57,7 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp)
57 ); 57 );
58#if ENABLE_PLATFORM_MINGW32 58#if ENABLE_PLATFORM_MINGW32
59 { 59 {
60 char *w = alloc_system_drive(p); 60 char *w = alloc_ext_space(p);
61 ex = add_win32_extension(w) || file_is_executable(w); 61 ex = add_win32_extension(w) || file_is_executable(w);
62 free(p); 62 free(p);
63 p = w; 63 p = w;
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index c5d5808f5..b4950688e 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -972,9 +972,6 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
972 } 972 }
973 973
974 lpath = *paths[i] ? paths[i] : "."; 974 lpath = *paths[i] ? paths[i] : ".";
975#if ENABLE_PLATFORM_MINGW32
976 lpath = auto_string(alloc_system_drive(lpath));
977#endif
978 dir = opendir(lpath); 975 dir = opendir(lpath);
979 if (!dir) 976 if (!dir)
980 continue; /* don't print an error */ 977 continue; /* don't print an error */