Bug 1137

Summary: ssh does not always return code 255 when in error
Product: Portable OpenSSH Reporter: Olivier S. Masse <ombugr>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal    
Priority: P2    
Version: 4.2p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1047    
Attachments:
Description Flags
exit(255) for ssh internal errors none

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.