Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-14 Thread W. Michael Petullo
>> Here is a more practical example which demonstrates the problem: >> >> $ echo false | dbclient -T r...@host.example.com >> $ echo $? >> 0 > > I think this should now _really_ be fixed with > https://secure.ucc.asn.au/hg/dropbear/rev/79eef94ccea9 > > dbclient was ignoring all packets for

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-14 Thread Matt Johnston
Hi Mike, > On Sat 10/11/2018, at 12:52 am, W. Michael Petullo wrote: > > > Here is a more practical example which demonstrates the problem: > > $ echo false | dbclient -T r...@host.example.com > $ echo $? > 0 I think this should now _really_ be fixed with

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-10 Thread Peter Krefting
2018-11-10 12:53 skrev W. Michael Petullo: I read the reference you provided, but I am not yet convinced. Is it not true that pipelines by default produce the exit code from the right-most program in the pipeline? You're right and I am wrong. The exit code is the right-most command. Sorry

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-10 Thread u-pwhy
On Sat, Nov 10, 2018 at 10:44:03AM +0100, Peter Krefting wrote: > >$ echo false | dbclient -T r...@host.example.com > >$ echo $? > >0 > > That is because $? contains the exit status of the left-most command (echo), > not the pipe. If you are using a bash shell, you need to use PIPESTATUS to >

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-10 Thread W. Michael Petullo
>> Here is a more practical example which demonstrates the problem: >> >> $ echo false | dbclient -T r...@host.example.com >> $ echo $? >> 0 > That is because $? contains the exit status of the left-most command (echo), > not the pipe. If you are using a bash shell, you need to use PIPESTATUS

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-10 Thread Peter Krefting
2018-11-09 17:52 skrev W. Michael Petullo: Here is a more practical example which demonstrates the problem: $ echo false | dbclient -T r...@host.example.com $ echo $? 0 That is because $? contains the exit status of the left-most command (echo), not the pipe. If you are using a bash shell,

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-09 Thread W. Michael Petullo
>>> I am using Dropbear v2017.75 as found on OpenWrt. >>> >>> echo input | ssh -T h; echo $? >>> >>> Despite the error occurring, the above command line prints `0' rather >>> than `1.' Since this triggers the error, I would expect the latter >>> instead. >> After looking at the code, it appears

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-09 Thread Matt Johnston
Hi Michael, On 2018-11-09 3:48 pm, W. Michael Petullo wrote: >> I am using Dropbear v2017.75 as found on OpenWrt. >> >> echo input | ssh -T h; echo $? >> >> Despite the error occurring, the above command line prints `0' rather >> than `1.' Since this triggers the error, I would expect the

Re: Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-08 Thread W. Michael Petullo
> I am using Dropbear v2017.75 as found on OpenWrt. > > I am building a system around a special shell which exits with the value > of `1' upon encountering certain errors. Let us assume this shell runs > on the host "h." My aim is that the following will print `1' if such an > error occurs (using

Strange behaviour surrounding "ssh -T ..." and non-zero exit

2018-11-08 Thread W. Michael Petullo
I am using Dropbear v2017.75 as found on OpenWrt. I am building a system around a special shell which exits with the value of `1' upon encountering certain errors. Let us assume this shell runs on the host "h." My aim is that the following will print `1' if such an error occurs (using Dropbear's