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: Egeyar Bagcioglu
Subject: Re: [PATCH 2/3] ios: Move file name normalization logic into ios-dev.h
Date: Sun, 11 Oct 2020 21:09:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0


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.

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

Regards
Ege



reply via email to

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