<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/libbb/executable.c, branch long_paths</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=long_paths</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=long_paths'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2026-02-01T09:29:44+00:00</updated>
<entry>
<title>libbb: fix regression where 'which' output duplicate slashes</title>
<updated>2026-02-01T09:29:44+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-02-01T09:29:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=e27f759c63b338e6e6cf6dc8d9d0711e9c05d6a5'/>
<id>urn:sha1:e27f759c63b338e6e6cf6dc8d9d0711e9c05d6a5</id>
<content type='text'>
If an element of $PATH had a trailing slash 'which' displayed two
slashes when an executable was found in that directory.

This is a regression caused by upstream commit 49d9e06fb (libbb:
modify find_executable() to not temporarily write to PATH).
Prior to this commit find_executable() used concat_path_file() to
build the path of the executable.  This avoids including duplicate
slashes in its output.  The new code didn't.

Add a test in find_executable() to detect the problem.  It still
fails if there are multiple trailing slashes.  Don't do that.

Adds 48 bytes.
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2024-10-08T11:09:30+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-10-08T10:54:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=ded78ca2656fd41f130d65345b0eb4d39b1fcbdf'/>
<id>urn:sha1:ded78ca2656fd41f130d65345b0eb4d39b1fcbdf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>libbb: modify find_executable() to not temporarily write to PATH</title>
<updated>2024-10-08T02:03:17+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-10-08T02:03:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=49d9e06fbab0b02a71deed57610edb0c8f4fb20c'/>
<id>urn:sha1:49d9e06fbab0b02a71deed57610edb0c8f4fb20c</id>
<content type='text'>
This allows to simplify "which" applet code

function                                             old     new   delta
find_executable                                       93     111     +18
which_main                                           191     177     -14
builtin_source                                       316     294     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 18/-36)            Total: -18 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>win32: code shrink detection of executables</title>
<updated>2023-03-16T10:47:09+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-03-16T10:47:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=184edf9bd672bc93856157098d528eab48948ba9'/>
<id>urn:sha1:184edf9bd672bc93856157098d528eab48948ba9</id>
<content type='text'>
Add a function, file_is_win32_exe(), to detect if a path refers
to an executable.  It tries adding extensions if necessary.

Use this in a number of places to replace common code of the form

   path = alloc_ext_space(cmd);
   if (add_win32_extension(path) || file_is_executable(path))

Saves 32-48 bytes.
</content>
</entry>
<entry>
<title>win32: revert special treatment of Unix-style absolute paths</title>
<updated>2022-10-26T10:47:42+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2022-10-26T10:47:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=d71cb67ff91762ae78e87440b87d7c9a160b2937'/>
<id>urn:sha1:d71cb67ff91762ae78e87440b87d7c9a160b2937</id>
<content type='text'>
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)
</content>
</entry>
<entry>
<title>win32: more efficient tests for executables</title>
<updated>2021-07-26T14:26:30+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2021-07-26T14:05:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=5c2241c4b32607f138824c3454b7b32b2916fd02'/>
<id>urn:sha1:5c2241c4b32607f138824c3454b7b32b2916fd02</id>
<content type='text'>
file_is_executable() calls access(2) and stat(2); in this case our
WIN32 implementation also calls stat(2).  Avoid this unnecessary
duplication by copying the required test from the WIN32 access(2).

In find_executable() it's possible to avoid calling file_is_executable()
if add_win32_extension() returns TRUE as the latter will already have
verified that the file is executable.

Replace a call to file_is_executable() in the tab completion code
with the equivalent tests, avoiding (up to) two calls to stat(2).

These changes don't affect the size of the binary and should be
faster.
</content>
</entry>
<entry>
<title>libbb: reduce changes to find_executable()</title>
<updated>2021-01-23T09:38:50+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2021-01-23T09:22:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=a19a9c222e3966b445de3259ce83dfff4411a67d'/>
<id>urn:sha1:a19a9c222e3966b445de3259ce83dfff4411a67d</id>
<content type='text'>
Reduce the divergence from upstream in find_executable():

- Reset the path separator after the call to file_is_executable().
  Doing it before isn't wrong, but it's different.

- Move the declaration 'char *w;' into a platform-specific block.
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2021-01-14T13:28:49+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2021-01-14T13:28:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=89963b524d211e1aec12b72b3725be05ee95c8cf'/>
<id>urn:sha1:89963b524d211e1aec12b72b3725be05ee95c8cf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>libbb: rename run_shell() to exec_shell()</title>
<updated>2020-12-02T20:28:47+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2020-12-02T20:28:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=2075aa93e007863c6b680994a7a0ba420181034f'/>
<id>urn:sha1:2075aa93e007863c6b680994a7a0ba420181034f</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>win32: code shrink Unix-style path handling</title>
<updated>2020-08-23T09:16:12+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2020-08-23T09:16:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=64ecd10486934c12336dac84c67a1939dce0e096'/>
<id>urn:sha1:64ecd10486934c12336dac84c67a1939dce0e096</id>
<content type='text'>
Replace auto_add_system_drive() with alloc_system_drive() which
leaves space for a possible filename extension.  This makes it
possible to drop alloc_win32_extension() and auto_win32_extension().

Saves 144 bytes.
</content>
</entry>
</feed>
