poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] ios: Move file name normalization logic into ios-dev.h


From: Jose E. Marchesi
Subject: Re: [PATCH 2/3] ios: Move file name normalization logic into ios-dev.h
Date: Mon, 12 Oct 2020 14:06:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> I played with the stream IOS implementation using the following little
>> Poke implementation of `strings' (yeah, it is the first Poke filter ever
>> written, and as you can see it uses the strategy we foresaw at Mont
>> Soleil):
>>
>> -----<-------
>> #!/usr/local/bin/poke -L
>> !#
>>
>> /* Printable ASCII characters: 0x20..0x7e */
>>
>> defvar stdin = open ("<stdin>");
>> defvar stdout = open ("<stdout>");
>>
>> defvar offset = 0#B;
>>
>> try
>> {
>>    flush (stdin, offset);
>>
>>    defvar b = byte @ stdin : offset;
>>    if (b >= 0x20 && b <= 0x7e)
>>      byte @ stdout : iosize (stdout) = b;
>>
>>    offset = offset + 1#B;
>> }
>> until E_eof;
>>
>> close (stdin);
>> close (stdout);
>> ------>-------
>>
>> It works, up to some point:
>>
>> $ cat /usr/bin/ncal | ./pstrings
>> poke: ../../libpoke/ios-buffer.h:244: ios_buffer_forget_till: Assertion 
>> `buffer->end_offset >= buffer->begin_offset' failed.
>> ELF> @m@8@@@@888WW ]] Aborted (core dumped)
>>
>> This is very exciting :)
>
> Huh! This is a combination of a bug and the lack of error handling on
> my side.
>
> 1) Remember that IO spaces are bit-addressable while IO devices are
> byte addressable? This means that ios.c has to convert the offsets
> that it receives. Well, it turns out that I forgot that one for
> ios_flush. For each byte we process, the code was trying to forget 8
> bytes.
>
> 2) Combine the above with the lack of error handling in stream ios and
> we get he bug you pointed out.

Ah, so that's why it fails after a point... 

> I am now sending the updated patch for stream ios and a patch to fix
> the error in (1).

Yep I just approved the second.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]