9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Alexander Shendi <Alexander.Shendi@web.de>
To: 9front@9front.org
Cc: 9front@9front.org
Subject: Aw: Re: [9front] [PATCH] awk: don't write an extra NUL past the end of a block
Date: Tue, 23 Jan 2024 19:47:28 +0100	[thread overview]
Message-ID: <trinity-652b6b3d-cf13-4003-8e14-b456100ed8a8-1706035648508@msvc-mesg-web008> (raw)
In-Reply-To: <b6b8797a-c1d0-427a-8fd2-b349f5e995e3@posixcafe.org>

Hi,


DISCLAIMER:
i haven't seen either the code of 9front's awk or onetrueawk's code.

However that doesn't keep me from speculating. I suspect the fields are stored as an array of NUL-terminated strings itself terminated by a NUL char. So you would need to allocate n+2 bytes for the last field.



> Gesendet: Dienstag, den 23.01.2024 um 18:50 Uhr
> Von: "Jacob Moody" <moody@posixcafe.org>
> An: 9front@9front.org
> Betreff: Re: [9front] [PATCH] awk: don't write an extra NUL past the end of a block
>
> On my linux machine:
> # nawk is onetrueawk
> ; dd </dev/zero bs=4 count=8k | tr '\0' A | nawk '{a=$1}'
> 8192+0 records in
> 8192+0 records out
> 32768 bytes (33 kB, 32 KiB) copied, 0.00933006 s, 3.5 MB/s
>
> This works fine. No crash. I am not doubting this needs fixed,
> I am doubtful of fixing it in this way being correct. It is still
> not clear to me if there is some other input that is relying on
> that extra line to be there. But it is clear that onetrueawk fixed
> this using some other fix.
>
> We should figure out how they solved it and/or prove that the cases
> in which those loops never run are impossible to hit.
>

  reply	other threads:[~2024-01-23 18:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23  7:44 Kristo
2024-01-23 16:53 ` Jacob Moody
2024-01-23 17:40   ` qwx
2024-01-23 17:45     ` qwx
2024-01-23 17:50       ` Jacob Moody
2024-01-23 18:47         ` Alexander Shendi [this message]
2024-01-23 18:32   ` Kristo
2024-01-23 21:27     ` Jacob Moody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-652b6b3d-cf13-4003-8e14-b456100ed8a8-1706035648508@msvc-mesg-web008 \
    --to=alexander.shendi@web.de \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).