~yerinalexey

Russia (GMT+3)

https://yerinalexey.srht.site

Compiler guy. I like C, Rust and Go

~yerinalexey/public-inbox

Last active 4 days ago
View more

Recent activity

[PATCH hare-compress] zlib: Move decompress test to +test 4 hours ago

From Alexey Yerin to ~sircmpwn/hare-dev

---
Otherwise it fails to compile under latest harec

 compress/zlib/{data+test.ha => +test.ha} | 22 ++++++++++++++++++++++
 compress/zlib/reader.ha                  | 22 ----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)
 rename compress/zlib/{data+test.ha => +test.ha} (99%)

diff --git a/compress/zlib/data+test.ha b/compress/zlib/+test.ha
similarity index 99%
rename from compress/zlib/data+test.ha
rename to compress/zlib/+test.ha
index bac8624..a376e0a 100644
--- a/compress/zlib/data+test.ha
[message trimmed]

Re: [PATCH hare v2] os: add setenv and unsetenv 16 hours ago

From Alexey Yerin to ~sircmpwn/hare-dev

On Wed Jun 7, 2023 at 08:55 MSK, Ember Sawady wrote:
> +// Sets an environment variable. The name may not contain '=' or '\0'.
> +export fn setenv(name: const str, value: const str) (void | errors::invalid) = {
> +	unsetenv(name)?;
> +	append(envp, strings::join("=", name, value));
> +};

You should check for '=' and '\0' here. Also, I think we should also
make sure the value doesn't contain '\0'.

Re: [PATCH hare] os: add setenv and unsetenv a day ago

From Alexey Yerin to ~sircmpwn/hare-dev

On Tue Jun 6, 2023 at 19:10 MSK, Ember Sawady wrote:
> +// Looks up an environment variable and returns its value, or void if unset.
> +export fn getenv(name: const str) (str | void) = {
> +	getenvs(); // populate envp
> +	const name_b = strings::toutf8(name);
> +	let full = strings::concat(name, "=");
> +	defer free(full);
> +	for (let i = 0z; i < len(envp); i += 1) {
> +		if (strings::hasprefix(envp[i], full)) {
> +			return strings::cut(envp[i], "=").1;
> +		};
> +	};
> +	return void;
> +};

[PATCH himitsu v2] himtisu::query: rewrite the parser a day ago

From Alexey Yerin to ~sircmpwn/himitsu-devel

The old parser based on shlex::split had a few serious disadvantages:

* "x!!"=y and "x!"!=y produced the same result because shlex::split
  would split both of them as ["x!!=y"]. Though the first one is a
  public pair "x!!"="y", while the second is private pair "x!"="y".
  The same applies for '?'.

* Similar to the previous one, placing '=' inside a key is impossible
  because the parser can't distinguish between "a=b"=c and "a"="b=c"

* Keys were for some reason limited to the regex ^[-_A-Za-z]+$, which
  disallowed any non-ASCII characters as well as special characters
  such as '[' or ']'. This limitation prevented a lot of website
  credentials (e.g. GitLab) from being stored in a form useful to
[message trimmed]

[PATCH hare] os::exec: fill utime and stime a day ago

From Alexey Yerin to ~sircmpwn/hare-dev

Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
 os/exec/process+freebsd.ha | 14 ++++++++++++--
 os/exec/process+linux.ha   | 14 ++++++++++++--
 scripts/gen-stdlib         |  6 +++---
 stdlib.mk                  |  8 ++++----
 4 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/os/exec/process+freebsd.ha b/os/exec/process+freebsd.ha
index a5220f2f..930f3b10 100644
--- a/os/exec/process+freebsd.ha
+++ b/os/exec/process+freebsd.ha
@@ -3,8 +3,9 @@
// (c) 2021-2022 Drew DeVault <sir@cmpwn.com>
[message trimmed]

[PATCH] Add hare-gi a day ago

From Alexey Yerin to ~vladh/hare-project-library

---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 35ed4da..9513e96 100644
--- a/README.md
+++ b/README.md
@@ -71,6 +71,7 @@ If you're interested specifically in 3D graphics, check out
## GUI

* [~renart/hare-bemenu](https://git.sr.ht/~renart/hare-bemenu): Hare bindings for bemenu
* [~yerinalexey/hare-gi](https://git.sr.ht/~yerinalexey/hare-gi): GTK bindings and GObject Introspection bindings generator for Hare
* [~yerinalexey/hare-libui](https://git.sr.ht/~yerinalexey/hare-libui): Work-in-progress Hare bindings for the libui library
[message trimmed]

Re: Exit status of an exec::start process 2 days ago

From Alexey Yerin to ~sircmpwn/hare-users

Hi,

> let status = exec::wait(&proc)!;
> fmt::printfln("Status: {}", status.status)!;

status.status is a bit confusing. This field includes some flags
(whether the process exited by itself or was signalled externally)
alongside the actual exit code/signal.

You probably want to use exec::exit(&status) or exec::check(&status) to
decode that field.

Re: [PATCH hautils] pwd: Do not reassign mode on pwd -L 2 days ago

From Alexey Yerin to ~sircmpwn/hare-dev

On Mon Jun 5, 2023 at 21:11 MSK, Noah Altunian wrote:
> When ./pwd -L is invoked, mode is reassigned to mode::NORM, which
> is the default value. In this case we can simply use 'void'.

This causes problems if both -L and -P are given. `pwd -PL` would have
mode::REAL and as per POSIX,
"If both -L and -P are specified, the last one shall apply" -- pwd(1P),
so it should have mode::NORM instead.

Re: Arbitrary precision arithmetic in hare 2 days ago

From Alexey Yerin to ~sircmpwn/hare-users

I was working on a library that supports basic arbitrary precision:

https://git.sr.ht/~yerinalexey/hare-bigint

Unlike crypto::bigint, it automatically expands numbers on overflow,
but it has weak test coverage, uses too much memory and doesn't support
proper in-place operations (a = big::add(a, b) works, but it will create
a memory leak). I'll be working to resolve those issues in the near
future.

[RFC PATCH hare] Correctly convert strconv::base::DEC -> 10 5 days ago

From Alexey Yerin to ~sircmpwn/hare-dev

Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
 hare/lex/lex.ha | 25 ++++++++++++++-----------
 strconv/itos.ha |  4 ++++
 strconv/stoi.ha | 13 ++++++++-----
 strconv/stou.ha | 33 +++++++++++++++------------------
 4 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha
index acf8925a..4b10cd6e 100644
--- a/hare/lex/lex.ha
+++ b/hare/lex/lex.ha
@@ -410,7 +410,7 @@ fn lex_literal(lex: *lexer) (token | error) = {
	};
[message trimmed]