<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/editors, branch su_cmd</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=su_cmd</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=su_cmd'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2023-03-05T12:43:46+00:00</updated>
<entry>
<title>win32: add support for virtual terminal input</title>
<updated>2023-03-05T12:43:46+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-03-05T12:34:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=8ade494aebe60ea14026d48025a462e6d0b58a7f'/>
<id>urn:sha1:8ade494aebe60ea14026d48025a462e6d0b58a7f</id>
<content type='text'>
Alter certain applets to support virtual terminal input, if enabled.

In many places this is achieved by building previously excluded
upstream terminal-handling code.  The busybox-w32 implementation
of termios(3) functions does nothing if virtual terminal input is
disabled, so it can be invoked regardless.

Some applet-specific terminal-handling code is also required.

This affects less, more, vi and command line editing in the shell.
(The `more` applet isn't enabled in the default configuration.)

This series of patches adds about 1.7KB to the binaries.
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2023-02-13T10:01:35+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-02-13T10:01:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=4e5fb4341fddc2b99e815f27ac577d85a57994c2'/>
<id>urn:sha1:4e5fb4341fddc2b99e815f27ac577d85a57994c2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vi: introduce 'binary' option and '-b' flag</title>
<updated>2023-02-06T11:15:37+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-02-06T10:50:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c49b8b7052bb1df3ed5f9aeba61a7965d9c77f83'/>
<id>urn:sha1:c49b8b7052bb1df3ed5f9aeba61a7965d9c77f83</id>
<content type='text'>
vim has the 'binary' option and corresponding '-b' command line
flag.  These allow files to be opened in binary mode, ignoring
the 'fileformats' setting and treating all files as of type
'unix'.

Add these to busybox-w32 vi so it's possible to edit files which
have a mixture of different line endings.

Costs 80-112 bytes.

(GitHub issue #285)
</content>
</entry>
<entry>
<title>vi: allow change of 'fileformat' option</title>
<updated>2023-02-06T10:46:54+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-02-06T10:46:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c5fe5ad712e11e4d06d5becab5f888531f55a863'/>
<id>urn:sha1:c5fe5ad712e11e4d06d5becab5f888531f55a863</id>
<content type='text'>
For some reason the 'fileformat' option was made read-only when
it was introduced in commit 420afde92e (vi: add fileformats option).
I think I'd read some vim documentation that made it seem more
complicated than it really is.

Costs 48 bytes.
</content>
</entry>
<entry>
<title>awk: CRLF handling</title>
<updated>2023-01-30T10:33:59+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-01-30T10:33:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=7a537eb71874cd6c8d0e9ab1f906e6466e7f793c'/>
<id>urn:sha1:7a537eb71874cd6c8d0e9ab1f906e6466e7f793c</id>
<content type='text'>
Previous efforts at handling DOS-style line endings in awk have
included commits ee7e00dc5 and 1a3717342.

The use of remove_cr() is unwise:

- It's overzealous, removing all CRs, not just those in CRLF pairs.

- Even if that were fixed awk reads input in chunks. There's a
  remote chance a CRLF might appear at a chunk boundary and be
  missed.

remove_cr() will be fixed separately.  In awk treat all data input
as being in text mode.

Skipping CRs in skip_spaces() is also flawed.  Instead read scripts
in text mode.

Add a couple of test cases.  One of these (awk backslash+CRLF eaten
with no trace) fails without this patch.
</content>
</entry>
<entry>
<title>diff: improve --binary implementation</title>
<updated>2023-01-29T11:28:19+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-01-29T10:49:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=33ae88c40cf56b53c06e627e0535c9c740767aa4'/>
<id>urn:sha1:33ae88c40cf56b53c06e627e0535c9c740767aa4</id>
<content type='text'>
Commit 82f0d19b1 (diff: implement --binary flag) was both over-
complicated and incorrect.  If stdin was seekable it was left in
binary mode even if the --binary flag wasn't supplied.

Always open files in binary mode.  Only switch to text mode at the
last moment, if necessary.

Saves 48 bytes.
</content>
</entry>
<entry>
<title>diff: implement --binary flag</title>
<updated>2023-01-27T13:27:29+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-01-27T13:11:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=82f0d19b101271889b0b2ebe8cdb2f5eb4f64e6c'/>
<id>urn:sha1:82f0d19b101271889b0b2ebe8cdb2f5eb4f64e6c</id>
<content type='text'>
On Windows GNU diff uses text mode for input and output.  It also
has the '--binary' flag to use binary mode instead.  On Unix binary
mode is the default and the flag does nothing.

Alter diff to use text mode by default for input (though not output,
let's not go overboard).  Add the '--binary' flag to override this.

Costs 96-160 bytes.
</content>
</entry>
<entry>
<title>awk: further improvements to randomness</title>
<updated>2023-01-11T08:13:53+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-01-11T08:13:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=67fb94dea61e74da032a8f0c51fbf216ec47dadb'/>
<id>urn:sha1:67fb94dea61e74da032a8f0c51fbf216ec47dadb</id>
<content type='text'>
POSIX requires that the awk srand() function uses the time of day
to seed the PRNG.  The obvious implementation used in BusyBox does
exactly that, passing time(NULL) to srand(3).

When processes are started within a few seconds of one another their
seeds are very similar.  Given the realtively poor quality of rand(3)
in some C runtimes this results in random number sequences that are
somewhat correlated.

Improve matters by using an integer hash on the seed, as recommended
here:

   https://nullprogram.com/blog/2019/04/30/#the-wrong-places

Costs 48 bytes.

(GitHub issue #279)
</content>
</entry>
<entry>
<title>awk: make random values more random</title>
<updated>2023-01-06T15:51:30+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-01-06T15:51:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=6a61981e0480b8a469d9d4b84ea27a9ec1d2b8d9'/>
<id>urn:sha1:6a61981e0480b8a469d9d4b84ea27a9ec1d2b8d9</id>
<content type='text'>
When srand(3) is called to seed the random number generator with
the current time the first value returned by rand(3) changes slowly
with time.  This is a property of the implementation in the C runtime.

Change the order in which values from rand(3) are consumed to generate
the value returned by the awk rand() function.  This puts the value
returned by the first call to rand(3) in the least significant bits,
not the most significant.

(GitHub issue #279)
</content>
</entry>
<entry>
<title>ed: don't use memcpy with overlapping memory regions</title>
<updated>2023-01-05T15:21:48+00:00</updated>
<author>
<name>Sören Tempel</name>
<email>soeren+git@soeren-tempel.net</email>
</author>
<published>2022-02-08T19:29:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=ca96022d6edaaf619324db5a481698231d74d1df'/>
<id>urn:sha1:ca96022d6edaaf619324db5a481698231d74d1df</id>
<content type='text'>
The memcpy invocations in the subCommand function, modified by this
commit, previously used memcpy with overlapping memory regions. This is
undefined behavior. On Alpine Linux, it causes BusyBox ed to crash since
we compile BusyBox with -D_FORTIFY_SOURCE=2 and our fortify-headers
implementation catches this source of undefined behavior [0]. The issue
can only be triggered if the replacement string is the same size or
shorter than the old string.

Looking at the code, it seems to me that a memmove(3) is what was
actually intended here, this commit modifies the code accordingly.

[0]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13504

Signed-off-by: Sören Tempel &lt;soeren+git@soeren-tempel.net&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
