diff mbox series

[RFC,1/3] oeqa/target/ssh: update options for SCP

Message ID 20230602095037.97981-2-alexis.lothore@bootlin.com
State New
Headers show
Series add failed test artifacts retriever | expand

Commit Message

Alexis Lothoré June 2, 2023, 9:50 a.m. UTC
Add two options for SCP:
- by default scp expects sftp server to be available on target, which is
  not always true (e.g: core-image-minimal image). Pass -O to force SCP to
  fallback to legacy SCP protocol
- by default scp expects files. Passing -r option allows to copy
  directories too

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 meta/lib/oeqa/core/target/ssh.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Richard Purdie June 2, 2023, 12:02 p.m. UTC | #1
On Fri, 2023-06-02 at 11:50 +0200, Alexis Lothoré via
lists.openembedded.org wrote:
> Add two options for SCP:
> - by default scp expects sftp server to be available on target, which is
>   not always true (e.g: core-image-minimal image). Pass -O to force SCP to
>   fallback to legacy SCP protocol

We deliberately switched away from SCP since it is deprecated and will
be removed in a later openssh release. This is therefore a step
backwards, we really need to do something different.

> - by default scp expects files. Passing -r option allows to copy
>   directories too

Cheers,

Richard
Alexis Lothoré June 2, 2023, 1:41 p.m. UTC | #2
On 6/2/23 14:02, Richard Purdie wrote:
> On Fri, 2023-06-02 at 11:50 +0200, Alexis Lothoré via
> lists.openembedded.org wrote:
>> Add two options for SCP:
>> - by default scp expects sftp server to be available on target, which is
>>   not always true (e.g: core-image-minimal image). Pass -O to force SCP to
>>   fallback to legacy SCP protocol
> 
> We deliberately switched away from SCP since it is deprecated and will
> be removed in a later openssh release. This is therefore a step
> backwards, we really need to do something different.

Understood. Digging a bit about the deprecation issue and why it did not work on
my machine without this option, and based on fixes seen in mailing list around
this issue, I found out that my image was not configured properly (adding
dropbear package instead of enabling it as an IMAGE_FEATURE, which brings in
sftp support)
I guess keeping scp command but with sftp support instead of legacy scp support
is ok ? Or you are in fact talking about completely stopping using the scp
binary, even with sftp support ?

Kind regards,
> 
>> - by default scp expects files. Passing -r option allows to copy
>>   directories too
> 
> Cheers,
> 
> Richard
Richard Purdie June 2, 2023, 1:43 p.m. UTC | #3
On Fri, 2023-06-02 at 15:41 +0200, Alexis Lothoré wrote:
> On 6/2/23 14:02, Richard Purdie wrote:
> > On Fri, 2023-06-02 at 11:50 +0200, Alexis Lothoré via
> > lists.openembedded.org wrote:
> > > Add two options for SCP:
> > > - by default scp expects sftp server to be available on target, which is
> > >   not always true (e.g: core-image-minimal image). Pass -O to force SCP to
> > >   fallback to legacy SCP protocol
> > 
> > We deliberately switched away from SCP since it is deprecated and will
> > be removed in a later openssh release. This is therefore a step
> > backwards, we really need to do something different.
> 
> Understood. Digging a bit about the deprecation issue and why it did not work on
> my machine without this option, and based on fixes seen in mailing list around
> this issue, I found out that my image was not configured properly (adding
> dropbear package instead of enabling it as an IMAGE_FEATURE, which brings in
> sftp support)
> I guess keeping scp command but with sftp support instead of legacy scp support
> is ok ? Or you are in fact talking about completely stopping using the scp
> binary, even with sftp support ?

Using scp is fine but I don't think we can rely on the SCP protocol
staying around.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 51079075b5bd..dc17ceecd74d 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -40,8 +40,12 @@  class OESSHTarget(OETarget):
                 '-o', 'StrictHostKeyChecking=no',
                 '-o', 'LogLevel=ERROR'
                 ]
+        scp_options = [
+                '-O', # Allow legacy option for images not containing SFTP server
+                '-r'
+        ]
         self.ssh = ['ssh', '-l', self.user ] + ssh_options
-        self.scp = ['scp'] + ssh_options
+        self.scp = ['scp'] + ssh_options + scp_options
         if port:
             self.ssh = self.ssh + [ '-p', port ]
             self.scp = self.scp + [ '-P', port ]