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

Addressed SCP Hanging Issue #376

Merged
merged 1 commit into from
May 21, 2019

Conversation

NoMoreFood
Copy link

  • Changed fileio_fdopen() to simply return the file descriptor for non-disk file types.
  • Addresses issue where an error message in SCP (server side) was not being returned to the pipe which causes the process to hang. Resolves: scp to non existing directory hangs Win32-OpenSSH#1345

- Changed fileio_fdopen() to simply return the file descriptor for non-disk file types.
- Addresses issue where an error message in SCP (server side) was not being returned to the pipe which causes the process to hang.  Resolves: PowerShell/Win32-OpenSSH#1345
/* for non-disk files, just return the descriptor */
type = GetFileType(pio->handle);
if (type != FILE_TYPE_DISK) {
return _fdopen(pio->table_index, mode);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relevant info - if the Windows handle associated with "fd" is originally opened as OVERLAPPED (as is the case with all file and pipe handles opened in the posix adapter), all synchronous operations on FILE returned by _fdopen will hang.

It is for that reason, the subsequent logic works around calling _fdopen directly on file handles. Are you not seeing the above behavior for pipe handles?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I do not see a hang -- this returns the handle successfully for the named pipe. The only "hang" I see is that one caused by the get_final_path_by_handle() returning NULL for a non-disk file which prevents the parent function from receiving the pipe handle which in turns prevents the calling function from receiving the error and closing the connection.

@manojampalam manojampalam merged commit 22cc95e into PowerShell:latestw_all May 21, 2019
@NoMoreFood NoMoreFood deleted the scphang_issue branch May 22, 2019 11:14
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

Successfully merging this pull request may close these issues.

scp to non existing directory hangs
2 participants