Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(msys) perl readline creates sys$command files w/o STDIN connected #12614

Closed
p5pRT opened this issue Nov 24, 2012 · 7 comments
Closed

(msys) perl readline creates sys$command files w/o STDIN connected #12614

p5pRT opened this issue Nov 24, 2012 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 24, 2012

Migrated from rt.perl.org#115900 (status was 'resolved')

Searchable as RT115900$

@p5pRT
Copy link
Author

p5pRT commented Nov 24, 2012

From sven.strickroth@tu-clausthal.de

perl -v
This is perl, v5.8.8 built for msys

Perl readline creates "sys$command" files when no STDIN is connected to
the perl process.

I noticed this issue on using msysgit with TortoiseGit. I tracked down
which msysgit versions are affected (<=1.7.7 work, but >=1.7.7.1 has the
issue), but both use the same perl versions (5.8.8) and
Termin/Readline.pl (1.02). I don't know how this issue was introduced,
but the reason seems to be that there is no "con"-file and $^O is
'msys', but a check is missing for this (in Term/ReadLine.pm, sub
findConsole, line 214 - see attached patch).

--
Best regards,
Sven Strickroth

@p5pRT
Copy link
Author

p5pRT commented Nov 24, 2012

From sven.strickroth@tu-clausthal.de

readline-fix.patch
--- "a/ReadLine.pm"	
+++ "b/ReadLine.pm"	
@@ -214,7 +214,7 @@ sub findConsole {
         $console = "Dev:Console";
     } elsif (-e "/dev/tty") {
 	$console = "/dev/tty";
-    } elsif (-e "con" or $^O eq 'MSWin32') {
+    } elsif (-e "con" or $^O eq 'MSWin32' or $^O eq 'msys') {
 	$console = "con";
     } else {
 	$console = "sys\$command";

@p5pRT
Copy link
Author

p5pRT commented Nov 25, 2012

From @craigberry

On Sat, Nov 24, 2012 at 12​:26 PM, Sven Strickroth
<perlbug-followup@​perl.org> wrote​:

# New Ticket Created by Sven Strickroth
# Please include the string​: [perl #115900]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=115900 >

perl -v
This is perl, v5.8.8 built for msys

Perl readline creates "sys$command" files when no STDIN is connected to
the perl process.

I noticed this issue on using msysgit with TortoiseGit. I tracked down
which msysgit versions are affected (<=1.7.7 work, but >=1.7.7.1 has the
issue), but both use the same perl versions (5.8.8) and
Termin/Readline.pl (1.02). I don't know how this issue was introduced,
but the reason seems to be that there is no "con"-file and $^O is
'msys', but a check is missing for this (in Term/ReadLine.pm, sub
findConsole, line 214 - see attached patch).

Thanks, I've applied your patch (manually, as GNU patch couldn't parse it) as​:

<http​://perl5.git.perl.org/perl.git/commitdiff/0a616d17c63ccea3e07a9370becf1d236ce89558>

Then I went a bit further and did​:

commit c0788ef
Author​: Craig A. Berry <craigberry@​mac.com>
Date​: Sun Nov 25 08​:54​:32 2012 -0600

  Rational findConsole dispatch for Term​::ReadLine.

  Back in 5.002 or so, if we didn't find /dev/tty and weren't on
  Windows, the console was assumed to be sys$command, which only
  makes sense on VMS (possibly $^O didn't work yet on VMS?).

  Later accretions have assumed that the sys$command default meant
  something other than laziness and a second if block with various
  specific overrides was added, some of which set the console back
  to undef after its having been set to sys$command.

  That can all be avoided by simply checking we're on VMS before
  setting the console to sys$command and letting it default to
  STDIN for cases where we don't know of something else specific
  that it should be.

diff --git a/dist/Term-ReadLine/lib/Term/ReadLine.pm
b/dist/Term-ReadLine/lib/Term/ReadLine.pm
index 6f94981..115ce15 100644
--- a/dist/Term-ReadLine/lib/Term/ReadLine.pm
+++ b/dist/Term-ReadLine/lib/Term/ReadLine.pm
@​@​ -238,19 +238,12 @​@​ sub findConsole {
  } elsif (-e "con" or $^O eq 'MSWin32' or $^O eq 'msys') {
  $console = 'CONIN$';
  $consoleOUT = 'CONOUT$';
- } else {
+ } elsif ($^O eq 'VMS') {
  $console = "sys\$command";
- }
-
- if (($^O eq 'amigaos') || ($^O eq 'beos') || ($^O eq 'epoc')) {
- $console = undef;
- }
- elsif ($^O eq 'os2') {
- if ($DB​::emacs) {
- $console = undef;
- } else {
+ } elsif ($^O eq 'os2' && !$DB​::emacs) {
  $console = "/dev/con";
- }
+ } else {
+ $console = undef;
  }

  $consoleOUT = $console unless defined $consoleOUT;
[end]

So I think the ticket can be closed. This is unlikely to make it into
the wild before 5.18, but it would be nice if the OP could verify that
all is well on msys before then.

@p5pRT
Copy link
Author

p5pRT commented Nov 25, 2012

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 26, 2012

From email@cs-ware.de

On So. 25. Nov. 2012, 08​:16​:12, craig.a.berry@​gmail.com wrote​:

Then I went a bit further and did​:

commit c0788ef
Author​: Craig A. Berry <craigberry@​mac.com>
Date​: Sun Nov 25 08​:54​:32 2012 -0600

So I think the ticket can be closed. This is unlikely to make it into
the wild before 5.18, but it would be nice if the OP could verify that
all is well on msys before then.

Works for me.

Sven

@p5pRT
Copy link
Author

p5pRT commented Nov 26, 2012

@cpansprout - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Nov 26, 2012
@p5pRT
Copy link
Author

p5pRT commented Nov 26, 2012

From sven.strickroth@tu-clausthal.de

Am 25.11.2012 17​:16 schrieb Craig Berry via RT​:

Then I went a bit further and did​:

commit c0788ef
Author​: Craig A. Berry <craigberry@​mac.com>
Date​: Sun Nov 25 08​:54​:32 2012 -0600

So I think the ticket can be closed. This is unlikely to make it into
the wild before 5.18, but it would be nice if the OP could verify that
all is well on msys before then.

Works for me.

--
Best regards,
Sven Strickroth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant