<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/win32, branch noconsole2</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=noconsole2</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=noconsole2'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2023-08-20T12:35:20+00:00</updated>
<entry>
<title>ash: detect console state on shell start up</title>
<updated>2023-08-20T12:35:20+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-08-20T11:53:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=67ed7484be88e3be5a5a51f404f1325a569be173'/>
<id>urn:sha1:67ed7484be88e3be5a5a51f404f1325a569be173</id>
<content type='text'>
Set 'noconsole' to match the actual state of the console (normal/
iconified) when the shell is started.  Thus ShowWindow() will only
be called if the actual state differs from the default or user
defined state.

Costs 20-24 bytes.

(GitHub issue #325)
</content>
</entry>
<entry>
<title>win32: disable console output conversion with LC_ALL=C</title>
<updated>2023-08-03T18:09:01+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-08-03T16:19:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b8fff6b345d4b7e3f16227f65eecca1a0c88ab41'/>
<id>urn:sha1:b8fff6b345d4b7e3f16227f65eecca1a0c88ab41</id>
<content type='text'>
Previously, when writing to the console, the non-unicode build always
assumed the source data is in the ANSI codepage, and used charToCon
to convert it unconditionally to the console CP.

Similarly, the unicode build made the same assumption (where ANSI CP
is UTF8), and always tried to convert it so that it's printed
correctly (at least when FEATURE_UTF8_OUTPUT is enabled - which it is
by default at the unicode build).

However, there could be cases where this assumption is incorrect, for
instance if the data comes from a file encoded for some codepage X,
and after the user also changed the console CP to X does 'cat file.X'

This commit allows disabling this conversion, using the same env vars
which can be used to disable the locale/unicode elsewhere, (LANG,
LC_CTYPE, LC_ALL as "C") e.g. 'LC_ALL=C cat file.X' now doesn't
convert, and the console renders it according to its own codepage.
</content>
</entry>
<entry>
<title>win32: add FEATURE_UTF8_OUTPUT (enabled with unicode)</title>
<updated>2023-08-03T17:57:53+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-08-03T15:23:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=bf70275f786716546ec474caade0f16ec28da541'/>
<id>urn:sha1:bf70275f786716546ec474caade0f16ec28da541</id>
<content type='text'>
Previously, the unicode build required console (out) codepage of UTF8
in order for unicode output to be printed correctly - e.g. at the
shell command prompt or the output of `ls` for unicode file names.

This is inconvenient, because by default it's not UTF8, and so unless
the user invoked 'chcp 65001' - by default unicode output didn't work.

This feature (which is now enabled for the unicode build) makes it
print unicode output correctly regardless of the console CP, by
using a new stream-conversion funcion from UTF8 chars to wchar_t,
and writing those using WriteConsoleW.

If the console CP happens to be UTF8 - this conversion is disabled.

We could have instead changed the console CP to UTF8, but that's
a slippery slope, and some old program which expect the default CP
might get broken, so achieving the same result without touching
the console CP is hopefully better.
</content>
</entry>
<entry>
<title>win32: unify 'convert and write to console' (no-op)</title>
<updated>2023-08-03T17:17:16+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-08-03T08:57:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=a42cc92778545d21429f9267540330991185f1f1'/>
<id>urn:sha1:a42cc92778545d21429f9267540330991185f1f1</id>
<content type='text'>
Use one call to do both charToCon and then write it to the console.

Technically, this commit only reduces boilerplate code slightly,
but it also makes it easier for future modifications to make
changes to this sequence in one place.
</content>
</entry>
<entry>
<title>win32: support build with FEATURE_UNICODE_SUPPORT</title>
<updated>2023-07-22T06:40:16+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-06-27T11:41:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=0efc74740ebc0d98af79ba4a5dfa73bfb5db3df0'/>
<id>urn:sha1:0efc74740ebc0d98af79ba4a5dfa73bfb5db3df0</id>
<content type='text'>
FEATURE_UTF8_MANIFEST enables Unicode args and filenames on Win 10+.

FEATURE_UTF8_INPUT allows the shell prompt to digest correctly
Unicode strings (as UTF8) which are typed or pasted.

This commit adds support for building with FEATURE_UNICODE_SUPPORT
(mostly by supporting 32 bit wchar_t which busybox expects):

- Unicode-aware line-edit - for the most part cursor movement/del
  being (UTF8) codepoint-aware rather than assuming that one-byte
  equals one-char-on-screen.

- Codepoint-aware operations in some other utils, like rev or wc -c.

- When UNICODE_COMBINING_WCHARS and UNICODE_WIDE_WCHARS are enabled,
  some screen-width-aware operations, like with fold, ls, expand, etc.

The busybox Unicode support is incomplete, and even less so with the
builtin libc replacement functions, like wcwidth, which are active
when UNICODE_USING_LOCALE is unset (mingw lacks those functions).

FEATURE_CHECK_UNICODE_IN_ENV should be set so that Unicode is not
hardcoded but rather depends on the ANSI codepage and some env vars:
LC_ALL=C disables Unicode support, else it's enabled if ACP is UTF8.

There's at least one known issue where the tab-completion-prefix-case
is not updated correctly, e.g. ~/desk&lt;tab&gt; completes to ~/desktop/
instead of ~/Desktop/, because the code which handles it exists
only at the non-unicode code paths, but that's not very critical.

That seems to be the only case where mingw-specific code is disabled
when Unicode is enabled, but there could be other unknown issues.

None of the Unicode options is enabled by default, and the next
commit will make it easier to create a build which supports Unicode.
</content>
</entry>
<entry>
<title>win32: UTF8 input: improve missing-key-down hack</title>
<updated>2023-07-21T07:13:12+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-07-20T19:48:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=4fe7e7cdd0441e9455cc93c17b40a7a96704e61f'/>
<id>urn:sha1:4fe7e7cdd0441e9455cc93c17b40a7a96704e61f</id>
<content type='text'>
The UTF8 input code works around an issue when pasting at the
windows console (but not terminal) that sometimes we get key-up
without a prior matching key-down - at which case it generates down.

However, previously it detected this by comparing an up-event to the
last down-event, which could result in false-positive in cases like:
  X-down Y-down X-up Y-up (e.g. when typing quickly).

Now it remembers the last 8 key-down events when searching a prior
matching key-down, which fixes an issue of incorrect repeated keys
(in the example above Y-up was incorrectly changed to Y-down).
</content>
</entry>
<entry>
<title>win32: avoid crashing the console with poll(2)</title>
<updated>2023-07-17T13:17:13+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-17T13:17:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=72b97c86c6c1a1902d6dcda3da7c38db13585cdc'/>
<id>urn:sha1:72b97c86c6c1a1902d6dcda3da7c38db13585cdc</id>
<content type='text'>
Commit 8e6991733 (ash: fix 'read' shell built-in (1)) introduced
the use of poll(2) in the shell 'read' built-in.  When the UTF8
code page is in use this results in the console crashing if a 3 or
more byte UTF8 character is entered.

The crash is caused by the use of PeekConsoleInputA() which, like
ReadConsoleInputA(), is broken.  It can be avoided by using
PeekConsoleInputW() instead.

The number of key events will differ but this doesn't matter in
this case as poll(2) effectively runs in a busy loop with a 1ms
sleep.
</content>
</entry>
<entry>
<title>date: allow system date to be set</title>
<updated>2023-07-16T07:49:50+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-16T07:49:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=bc0d14ee8eb9720a5df097f5620c4b4c679b6c98'/>
<id>urn:sha1:bc0d14ee8eb9720a5df097f5620c4b4c679b6c98</id>
<content type='text'>
Implement clock_settime(2) and enable the '-s' option to allow
the system time to be set.  This requires elevated privileges.

The code in date.c is now identical to upstream BusyBox.

Costs 256-272 bytes.
</content>
</entry>
<entry>
<title>ash: fix 'read' shell built-in (2)</title>
<updated>2023-07-12T10:52:06+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-12T10:52:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b2901ce8efa050da00e0f3a73f3be9bf9402deea'/>
<id>urn:sha1:b2901ce8efa050da00e0f3a73f3be9bf9402deea</id>
<content type='text'>
Enabling polling in the previous commit resulted in the following
incorrect behaviour:

   { echo -n te; sleep 3; echo st; } | (read -t 1 x; echo "$x")

An empty "$x" is echoed immediately, not after 1 second.

   { echo -n te; sleep 1; echo st; } | (read -t 3 x; echo "$x")

An empty "$x" is echoed immediately.  "test" should be echoed after
1 second.

This arises because poll(2) from gnulib is unable to handle anonymous
pipes properly due do deficiencies in Microsoft Windows.  These have
been acknowledged and fixed in relation to select(2):

   https://lists.gnu.org/archive/html/bug-gnulib/2014-06/msg00051.html

Apply a similar fix to poll(2).

Costs 104-156 bytes.
</content>
</entry>
<entry>
<title>ash: properly echo console input to 'read' built-in</title>
<updated>2023-07-12T10:52:06+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-12T10:52:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=2a4b086d4848616306f97f6378e0f10a48d41929'/>
<id>urn:sha1:2a4b086d4848616306f97f6378e0f10a48d41929</id>
<content type='text'>
The 'read' shell built-in echoed console input to stdout.  Echo
directly to the console instead.

Costs 124-136 bytes.
</content>
</entry>
</feed>
