You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kevin Pilch-Bisson <ke...@pilch-bisson.net> on 2002/09/30 22:51:24 UTC
pipe hanging on win32
I've attached a short example of what I am trying to do on in svn for the
benefit of any apr folks who may be able to look at this.
Basically I'm calling the run_pre_revprop_change_hook(), and it's hanging in
apr_file_flush(...) specifically in FlushFileBuffers it seems.
The hook script (shown below), is hanging in getc().
Any ideas why this isn't working?
Note that log.txt never includes anything from stdin.
int main(int argc, char **argv)
{
std::ofstream file("log.txt");
file << "Repos is: " << argv[1] << std::endl;
file << "Rev is: " << argv[2] << std::endl;
file << "Propname is: " << argv[3] << std::endl;
while (!std::cin.eof()) {
std::string s;
std::cin >> s;
file << s << std::endl;
}
file << std::ends;
file.close();
return 0;
}
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson
kevin@pilch-bisson.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: pipe hanging on win32
Posted by Branko Čibej <br...@xbc.nu>.
Kevin Pilch-Bisson wrote:
>I don't think that's what the problem is. My perl script which copied stdin
>to the log file had the same problem, I wrote the above hook just so that I
>could attach to it and see where it was hanging.
>
>
Ah! Important information, that. :-)
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
Re: pipe hanging on win32
Posted by Branko Čibej <br...@xbc.nu>.
Kevin Pilch-Bisson wrote:
>I don't think that's what the problem is. My perl script which copied stdin
>to the log file had the same problem, I wrote the above hook just so that I
>could attach to it and see where it was hanging.
>
>
Ah! Important information, that. :-)
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: pipe hanging on win32
Posted by Kevin Pilch-Bisson <ke...@pilch-bisson.net>.
Quoting brane@xbc.nu:
> Quoting Kevin Pilch-Bisson <ke...@pilch-bisson.net>:
>
> > I've attached a short example of what I am trying to do on in svn for
> > the benefit of any apr folks who may be able to look at this.
> >
> > Basically I'm calling the run_pre_revprop_change_hook(), and it's
> > hanging in apr_file_flush(...) specifically in FlushFileBuffers it seems.
> >
> > The hook script (shown below), is hanging in getc().
> >
> > Any ideas why this isn't working?
> >
> > Note that log.txt never includes anything from stdin.
> >
> > int main(int argc, char **argv)
> > {
> > std::ofstream file("log.txt");
> > file << "Repos is: " << argv[1] << std::endl;
> > file << "Rev is: " << argv[2] << std::endl;
> > file << "Propname is: " << argv[3] << std::endl;
> > while (!std::cin.eof()) {
> > std::string s;
> > std::cin >> s;
>
> IIRC this is a fairly well-known bug in MS's implementation of the iostream
> library. It hangs in getc() because it doesn't check for end-of-file
> correctly.
Well that's fine except that the same thing happens in a propval with no line
endings, or with DOS line endings or with Unix line endings.
>
> > file << s << std::endl;
>
> BTW, why are you breaking lines in the prop value like this? "std::cin >>
> s"
> will _not_ read a whole line of input.
I know, at this point I was just trying to see whether the hook got any input
at all.
>
> > }
> > file << std::ends;
>
> Hm. Stuffing nulls into text files is not nice, either.
Doh! That was a mistake.
>
> > file.close();
> > return 0;
> > }
>
>
> Anyway. Try rewriting that hook of yours in C, with appropriate eof checking.
> It
> has a good chance of working then. Or you might try to use "std::getline(cin,
> s,
> '\n')", maybe that doesn't tickle the same bug -- not to mention that lines
> will
> be broken correctly.
>
> Brane
I don't think that's what the problem is. My perl script which copied stdin
to the log file had the same problem, I wrote the above hook just so that I
could attach to it and see where it was hanging.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson
kevin@pilch-bisson.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: pipe hanging on win32
Posted by Kevin Pilch-Bisson <ke...@pilch-bisson.net>.
Quoting brane@xbc.nu:
> Quoting Kevin Pilch-Bisson <ke...@pilch-bisson.net>:
>
> > I've attached a short example of what I am trying to do on in svn for
> > the benefit of any apr folks who may be able to look at this.
> >
> > Basically I'm calling the run_pre_revprop_change_hook(), and it's
> > hanging in apr_file_flush(...) specifically in FlushFileBuffers it seems.
> >
> > The hook script (shown below), is hanging in getc().
> >
> > Any ideas why this isn't working?
> >
> > Note that log.txt never includes anything from stdin.
> >
> > int main(int argc, char **argv)
> > {
> > std::ofstream file("log.txt");
> > file << "Repos is: " << argv[1] << std::endl;
> > file << "Rev is: " << argv[2] << std::endl;
> > file << "Propname is: " << argv[3] << std::endl;
> > while (!std::cin.eof()) {
> > std::string s;
> > std::cin >> s;
>
> IIRC this is a fairly well-known bug in MS's implementation of the iostream
> library. It hangs in getc() because it doesn't check for end-of-file
> correctly.
Well that's fine except that the same thing happens in a propval with no line
endings, or with DOS line endings or with Unix line endings.
>
> > file << s << std::endl;
>
> BTW, why are you breaking lines in the prop value like this? "std::cin >>
> s"
> will _not_ read a whole line of input.
I know, at this point I was just trying to see whether the hook got any input
at all.
>
> > }
> > file << std::ends;
>
> Hm. Stuffing nulls into text files is not nice, either.
Doh! That was a mistake.
>
> > file.close();
> > return 0;
> > }
>
>
> Anyway. Try rewriting that hook of yours in C, with appropriate eof checking.
> It
> has a good chance of working then. Or you might try to use "std::getline(cin,
> s,
> '\n')", maybe that doesn't tickle the same bug -- not to mention that lines
> will
> be broken correctly.
>
> Brane
I don't think that's what the problem is. My perl script which copied stdin
to the log file had the same problem, I wrote the above hook just so that I
could attach to it and see where it was hanging.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson
kevin@pilch-bisson.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: pipe hanging on win32
Posted by br...@xbc.nu.
Oh blast. I just remembered why you have to be careful when piping
prop values to the hook's stdin. The standard streams are translated
by default on Windows, so pushing arbitrary binary streams through
them will come to a bad end. Remember what happened to svnadmin
dump/load when we did thet?
Re: pipe hanging on win32
Posted by br...@xbc.nu.
Oh blast. I just remembered why you have to be careful when piping
prop values to the hook's stdin. The standard streams are translated
by default on Windows, so pushing arbitrary binary streams through
them will come to a bad end. Remember what happened to svnadmin
dump/load when we did thet?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: pipe hanging on win32
Posted by br...@xbc.nu.
Quoting Kevin Pilch-Bisson <ke...@pilch-bisson.net>:
> I've attached a short example of what I am trying to do on in svn for
> the benefit of any apr folks who may be able to look at this.
>
> Basically I'm calling the run_pre_revprop_change_hook(), and it's
> hanging in apr_file_flush(...) specifically in FlushFileBuffers it seems.
>
> The hook script (shown below), is hanging in getc().
>
> Any ideas why this isn't working?
>
> Note that log.txt never includes anything from stdin.
>
> int main(int argc, char **argv)
> {
> std::ofstream file("log.txt");
> file << "Repos is: " << argv[1] << std::endl;
> file << "Rev is: " << argv[2] << std::endl;
> file << "Propname is: " << argv[3] << std::endl;
> while (!std::cin.eof()) {
> std::string s;
> std::cin >> s;
IIRC this is a fairly well-known bug in MS's implementation of the iostream
library. It hangs in getc() because it doesn't check for end-of-file correctly.
> file << s << std::endl;
BTW, why are you breaking lines in the prop value like this? "std::cin >> s"
will _not_ read a whole line of input.
> }
> file << std::ends;
Hm. Stuffing nulls into text files is not nice, either.
> file.close();
> return 0;
> }
Anyway. Try rewriting that hook of yours in C, with appropriate eof checking. It
has a good chance of working then. Or you might try to use "std::getline(cin, s,
'\n')", maybe that doesn't tickle the same bug -- not to mention that lines will
be broken correctly.
Brane
Re: pipe hanging on win32
Posted by br...@xbc.nu.
Quoting Kevin Pilch-Bisson <ke...@pilch-bisson.net>:
> I've attached a short example of what I am trying to do on in svn for
> the benefit of any apr folks who may be able to look at this.
>
> Basically I'm calling the run_pre_revprop_change_hook(), and it's
> hanging in apr_file_flush(...) specifically in FlushFileBuffers it seems.
>
> The hook script (shown below), is hanging in getc().
>
> Any ideas why this isn't working?
>
> Note that log.txt never includes anything from stdin.
>
> int main(int argc, char **argv)
> {
> std::ofstream file("log.txt");
> file << "Repos is: " << argv[1] << std::endl;
> file << "Rev is: " << argv[2] << std::endl;
> file << "Propname is: " << argv[3] << std::endl;
> while (!std::cin.eof()) {
> std::string s;
> std::cin >> s;
IIRC this is a fairly well-known bug in MS's implementation of the iostream
library. It hangs in getc() because it doesn't check for end-of-file correctly.
> file << s << std::endl;
BTW, why are you breaking lines in the prop value like this? "std::cin >> s"
will _not_ read a whole line of input.
> }
> file << std::ends;
Hm. Stuffing nulls into text files is not nice, either.
> file.close();
> return 0;
> }
Anyway. Try rewriting that hook of yours in C, with appropriate eof checking. It
has a good chance of working then. Or you might try to use "std::getline(cin, s,
'\n')", maybe that doesn't tickle the same bug -- not to mention that lines will
be broken correctly.
Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org