Skip to contentSkip to conversation

sftp-server for use with dropbear?

Buildroot Grant Edwards 3 participants 9 messages Sep 1, 2022 – Sep 8, 2022

lore
Share & tools
lore
#1 lore raw

Grant, All,

On 2022-09-01 18:41 -0000, Grant Edwards spake thusly:

Quoted 2 lines

Is there any source for an sftp-server for use with dropbear other than openssh?

What about gesftpserver, that has been present since Buildroot 2013.02?

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 7 lines · Yann E. MORIN

Grant, All,

On 2022-09-01 18:41 -0000, Grant Edwards spake thusly:

Quoted 2 lines

Is there any source for an sftp-server for use with dropbear other than openssh?

What about gesftpserver, that has been present since Buildroot 2013.02?

Thanks! I hadn't spotted that, and none of my Googling led to it either.

I currently can't select it in "menuconfig" because it requires a toolchain with wchar support. I think my (exernal) toolchain does have wchar support, but apparently buildroot hasn't been told about it...

--
Grant

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Grant, All,

On 2022-09-01 19:25 -0000, Grant Edwards spake thusly:

Quoted 9 lines · Yann E. MORIN
Quoted 4 lines

On 2022-09-01 18:41 -0000, Grant Edwards spake thusly:

Quoted 2 lines

Is there any source for an sftp-server for use with dropbear other than openssh?

What about gesftpserver, that has been present since Buildroot 2013.02?

I currently can't select it in "menuconfig" because it requires a toolchain with wchar support. I think my (exernal) toolchain does have wchar support, but apparently buildroot hasn't been told about it...

Wchar is optional only for uclibc toolchains; for glibc and musl, wchar is always available.

If you are using a pre-configured toolchain, that has wchar, but is not enabled in Buildroot, please send a patch to fix that.

If you are using a custom toolchain, then the conformity of whar is checked. You must select BR2_TOOLCHAIN_EXTERNAL_WCHAR (or deselect it) if your toolchain has wchar (or does not have it). Not doing so is going to result in a buildtime error. See toolchain/helpers.mk, line 306, which calls check_uclibc_feature, which will error out if the setting is not correct.

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
Quoted 6 lines · Yann E. MORIN
Quoted 6 lines
Quoted 1 line

What about gesftpserver, that has been present since Buildroot 2013.02?

I currently can't select it in "menuconfig" because it requires a toolchain with wchar support. I think my (exernal) toolchain does have wchar support, but apparently buildroot hasn't been told about it...

Rats. I was wrong. I assumed my toolchain had wchar support because usr/include/wchar.h existed, but it's a stub:

    $ cat ./arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/wchar.h

/* This wchar.h is used if wchar support is disabled in uClibc.
* We still want to provide a few basic definitions as the basic
* C standard requires them. And it makes our lives easier with
* no additional overhead.
*/
...

There's no way I can justify rebuilding the toolchain with uClibc wchar support enabled for gesftpserver when nothing else in my system needs wchar support. I'll have to figure out a new test/development workflow that doesn't use "scp" to copy files onto the target.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
Quoted 4 lines · Grant Edwards

There's no way I can justify rebuilding the toolchain with uClibc wchar support enabled for gesftpserver when nothing else in my system needs wchar support. I'll have to figure out a new test/development workflow that doesn't use "scp" to copy files onto the target.

It looks like the only place wchar support is used is in a couple spots in sftpclient in the interactive output handling where somebody is trying to keep things pretty by checking how many display columns will be occupied by a filename before it's printed using printf(). [For example in the output of the the "ls" command built in to the client, it tries to figure out how many columns of filenames to print, and how to pad them to keep things aligned.]

The server doesn't need wchar support at all.

So the easiest option for me is probably to change the .mk file to just build/install the server and not the client. I suppose the proper thing to do would be to change the Config.in file so that building the client is optional and wchar support is only required when the client is built.

Or I could patch the client so that if libc doesn't have wchar support, it assumes that number_of_columns(filename) == strlen(filename). People without wchar support who use UTF8 filenames would have to tolerate columns that don't line up in the output from the "ls" command.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw
Quoted 1 line · Grant Edwards

The server doesn't need wchar support at all.

I got gesftpserver's server to build without wchar support, and it works fine. But it's auto-selecting iconv. That makes the total rootfs size increase for the gesftpserver almost 1MB, and I can't justify that.

gesftpserver doesn't seem to be well-suited to small target systems like mine. It would be nice if it could be configured without the fancy bits for small systems, but maybe that's not allowed by later versions of the sftp protocol?

--
Grant

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw
Quoted 8 lines · Grant Edwards
Quoted 1 line · Grant Edwards

The server doesn't need wchar support at all.

I got gesftpserver's server to build without wchar support, and it works fine. But it's auto-selecting iconv. That makes the total rootfs size increase for the gesftpserver almost 1MB, and I can't justify that.

I looked at the iconv use, and it looks like it should be pretty easy to make iconv a configurable option -- whether that would be accepted upstream is another question.

But, I finally realized that my problem was triggered by an upgrade to openssh's "scp" utility v8.8 which uses the SFTP protocol by default instead of the SCP protocl. [If I wanted to use SFTP, I would have typed "sftp" not "scp".] It turns out that with openssh 8.8 "scp -O" works fine with dropbear. Unfortunately there's no config file or environment variables for scp like there is for ssh.

--
Grant

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw
In reply to Yann E. MORIN
Quoted 6 lines · On Thu, 1 Sep 2022 21:48:25 +0200 "Yann E. MORIN" <[email protected]>…

If you are using a custom toolchain, then the conformity of whar is checked. You must select BR2_TOOLCHAIN_EXTERNAL_WCHAR (or deselect it) if your toolchain has wchar (or does not have it). Not doing so is going to result in a buildtime error. See toolchain/helpers.mk, line 306, which calls check_uclibc_feature, which will error out if the setting is not correct.

I think we also do these checks for non-custom external toolchains, at least if I recall correctly.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot