Re: RFC on file_store()



Hi!

> I've just discovered a very suspicious piece of code in fish.c, function
> file_store():
> 
>     while (1) {
>         while ((n = read(h, buffer, sizeof(buffer))) < 0) {
>             if ((errno == EINTR) && got_interrupt)
>                 continue;
>             print_vfs_message(_("fish: Local read failed, sending zeros") );
>             close(h);
>             h = open( "/dev/zero", O_RDONLY );
>         }
>         if (n == 0)
>             break;
> 
> You are using got_interrupt without parentheses. It's always true. But do
> you really mean to continue if the user tries to interrupt the command?
> 
> It may happen that some data has been read. Then n will be positive, but
> still the user interrupt should be honored.
> 
> Sending zeroes is very bad. It means corrupted data on the remote side. Is
> it possible to send break instead?

Congratulation, you've just discovered problem in fish :-(.

Ok, I knew about this before. Problem is: what to do? Do you think
dropping connection and reconnecting is the right thing?

[There's another ugly problem in fish: Imagine file full of rm -rf /
being sent to remote. Imagine something wents horribly wrong (both dds
killed). Hopefully that will just never happen in practice.]

								Pavel


-- 
The best software in life is free (not shareware)!		Pavel
GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+




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