<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/debianutils, branch su_cmd2</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=su_cmd2</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=su_cmd2'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2023-03-16T10:47:09+00:00</updated>
<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: search PATH for missing Unix-style executables</title>
<updated>2022-05-06T08:30:43+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2022-05-06T07:26:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=26ba73098e714459e3294679228a1d54eed14799'/>
<id>urn:sha1:26ba73098e714459e3294679228a1d54eed14799</id>
<content type='text'>
Commit 41ef232fc5 (win32: use built-in applets for non-existent
binaries with Unix-style paths) alters what happens when trying
to find an executable.  If all of the following apply:

- the pathname starts with one of the standard directories for Unix
  executables (/bin, /usr/bin, /sbin, /usr/sbin);

- the file isn't found relative to the system root;

- the basename matches an applet

then the applet is run.

Further extend the procedure so that if the first two conditions are
met and either:

- the PREFER_APPLETS and SH_STANDALONE features are enabled and the
  basename *doesn't* match an applet

or

- the PREFER_APPLETS and SH_STANDALONE features are disabled

then PATH is searched for the basename.

This affects:

- how interpreters and binaries are spawned by mingw_spawn_interpreter()
  and mingw_spawnvp();

- how 'which' and the shell search for binaries.

Special steps need to be taken in the shell to avoid treating shell
built-ins and functions as applets.

As a consequence of this change:

- An executable that isn't an applet, say curl.exe, can be run as
  /usr/bin/curl so long as it's in a directory in PATH.  It doesn't
  have to be in C:/usr/bin.

- If the PREFER_APPLETS and SH_STANDALONE features are disabled binaries
  can be run using paths referring to standard Unix directories even if
  they're installed elsewhere in PATH.
</content>
</entry>
<entry>
<title>which,ash: changes to which/command/type</title>
<updated>2022-05-01T10:03:10+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2022-05-01T09:20:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=6d87be4d760ceda18d354c6d4c523a9adf50c04b'/>
<id>urn:sha1:6d87be4d760ceda18d354c6d4c523a9adf50c04b</id>
<content type='text'>
Change how 'which' detects if it was run from a standalone shell:
the shell passes the undocumented '-s' option.  This is stricter
and more reliable than the previous method of checking the name
of the binary.

Add a function to determine the binary associated with a given
applet name.  This makes it possible for 'which' and 'command -v'
to list the correct binary even for applets other than 'busybox'.
For example, when the binary is called 'sh.exe' 'which sh' will
report its path.

In standalone shell mode 'command -V' and 'type' now report "xxx
is a builtin applet" rather than "xxx is xxx", which is true but
not very illuminating.

(GitHub issue #248)
</content>
</entry>
<entry>
<title>Merge busybox into merge</title>
<updated>2022-01-06T07:46:38+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2022-01-06T07:46:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b8751bbc9ac24e71fbe1e79c69074b4c87a134d8'/>
<id>urn:sha1:b8751bbc9ac24e71fbe1e79c69074b4c87a134d8</id>
<content type='text'>
Fix merge conflict in miscutils/less.c.

Use exit_SUCCESS() where possible.
</content>
</entry>
<entry>
<title>libbb: code shrink: introduce and use [_]exit_SUCCESS()</title>
<updated>2022-01-05T21:16:06+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2022-01-05T21:16:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=db5546ca101846f18294a43b39883bc4ff53613a'/>
<id>urn:sha1:db5546ca101846f18294a43b39883bc4ff53613a</id>
<content type='text'>
function                                             old     new   delta
exit_SUCCESS                                           -       7      +7
_exit_SUCCESS                                          -       7      +7
run_pipe                                            1562    1567      +5
pseudo_exec_argv                                     399     400      +1
finish                                                86      87      +1
start_stop_daemon_main                              1109    1107      -2
shutdown_on_signal                                    38      36      -2
runsv_main                                          1662    1660      -2
redirect                                            1070    1068      -2
read_line                                             79      77      -2
pause_and_low_level_reboot                            54      52      -2
list_i2c_busses_and_exit                             483     481      -2
less_exit                                             12      10      -2
identify                                            4123    4121      -2
grep_file                                           1161    1159      -2
getty_main                                          1519    1517      -2
fsck_minix_main                                     2681    2679      -2
free_session                                         132     130      -2
fdisk_main                                          4739    4737      -2
clean_up_and_exit                                     53      51      -2
bsd_select                                          1566    1564      -2
bb_daemonize_or_rexec                                198     196      -2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/17 up/down: 21/-34)           Total: -13 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>Merge busybox into merge</title>
<updated>2021-12-27T08:21:55+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2021-12-27T08:21:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b15f68214da209b5b293039c09c00f490c0cc193'/>
<id>urn:sha1:b15f68214da209b5b293039c09c00f490c0cc193</id>
<content type='text'>
Fix merge conflict in coreutils/timeout.c.
</content>
</entry>
<entry>
<title>which: add -a to help text</title>
<updated>2021-11-09T12:51:22+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2021-11-09T12:51:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=15f7d618ea7f8c3a0277c98309268b709e20d77c'/>
<id>urn:sha1:15f7d618ea7f8c3a0277c98309268b709e20d77c</id>
<content type='text'>
function                                             old     new   delta
packed_usage                                       34075   34079      +4

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2021-06-07T10:34:06+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2021-06-07T10:34:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=abe872e2a0342357a5608342cb2892e94027b3e7'/>
<id>urn:sha1:abe872e2a0342357a5608342cb2892e94027b3e7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>run-parts: permit dot later in file name</title>
<updated>2021-06-05T16:40:58+00:00</updated>
<author>
<name>Ján Sáreník</name>
<email>jajomojo@gmail.com</email>
</author>
<published>2021-06-05T16:24:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=8c1f8aa016faee3fa151d134c3544b2dd5bab832'/>
<id>urn:sha1:8c1f8aa016faee3fa151d134c3544b2dd5bab832</id>
<content type='text'>
See https://gist.github.com/andyshinn/3ae01fa13cb64c9d36e7#gistcomment-2044506

To test:

    mkdir /tmp/testrp
    printf "#!/bin/sh\necho test\n" &gt; /tmp/testrp/test.sh
    chmod a+x /tmp/testrp/*
    busybox run-parts /tmp/testrp
    test
    mv /tmp/testrp/test.sh /tmp/testrp/.test.sh
    busybox run-parts /tmp/testrp
    # no output

function                                             old     new   delta
act                                                  190     200     +10

Signed-off-by: Ján Sáreník &lt;jajomojo@gmail.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
