Bug 1137 - ssh does not always return code 255 when in error
Summary: ssh does not always return code 255 when in error
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 4.2p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: 1047
  Show dependency treegraph
 
Reported: 2005-12-20 08:20 AEDT by Olivier S. Masse
Modified: 2006-10-07 11:43 AEST (History)
0 users

See Also:


Attachments
exit(255) for ssh internal errors (2.96 KB, patch)
2005-12-20 11:30 AEDT, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier S. Masse 2005-12-20 08:20:28 AEDT
The ssh client does not always return exit code 255 when it a client error occurs, as it is documented in the man page. For example, a refused or timed out connection returns exit code 1, while a unknown hostname returns 255. This makes automating tasks using ssh tricky, as I can't be sure if the exit code comes from the remote command or the client when there is a connection problem.

About 6 months ago, someone posted a report on the mailing list detailing the exact same problem, see: 
http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=111754196015597&w=2

I wondered if it could be possible to correct this in the client in the future. If the behaviour is normal, then the man page should then be updated, as currently this is ambiguous.

Thanks
Comment 1 Darren Tucker 2005-12-20 11:30:04 AEDT
Created attachment 1048 [details]
exit(255) for ssh internal errors

Fair enough.  I think this patch gets the appropriate ones.
Comment 2 Darren Tucker 2005-12-20 16:20:28 AEDT
The patch has been applied.  It will be in tomorrow's snapshot and the 4.3 release.

Thanks for the report.
Comment 3 Darren Tucker 2006-10-07 11:43:51 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.