1. read_lines bug

On Linux, using read_lines on standard input with EU4.1 leads to display exceeding empty lines on standard output.

Let's consider this example:

include std/io.e 
 
procedure main(sequence cmd) 
  sequence source = read_lines(0)  -- read standard input 
end procedure 
 
main(command_line()) 

labo@silverstone1:~/Data/euphoria/v4$ /sbin/ifconfig eth0 | eui test_read_lines.ex 
 
 
 
 
 
 
 
 
labo@silverstone1:~/Data/euphoria/v4$ 

If read_lines is commented out in procedure main, then there is no additional empty line on standard output:

labo@silverstone1:~/Data/euphoria/v4$ /sbin/ifconfig eth0 | eui test_read_lines.ex 
labo@silverstone1:~/Data/euphoria/v4$ 

Jean-Marc

new topic     » topic index » view message » categorize

2. Re: read_lines bug

Well, that's caused by the following lines in io.e. around line 1151:

if fn = 0 then 
	puts(2, '\n') 
end if 

(writing to std_err if reading stdin)

The lines are easy enough to remove, but why are they there in the first place? Will removing them cause any other problems?

new topic     » goto parent     » topic index » view message » categorize

3. Re: read_lines bug

Link to source for the curious: https://github.com/OpenEuphoria/euphoria/blob/master/include/std/io.e#L1125

irv said...

The lines are easy enough to remove, but why are they there in the first place?

If I had to guess, maybe they were part of testing and left in by mistake. It'd make sense to want to see some indicate of the lines being read.

irv said...

Will removing them cause any other problems?

In my testing with the example provided above, no. But who knows what fringe case there might have been for those few lines to exist.

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: read_lines bug

ghaberek said...

Link to source for the curious: https://github.com/OpenEuphoria/euphoria/blob/master/include/std/io.e#L1125

irv said...

The lines are easy enough to remove, but why are they there in the first place?

irv said...

Will removing them cause any other problems?

In my testing with the example provided above, no. But who knows what fringe case there might have been for those few lines to exist.

It generates unexpected and undesired behavior, it seems, so it should probably be taken out, so long as all tests still perform successfully with it removed.

new topic     » goto parent     » topic index » view message » categorize

5. Re: read_lines bug

ghaberek said...

Link to source for the curious: https://github.com/OpenEuphoria/euphoria/blob/master/include/std/io.e#L1125

irv said...

The lines are easy enough to remove, but why are they there in the first place?

If I had to guess, maybe they were part of testing and left in by mistake. It'd make sense to want to see some indicate of the lines being read.

irv said...

Will removing them cause any other problems?

In my testing with the example provided above, no. But who knows what fringe case there might have been for those few lines to exist.

-Greg

I'm wondering if they improve manual console input. If you take that line out and then enter one, two, three, does the screen end up looking like "onetwothree"?
It could of course behave quite differently on linux and windows. (I've messed up my install a bit so I can't test this particular one on eui.)

new topic     » goto parent     » topic index » view message » categorize

6. Re: read_lines bug

petelomax said...

I'm wondering if they improve manual console input. If you take that line out and then enter one, two, three, does the screen end up looking like "onetwothree"?
It could of course behave quite differently on linux and windows. (I've messed up my install a bit so I can't test this particular one on eui.)

Taking them out seems to cause no problem on Linux.

new topic     » goto parent     » topic index » view message » categorize

7. Re: read_lines bug

irv said...
petelomax said...

I'm wondering if they improve manual console input. If you take that line out and then enter one, two, three, does the screen end up looking like "onetwothree"?
It could of course behave quite differently on linux and windows. (I've messed up my install a bit so I can't test this particular one on eui.)

Taking them out seems to cause no problem on Linux.

I got it to run by copying the routine in locally rather than using include std/io.e

It was a problem on windows in eui 4.0.0, but seems fine on 4.1.0 - which explains why that code was there.

EDIT: note that as phix slavishly copied the earlier rds eu behaviour, it remains a potential issue.
(Specifically gets0 in pfileioN.e tests for \r (and Ctrl Z) after each kernel32/ReadFile|syscall sys_read before echoing it with kernel32/WriteConsoleA|syscall sys_write)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu