Issue #16300 has been reported by Josh Cooper.

----------------------------------------
Bug #16300: Acceptance test fails on Windows due to mintty
https://projects.puppetlabs.com/issues/16300

Author: Josh Cooper
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: windows mintty pty
Branch: 


When executing the acceptance test 
`ticket_11727_support_stdin_parsing_in_puppet_parser_validate.rb` on Windows, 
this step fails on windows:

<pre>
 step "validate with a tty parses the default manifest"
 on agents, puppet('parser', 'validate'), :pty => true do
</pre>

The `pty` option causes the ssh client to request a pty to be allocated. This 
can be simulated as:

<pre>
$ ssh -t [email protected] "/cygdrive/c/ruby187/bin/ruby -e 'puts 
STDIN.tty?'"
debug1: Entering interactive session.
debug2: channel 0: request pty-req confirm 1
debug2: PTY allocation request accepted on channel 0
</pre>

The cygwin sshd reports that it allocated a console. However, it executes the 
mintty terminal emulator, which does not provide a real windows console. See 
<http://code.google.com/p/mintty/issues/detail?id=56#c29>. So `IO#tty?` is 
always false when using mintty.

This can be seen without ssh. From a local cmd.exe process, just execute 
`mintty.exe` and call ruby:

<pre>
C:\> mintty.exe
$ mintty --version 
mintty 1.0.3 
$ ruby --version 
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32] 
$ ruby -e "puts STDIN.tty?" 
false
</pre>

The reason for this is Ruby's `IO#tty?` method calls the `_isatty` function (in 
MS CRT), which only returns true if the file descriptor is associated with a 
character device (not a file, socket, named pipe, etc). See 
<http://msdn.microsoft.com/en-us/library/f4s0ddew.aspx>. Since mintty redirects 
terminal IO using named pipes, `IO#tty?` returns false.

Other interesting links:<br>
<https://groups.google.com/forum/#!topic/rubyinstaller/G6MWe1iyMao><br>
<http://stackoverflow.com/questions/3648711/detect-nul-file-descriptor-isatty-is-bogus><br>
<http://jira.codehaus.org/browse/JRUBY-5068>

Also Microsoft's SUA includes a built in sshd server that provides ptys, but it 
has been deprecated starting with Windows 8.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to