public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64)
@ 2015-08-25  8:48 Luke Goodsell
  2015-08-25  9:17 ` Marco Atzeri
  2015-08-25  9:40 ` Achim Gratz
  0 siblings, 2 replies; 6+ messages in thread
From: Luke Goodsell @ 2015-08-25  8:48 UTC (permalink / raw)
  To: cygwin

Hi,

Please can you help me to diagnose this issue?

Attempting Perl Term::ReadKey from an empty string under Cygwin causes perl to segmentation fault. The same command on Debian, or with a non-empty string, works fine.

Example command:

> perl -MTerm::ReadKey -e 'my $input = ""; open(my $stdin, "<", \$input) or die "failed to open: $!"; local *STDIN = $stdin; ReadMode "raw"; my $response = ReadKey(1, \*STDIN); ReadMode "normal"; print "Got \"$response\"\n";'

Response under cygwin:

> Segmentation fault (core dumped)

Response under Debian:

> Got ""

Changing $input to anything non-empty works properly.

Cygwin dll version: 1.7.32
Perl version: 5.14.4
Term::ReadKey version: 2.33

Kind regards,
Luke


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64)
  2015-08-25  8:48 Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64) Luke Goodsell
@ 2015-08-25  9:17 ` Marco Atzeri
  2015-08-25  9:43   ` Luke Goodsell
  2015-08-25  9:40 ` Achim Gratz
  1 sibling, 1 reply; 6+ messages in thread
From: Marco Atzeri @ 2015-08-25  9:17 UTC (permalink / raw)
  To: cygwin

On 25/08/2015 10:48, Luke Goodsell wrote:
> perl -MTerm::ReadKey -e 'my $input = ""; open(my $stdin, "<", \$input) or die "failed to open: $!"; local *STDIN = $stdin; ReadMode "raw"; my $response = ReadKey(1, \*STDIN); ReadMode "normal"; print "Got \"$response\"\n";

I will bet in a lack of string end somewhere.

  $ perl -MTerm::ReadKey -E 'my $input = "\0" ; open(my $stdin, "<", 
\$input) or die "failed to open: $!"; local *STDIN = $stdin; ReadMode 
"raw"; my $response = ReadKey(1, \*STDIN); ReadMode "normal"; print "Got 
\"$response\"\n";'
Got ""




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64)
  2015-08-25  8:48 Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64) Luke Goodsell
  2015-08-25  9:17 ` Marco Atzeri
@ 2015-08-25  9:40 ` Achim Gratz
  2015-08-25  9:52   ` Luke Goodsell
  1 sibling, 1 reply; 6+ messages in thread
From: Achim Gratz @ 2015-08-25  9:40 UTC (permalink / raw)
  To: cygwin

Luke Goodsell <Luke.Goodsell <at> ogt.com> writes:
> Please can you help me to diagnose this issue?

The stacktrace is useless, but if you run this under strace you'll also see
a message that doesn't make it to the output otherwise:

syntax error at -e line 1, near "= ;"
Unterminated <> operator at -e line 1.

The reason for the later segfault might already be here.

> Attempting Perl Term::ReadKey from an empty string under Cygwin causes
perl to segmentation fault. The
> same command on Debian, or with a non-empty string, works fine.

Please report this upstream.


Regards,
Achim.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64)
  2015-08-25  9:17 ` Marco Atzeri
@ 2015-08-25  9:43   ` Luke Goodsell
  0 siblings, 0 replies; 6+ messages in thread
From: Luke Goodsell @ 2015-08-25  9:43 UTC (permalink / raw)
  To: Marco Atzeri, cygwin

Hi Marco,

>   $ perl -MTerm::ReadKey -E 'my $input = "\0" ; open(my $stdin, "<", \$input) or die "failed to open: $!"; local *STDIN = $stdin; ReadMode "raw"; my $response = ReadKey(1, \*STDIN); ReadMode "normal"; print "Got \"$response\"\n";'
> Got ""

I get:

> Got " "

... whereas I would expect an empty string.

Kind regards,
Luke

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64)
  2015-08-25  9:40 ` Achim Gratz
@ 2015-08-25  9:52   ` Luke Goodsell
  2015-08-25 12:06     ` Achim Gratz
  0 siblings, 1 reply; 6+ messages in thread
From: Luke Goodsell @ 2015-08-25  9:52 UTC (permalink / raw)
  To: Achim Gratz, cygwin

Hi Achim,

> The stacktrace is useless, but if you run this under strace you'll also see a message that doesn't make it to the output otherwise:

That arises from the subsequent print statement, which is never reached under cygwin.

Alternative command that eliminates that warning:

perl -MTerm::ReadKey -we 'my $input = ""; open(my $stdin, "<", \$input) or die "failed to open: $!"; local *STDIN = $stdin; ReadMode "raw"; my $response = ReadKey(1, \*STDIN); ReadMode "normal"; if(defined($response)) { print "Got \"$response\"\n"; } else { print "Got undef\n"; }'

> Please report this upstream.

To whom would that be? Perl devs?

Kind regards,
Luke

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64)
  2015-08-25  9:52   ` Luke Goodsell
@ 2015-08-25 12:06     ` Achim Gratz
  0 siblings, 0 replies; 6+ messages in thread
From: Achim Gratz @ 2015-08-25 12:06 UTC (permalink / raw)
  To: cygwin

Luke Goodsell <Luke.Goodsell <at> ogt.com> writes:
> > Please report this upstream.
> 
> To whom would that be? Perl devs?

The module is on CPAN, with the following link to the bug tracker:
https://rt.cpan.org/Public/Dist/Display.html?Name=TermReadKey


Regards,
Achim


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-25 12:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-25  8:48 Perl Term::ReadKey from empty scalar Segfaults under cygwin only (1.7.32 x86_64) Luke Goodsell
2015-08-25  9:17 ` Marco Atzeri
2015-08-25  9:43   ` Luke Goodsell
2015-08-25  9:40 ` Achim Gratz
2015-08-25  9:52   ` Luke Goodsell
2015-08-25 12:06     ` Achim Gratz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).