Sftp ошибка 31

GNU Midnight Commander 4.8.13
Built with GLib 2.42.1
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, sftpfs, fish
Data types: char: 8; int: 32; long: 32; void *: 32; size_t: 32; off_t: 64;


Package: libssh2-1
Source: libssh2
Version: 1.4.3-4


Local version string SSH-2.0-OpenSSH_6.7p1 Debian-3
Remote protocol version 2.0, remote software version dropbear_0.52


Seems that after OpenSSH Server update after infamous Heartblead bug, Im allways getting these errors when copying / moving files within SFTP built in mc:

COPY/MOVE FILE TO REMOTE: «-31: SFTP Protocol Error»
REMOVE REMOTE FILE/DIR: «-31: Failed opening remote file»

Although after I press ENTER — operation continues successfully, however when transfering lots of selected files I have to acknowledge (press ENTER) on every file operation, so batch copy / move / remove operations are inefficient.

Doing verbose CLI sftp connection to the same server, succeeds without errors.
Also to note that to speed up transfers in ssh config file I prioritised blowfish protocol, what is honoured by sftp transfers, but NOT with mc sftp, as with sftp CLI (specifying blowfish) I get allmost twice the speed, but mc sftp transfer speeds are similar to the ones when I force AES encryption on CLI sftp.

Странно, это же исключительно патч-релиз, т.е. релиз с исправлением ошибок, не более.

gag ★★★★★
()

  • Ссылка

Проверил у себя на 4.8.17 — заходит на сервер через sftp и можно браузить/создавать/удалять директории, смотреть файлы, менять пермишены и т.д. но при попытке залить выдает:

SFTP Protocol Error (-31)

При этом файлы на сервере создаются, но на каждую операцию копирования приходится видеть сообщение об ошибке.

IceMan
()

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от IceMan

Проверил на старых версиях MC от 4.8.17 до 4.8.13 — ошибка SFTP Protocol Error (-31) есть на всех версиях. Возможно дело в libssh2, которую использует MC.

IceMan
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от IceMan

Ответ на:

комментарий
от IceMan

4.8.17 както странно ведет себя — файл может и залить, но обычно нет — выдает Resource temporarily unavailable
при этом 4.8.15 заливает все ок
надо выяснить закономерность, пока не понял
в качестве сервера sshdroid

ошибку -31 выдают все версии, не обращаю внимания

x905 ★★★★★
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905

4.8.17 както странно ведет себя — файл может и залить, но обычно нет

Я ни разу не видел пока. cd sh://… использую активно.

AS ★★★★★
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от AS

пересобрал из исходников на убунте 1604 — все также не копирует (т.е. заходит, начинает копирование и ошибка. потом там остается нулевой файл)

x905 ★★★★★
()

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от x905

Ответ на:

комментарий
от x905

пересобрал из исходников

—enable-vfs-sftp в опциях ./configure был? Убирай его нахер, пробуй через fish, он в 10 раз быстрее. Не было? Добавляй.

anonymous
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от anonymous

—enable-vfs-sftp в опциях ./configure был?

сначала не было —enable-vfs-sftp — не заходил совсем
добавил, стал заходить, и затем ошибка

убрал —enable-vfs-sftp и добавил —enable-vfs-fish — поведение не улучшилось (заходит, но не копирует)

x905 ★★★★★
()

  • Ссылка

Ответ на:

комментарий
от x905

Ответ на:

комментарий
от AS

что интересно — маленькие файлы (до 20кб) отправляет успешно, странно

x905 ★★★★★
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905

Ответ на:

комментарий
от AS

не, не оно т.к.:
1. 4.8.15 не имеет проблем и при отправки сотни мегабайт
2. 4.8.17 уже и 30 кб не отправляет
3. в /tmp место очень много

возможно проблемы 4.8.17 именно с отправкой на андроид, на другую железяку проверю завтра
пока держу еще и 4.8.15 (отдельно один бинарник) — его и запускаю когда надо отправить файл )

x905 ★★★★★
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905

проверка 4.8.17 на другой железке успешна, но там используется shell-соединение
но sshdroid хочет только sftp-соединение, на котором 4.8.17 не может работать

x905 ★★★★★
()

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905

но sshdroid хочет только sftp-соединение, на котором 4.8.17 не может работать

Тогда это надо бы в багтрекер. Особенно, если недавно работало.

AS ★★★★★
()

  • Ссылка

Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.

Documentation » Getting Started » Protocols » SFTP »

SFTP status/error codes are a numerical codes that an SFTP server1 uses to indicate a result of a client request (i.e. a request sent by WinSCP to the server).

WinSCP translates the numerical codes to a textual description for you, so you do not have to remember them.

The SFTP server should also provide a meaningful textual description of the error itself. WinSCP includes the server-side description in its error message, labeled “Error message from server”. Such description can include more detailed information than WinSCP can possibly deduce from the numerical code.

Advertisement

  • Code 4 (Failure)
  • Codes List
  • References

Code 4 (Failure)

Note that not all servers use all codes. Most SSH/SFTP servers, including the most commonly used OpenSSH, support only SFTP version 3 that defines only codes 0 to 8.

These servers would generally use code 4 (Failure) for many errors for which there is a specific code defined in the later versions of SFTP protocol, such as:

  • Renaming a file to a name of already existing file.
  • Creating a directory that already exists.
  • Moving a remote file to a different filesystem (HDD).
  • Uploading a file to a full filesystem (HDD).
  • Exceeding a user disk quota.

In this case the server is required to provide meaningful description of the error itself (see above). Unfortunately, OpenSSH SFTP server uses always description “Failure”. Is such case, there is unfortunately no way to tell a reason of the failure.

Codes List

Code Name Description Comment
0 OK Indicates successful completion of the operation.
1 EOF An attempt to read past the end-of-file was made; or, there are no more directory entries to return.
2 No such file A reference was made to a file which does not exist.
3 Permission denied The user does not have sufficient permissions to perform the operation.
4 Failure An error occurred, but no specific error code exists to describe the failure. This error message should always have meaningful text in the error message field. See above.
5 Bad message A badly formatted packet or other SFTP protocol incompatibility was detected.
6 No connection There is no connection to the server. This error may be used locally, but must not be return by a server. WinSCP does not use the code.
7 Connection lost The connection to the server was lost. This error may be used locally, but must not be return by a server. WinSCP does not use the code.
8 Operation unsupported An attempted operation could not be completed by the server because the server does not support the operation. It may be returned by the server if the server does not implement an operation.
9 Invalid handle The handle value was invalid.
10 No such path The file path does not exist or is invalid.
11 File already exists The file already exists.
12 Write protect The file is on read-only media, or the media is write protected.
13 No media The requested operation cannot be completed because there is no media available in the drive.
14 No space on file-system The requested operation cannot be completed because there is insufficient free space on the filesystem.
15 Quota exceeded The operation cannot be completed because it would exceed the user’s storage quota.
16 Unknown principal A principal referenced by the request (either the owner, group, or who field of an ACL), was unknown.
17 Lock conflict The file could not be opened because it is locked by another process.
18 Directory not empty The directory is not empty.
19 Not a directory The specified file is not a directory.
20 Invalid filename The filename is not valid.
21 Link loop Too many symbolic links encountered or, an SSH_FXF_NOFOLLOW open encountered a symbolic link as the final component
22 Cannot delete The file cannot be deleted. One possible reason is that the advisory read-only attribute-bit is set.
23 Invalid parameter One of the parameters was out of range, or the parameters specified cannot be used together.
24 File is a directory The specified file was a directory in a context where a directory cannot be used.
25 Range lock conflict A read or write operation failed because another process’s mandatory byte-range lock overlaps with the request. WinSCP does not use byte range locking.
26 Range lock refused A request for a byte range lock was refused. WinSCP does not use byte range locking.
27 Delete pending An operation was attempted on a file for which a delete operation is pending.
28 File corrupt The file is corrupt; an filesystem integrity check should be run.
29 Owner invalid The principal specified can not be assigned as an owner of a file.
30 Group invalid The principal specified can not be assigned as the primary group of a file.
31 No matching byte range lock The requested operation could not be completed because the specified byte range lock has not been granted. WinSCP does not use byte range locking.

Advertisement

References

  • Status response section of draft-ietf-secsh-filexfer-13;
  • SFTP specifications list in “History and development” section of SSH File Transfer Protocol.

GNU Midnight Commander 4.8.13
Built with GLib 2.42.1
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, sftpfs, fish
Data types: char: 8; int: 32; long: 32; void *: 32; size_t: 32; off_t: 64;


Package: libssh2-1
Source: libssh2
Version: 1.4.3-4


Local version string SSH-2.0-OpenSSH_6.7p1 Debian-3
Remote protocol version 2.0, remote software version dropbear_0.52


Seems that after OpenSSH Server update after infamous Heartblead bug, Im allways getting these errors when copying / moving files within SFTP built in mc:

COPY/MOVE FILE TO REMOTE: «-31: SFTP Protocol Error»
REMOVE REMOTE FILE/DIR: «-31: Failed opening remote file»

Although after I press ENTER — operation continues successfully, however when transfering lots of selected files I have to acknowledge (press ENTER) on every file operation, so batch copy / move / remove operations are inefficient.

Doing verbose CLI sftp connection to the same server, succeeds without errors.
Also to note that to speed up transfers in ssh config file I prioritised blowfish protocol, what is honoured by sftp transfers, but NOT with mc sftp, as with sftp CLI (specifying blowfish) I get allmost twice the speed, but mc sftp transfer speeds are similar to the ones when I force AES encryption on CLI sftp.

Странно, это же исключительно патч-релиз, т.е. релиз с исправлением ошибок, не более.

gag ★★★★★

(14.05.16 04:31:52 MSK)

  • Ссылка

Проверил у себя на 4.8.17 — заходит на сервер через sftp и можно браузить/создавать/удалять директории, смотреть файлы, менять пермишены и т.д. но при попытке залить выдает:

SFTP Protocol Error (-31)

При этом файлы на сервере создаются, но на каждую операцию копирования приходится видеть сообщение об ошибке.

IceMan

(27.05.16 10:18:35 MSK)

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от IceMan 27.05.16 10:18:35 MSK

Проверил на старых версиях MC от 4.8.17 до 4.8.13 — ошибка SFTP Protocol Error (-31) есть на всех версиях. Возможно дело в libssh2, которую использует MC.

IceMan

(27.05.16 10:36:27 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от IceMan 27.05.16 10:36:27 MSK

Ответ на:

комментарий
от IceMan 27.05.16 10:18:35 MSK

4.8.17 както странно ведет себя — файл может и залить, но обычно нет — выдает Resource temporarily unavailable
при этом 4.8.15 заливает все ок
надо выяснить закономерность, пока не понял
в качестве сервера sshdroid

ошибку -31 выдают все версии, не обращаю внимания

x905 ★★★★★

(27.05.16 11:39:29 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905 27.05.16 11:39:29 MSK

4.8.17 както странно ведет себя — файл может и залить, но обычно нет

Я ни разу не видел пока. cd sh://… использую активно.

AS ★★★★★

(14.06.16 17:25:44 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от AS 14.06.16 17:25:44 MSK

пересобрал из исходников на убунте 1604 — все также не копирует (т.е. заходит, начинает копирование и ошибка. потом там остается нулевой файл)

x905 ★★★★★

(15.06.16 11:17:21 MSK)

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от x905 15.06.16 11:17:21 MSK

Ответ на:

комментарий
от x905 15.06.16 11:17:21 MSK

пересобрал из исходников

—enable-vfs-sftp в опциях ./configure был? Убирай его нахер, пробуй через fish, он в 10 раз быстрее. Не было? Добавляй.

anonymous

(15.06.16 12:02:45 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от anonymous 15.06.16 12:02:45 MSK

—enable-vfs-sftp в опциях ./configure был?

сначала не было —enable-vfs-sftp — не заходил совсем
добавил, стал заходить, и затем ошибка

убрал —enable-vfs-sftp и добавил —enable-vfs-fish — поведение не улучшилось (заходит, но не копирует)

x905 ★★★★★

(15.06.16 12:48:38 MSK)

  • Ссылка

Ответ на:

комментарий
от x905 15.06.16 11:17:21 MSK

Ответ на:

комментарий
от AS 15.06.16 13:52:30 MSK

что интересно — маленькие файлы (до 20кб) отправляет успешно, странно

x905 ★★★★★

(15.06.16 14:39:28 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905 15.06.16 14:39:28 MSK

Ответ на:

комментарий
от AS 15.06.16 18:10:42 MSK

не, не оно т.к.:
1. 4.8.15 не имеет проблем и при отправки сотни мегабайт
2. 4.8.17 уже и 30 кб не отправляет
3. в /tmp место очень много

возможно проблемы 4.8.17 именно с отправкой на андроид, на другую железяку проверю завтра
пока держу еще и 4.8.15 (отдельно один бинарник) — его и запускаю когда надо отправить файл )

x905 ★★★★★

(15.06.16 21:52:32 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905 15.06.16 21:52:32 MSK

проверка 4.8.17 на другой железке успешна, но там используется shell-соединение
но sshdroid хочет только sftp-соединение, на котором 4.8.17 не может работать

x905 ★★★★★

(16.06.16 09:00:30 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от x905 16.06.16 09:00:30 MSK

но sshdroid хочет только sftp-соединение, на котором 4.8.17 не может работать

Тогда это надо бы в багтрекер. Особенно, если недавно работало.

AS ★★★★★

(16.06.16 09:21:07 MSK)

  • Ссылка

Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.

Ticket System

unread,

Feb 18, 2015, 1:44:57 AM2/18/15

to junk…@inbox.lv, mc-…@googlegroups.com

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————————-+————————————-
Reporter: pingu | Type: defect
Status: new | Priority: minor
Milestone: Future Releases | Component: mc-vfs
Version: master | Keywords: -31 sftp
Blocked By: | error chiper
Branch state: no branch | Blocking:
| Votes for changeset:
————————————-+————————————-
GNU Midnight Commander 4.8.13
Built with GLib 2.42.1
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs,
sftpfs, fish
Data types: char: 8; int: 32; long: 32; void *: 32; size_t: 32; off_t: 64;
———————————————————————————-
Package: libssh2-1
Source: libssh2
Version: 1.4.3-4
———————————————————————————-
Local version string SSH-2.0-OpenSSH_6.7p1 Debian-3
Remote protocol version 2.0, remote software version dropbear_0.52
———————————————————————————-

Seems that after OpenSSH Server update after infamous Heartblead bug, Im
allways getting these errors when copying / moving files within SFTP built
in mc:

COPY/MOVE FILE TO REMOTE: «-31: SFTP Protocol Error»
REMOVE REMOTE FILE/DIR: «-31: Failed opening remote file»

Although after I press ENTER — operation continues successfully, however
when transfering lots of selected files I have to acknowledge (press
ENTER) on every file operation, so batch copy / move / remove operations
are inefficient.

Doing verbose CLI sftp connection to the same server, succeeds without
errors.
Also to note that to speed up transfers in ssh config file I prioritised
blowfish protocol, what is honoured by sftp transfers, but NOT with mc
sftp, as with sftp CLI (specifying blowfish) I get allmost twice the
speed, but mc sftp transfer speeds are similar to the ones when I force
AES encryption on CLI sftp.


Ticket URL: <http://www.midnight-commander.org/ticket/3406>
Midnight Commander <http://www.midnight-commander.org>
Midnight Development Center

Ticket System

unread,

May 17, 2015, 12:46:52 PM5/17/15

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————
Changes (by ginggs):

* cc: graham@… (added)


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:1>

Ticket System

unread,

Jun 3, 2015, 2:53:22 PM6/3/15

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by jkeil):

I did a git bisect and came across
`512ad7d96250ea5a2ab2197e0b8a02af29d419d1` which was a re-factoring of the
error handling.
Previously (`512ad7d96250ea5a2ab2197e0b8a02af29d419d1^`) the error would
just be swallowed. Now, after the re-factoring it is properly propagated
and displayed.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:2>

Ticket System

unread,

Jan 3, 2016, 8:22:44 PM1/3/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by and):

«-31: SFTP Protocol Error» message can be triggered when entering a remote
directory with a symlink pointed to file which located at non readable
directory.

/testfile -> /non-accessible-directory/testfile

mc use libssh2_sftp_stat_ex with LIBSSH2_SFTP_LSTAT type, remote lstat()
failed
and currently mc not handled this event correctly.

first we need to pimp up sftpfs_ssherror_to_gliberror() to get knowledge
about calling libssh2 function and libssh2_sftp_last_error() error code
when LIBSSH2_ERROR_SFTP_PROTOCOL (aka -31) occurs.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:3>

Ticket System

unread,

Jan 7, 2016, 9:01:15 PM1/7/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by and):

first patch incorporate sftp session error hint


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:4>

Ticket System

unread,

Nov 12, 2016, 1:56:03 AM11/12/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by drankinatty):

Just wanted to bump this ticket to say this is still a problem in:
Version : 4.8.18-1
Build Date : Fri 07 Oct 2016 10:34:16 AM CDT (Archlinux)

Upon sftp to remote site, copying file from remote back to originating
machine, the following error is displayed:

«Failed opening remote file (-31)»

Upon acknowledging the error by hitting return, the copy completes
successfully despite the error.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:5>

Ticket System

unread,

Dec 29, 2016, 5:13:12 PM12/29/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

Any progress?

The version in debian/sid also segv after a while (3:4.8.18-1).

I’m trying to copy a bunch of files over a raspbian/jessie, the path I’m
copying into doesn’t have any symlink and any user can read and traverse
every directory of the destination path.

I tried mc from sources (4.8.18-163-g67b3d6495/glib:2.50.2) without and
with both the patches above, it doesn’t segv but the error -31 is still
present.

Ignoring the error I’ve copied about 5600 files (49M) without errors (md5
checked), now if I try to overwrite just one it segv, the terminal show a
ridiculous alloc failed in glib/gmem.c

{{{
(mc:31619): GLib-ERROR **:
/build/glib2.0-m2w47E/glib2.0-2.50.2/./glib/gmem.c:100: failed to allocate
94337158982256 bytes
}}}

{{{
0x00007f52702f6261 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0 0x00007f52702f6261 in ?? () from /lib/x86_64-linux-
gnu/libglib-2.0.so.0
#1 0x00007f52702f72b7 in g_log_default_handler () from /lib/x86_64-linux-
gnu/libglib-2.0.so.0
#2 0x00007f52702f75c4 in g_logv () from /lib/x86_64-linux-
gnu/libglib-2.0.so.0
#3 0x00007f52702f77cf in g_log () from /lib/x86_64-linux-
gnu/libglib-2.0.so.0
#4 0x00007f52702f5e34 in g_malloc () from /lib/x86_64-linux-
gnu/libglib-2.0.so.0
#5 0x0000559568856781 in copy_file_file (tctx=tctx@entry=0x55956a836730,
ctx=ctx@entry=0x55956a8367c0,
src_path=0x55956a8366e0 «/home/alex/tmp/yii2-basic/basic/.gitignore»,
dst_path=dst_path@entry=0x55956a810e70
«/sftp://pi@firefly/var/www/vhosts/yii2bm/.gitignore») at
../../../src/filemanager/file.c:1808
#6 0x0000559568859338 in panel_operate (source_panel=0x55956a80f760,
operation=operation@entry=OP_COPY, force_single=force_single@entry=0)
at ../../../src/filemanager/file.c:2909
#7 0x0000559568850c3c in copy_cmd () at
../../../src/filemanager/cmd.c:802
#8 0x00005595687f7425 in midnight_execute_cmd (sender=0x55956a81e800,
command=22) at ../../../src/filemanager/midnight.c:1142
#9 0x00005595687dc0f0 in buttonbar_callback (w=0x55956a81e800,
sender=<optimized out>, msg=<optimized out>, parm=<optimized out>,
data=<optimized out>) at ../../../lib/widget/buttonbar.c:171
#10 0x00005595687e047a in send_message (data=0x0, parm=1005,
msg=MSG_HOTKEY, sender=0x0, w=<optimized out>)
at ../../../lib/widget/widget-common.h:210
#11 dlg_try_hotkey (h=0x55956a819a10, h=0x55956a819a10, d_key=1005) at
../../../lib/widget/dialog.c:434
#12 dlg_key_event (d_key=1005, h=0x55956a819a10) at
../../../lib/widget/dialog.c:479
#13 dlg_process_event (h=0x55956a819a10, key=1005, event=<optimized out>)
at ../../../lib/widget/dialog.c:1165
#14 0x00005595687e07d0 in frontend_dlg_run (h=0x55956a819a10) at
../../../lib/widget/dialog.c:541
#15 dlg_run (h=0x55956a819a10) at ../../../lib/widget/dialog.c:1196
#16 0x00005595687f8686 in create_panels_and_run_mc () at
../../../src/filemanager/midnight.c:954
#17 do_nc () at ../../../src/filemanager/midnight.c:1770
#18 0x00005595687d4e9e in main (argc=<optimized out>, argv=<optimized
out>) at ../../src/main.c:407
}}}

(I’m not sure this is the same issue)

Please let me know if I can help in some way (trying patches)


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:6>

Ticket System

unread,

Dec 29, 2016, 6:36:07 PM12/29/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

From looking at the code, it seems that the segfault is a regression
caused by

18f6b850054ab0b12a17f786191d345a1742cb48

and I think that the reason why it segfaults now is is because
`sftpfs_{l,f}stat` functions do not set `st_blksize` stuff.

Here is an untested patch which should remove the segfault if my guess is
correct:

{{{
diff —git a/src/vfs/sftpfs/internal.c b/src/vfs/sftpfs/internal.c
index 5377b66..2301ad5 100644
— a/src/vfs/sftpfs/internal.c
+++ b/src/vfs/sftpfs/internal.c
@@ -30,6 +30,8 @@
#include «lib/global.h»
#include «lib/util.h»

+#include «src/filemanager/ioblksize.h» /* IO_BUFSIZE */
+
#include «internal.h»

/*** global variables
****************************************************************************/
@@ -193,6 +195,9 @@ sftpfs_lstat (const vfs_path_t * vpath, struct stat
*buf, GError ** mcerror)
if ((attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) != 0)
buf->st_mode = attrs.permissions;

+ buf->st_blksize = IO_BUFSIZE;
+ buf->st_blocks = 1 + ((buf->st_size — 1) / buf->st_blksize);
+
return 0;
}

@@ -272,6 +277,9 @@ sftpfs_stat (const vfs_path_t * vpath, struct stat
*buf, GError ** mcerror)
if ((attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) != 0)
buf->st_mode = attrs.permissions;

+ buf->st_blksize = IO_BUFSIZE;
+ buf->st_blocks = 1 + ((buf->st_size — 1) / buf->st_blksize);
+
return 0;
}

}}}

I hope it does compile.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:7>

Ticket System

unread,

Dec 29, 2016, 10:19:14 PM12/29/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

Thanks zaytsev, sorry for the delay didn’t get any mail, it does compile
and it does fix the overwrite segv!

About the error -31, I see «protocol error» 2 and 4, usually start with 2
then alternate with some 4 (2 and 4 should be «err»).

If there’s anything else I can do just let me know (strace? ltrace?
enable/insert some trace in mc/ssl? enable debug on server side?)


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:8>

Ticket System

unread,

Dec 29, 2016, 10:43:48 PM12/29/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

I’ve created a new ticket for the segfault: #3749 .

Re. error -31, sorry, I don’t even use sftp and I don’t know if and when I
will get time to look into it if at all. Too bad and’s patches apparently
aren’t enough to fix the problem :-/


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:9>

Ticket System

unread,

Dec 29, 2016, 10:54:44 PM12/29/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

I’m not very confident with ssl and this is the first time I see mc
sources but, a breakpoint on the error message show bt like this:

{{{
#0 sftpfs_ssherror_to_gliberror
(super_data=super_data@entry=0x55a4a0fdf510, libssh_errno=-31,
mcerror=mcerror@entry=0x7ffc38fdaac8)
at ../../../../src/vfs/sftpfs/internal.c:63
#1 0x000055a4a062ec9e in sftpfs_stat (vpath=<optimized out>,
buf=0x7ffc38fdac90, mcerror=mcerror@entry=0x7ffc38fdaac8)
at ../../../../src/vfs/sftpfs/internal.c:265
#2 0x000055a4a06222bc in sftpfs_cb_stat (vpath=<optimized out>,
buf=<optimized out>) at ../../../../src/vfs/sftpfs/vfs_class.c:277
#3 0x000055a4a05ae4d9 in mc_stat (vpath=vpath@entry=0x55a4a0fb7910,
buf=buf@entry=0x7ffc38fdac90) at ../../../lib/vfs/interface.c:571
#4 0x000055a4a0615b30 in copy_file_file (tctx=tctx@entry=0x55a4a0fdf000,
ctx=ctx@entry=0x55a4a0fdb600,

}}}

If I understand correctly the error is raised within
{{{internal.c:sftpfs_stat()}}} by {{{libssh2_sftp_stat_ex}}}

{{{
res =
libssh2_sftp_stat_ex (super_data->sftp_session,
fixfname, sftpfs_filename_buffer->len,
LIBSSH2_SFTP_STAT, &attrs);
if (res >= 0)
break;

if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
libssh2_sftp_last_error(super_data->sftp_session) ==
LIBSSH2_FX_PERMISSION_DENIED)
return EACCES;

if (res != LIBSSH2_ERROR_EAGAIN)
{
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
return -1;
}
}}}

{{{libssh2_sftp_stat_ex}}} return unexpected/unhandled -2 and -4
({{{res}}} is shown as {{{err}}}), which in my
{{{/usr/include/libssh2.h}}} are:
{{{
#define LIBSSH2_ERROR_BANNER_RECV -2
#define LIBSSH2_ERROR_INVALID_MAC -4
}}}

But I don’t know ssl enough to understand what is wrong, maybe it require
some option to ignore certificates like wget?


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:10>

Ticket System

unread,

Dec 30, 2016, 9:18:55 AM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

I’m not sure you are looking at the right errors. You should put a break
on `sftpfs_ssherror_to_gliberror` and check the values of `res` »and»
`libssh2_sftp_last_error(super_data->sftp_session)`.

You said earlier that you get a message that `res == -31`, so this can’t
be caused by `res == -2 or -4`. To decode protocol errors you need to look
at the `LIBSSH2_FX_*` constants.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:11>

Ticket System

unread,

Dec 30, 2016, 10:44:19 AM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

Sorry, I got the error thing a bit wrong.

{{{libssh2_sftp_stat_ex()}}} is a two line function which call
{{{sftp_stat()}}}, this may exit with error -31 (ftp), 2 and 4 are errors
from the server.

{{{
if (data[0] == SSH_FXP_STATUS) {
int retcode;

retcode = _libssh2_ntohu32(data + 5);
LIBSSH2_FREE(session, data);
if (retcode == LIBSSH2_FX_OK) {
return 0;
} else {
sftp->last_errno = retcode;
return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
«SFTP Protocol Error»);
}
}
}}}

I tried to enable-debug in libssh2 in order to get {{{ssh2_strace()}}}
working but got into more trouble, time to give up yet, maybe I’ll try
later with pbuilder.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:12>

Ticket System

unread,

Dec 30, 2016, 4:23:41 PM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

In as far as `LIBSSH2_FX_NO_SUCH_FILE` is concerned, I think the reason
why this happens is that the copy function tries to stat destination file
to make sure it’s not overwriting anything, but the stat function shows
protocol error, instead of correctly propagating the status.

Untested patch to check this assumption:

{{{
diff —git a/src/vfs/sftpfs/internal.c b/src/vfs/sftpfs/internal.c
index 5377b66..4d388fe 100644
— a/src/vfs/sftpfs/internal.c
+++ b/src/vfs/sftpfs/internal.c
@@ -241,6 +241,10 @@ sftpfs_stat (const vfs_path_t * vpath, struct stat
*buf, GError ** mcerror)

+ if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
+ libssh2_sftp_last_error(super_data->sftp_session) ==
LIBSSH2_FX_NO_SUCH_FILE)
+ return ENOENT;
+

if (res != LIBSSH2_ERROR_EAGAIN)
{
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
}}}

To find out why `LIBSSH2_FX_FAILURE` happens try to find out how to
reliably reproduce it and pay attention to call arguments while debugging.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:13>

Ticket System

unread,

Dec 30, 2016, 6:15:23 PM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

I must have too much changes, the patch applied but in the wrong function.

There are 4 call to {{{libssh2_sftp_stat_ex}}} in {{{internal.c}}} but
you’re right the only one failing is in {{{sftpfs_stat}}}, and with your
patch -31:2 is gone.

Let see if a backtrace for the -31:4 can help.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:14>

Ticket System

unread,

Dec 30, 2016, 6:28:46 PM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

I tried some copy and every backtrace looks almost the same, the failure
seems to be from {{{sftpfs_chmod()}}} (on created directory maybe?)

{{{
#0 sftpfs_ssherror_to_gliberror
(super_data=super_data@entry=0x55765957cb20,
libssh_errno=libssh_errno@entry=-31,
mcerror=mcerror@entry=0x7ffef466c9e8) at
../../../../src/vfs/sftpfs/internal.c:63
#1 0x000055765764b2fd in sftpfs_chmod (vpath=<optimized out>, mode=16877,
mcerror=mcerror@entry=0x7ffef466c9e8)
at ../../../../src/vfs/sftpfs/internal.c:538
#2 0x000055765763e1fc in sftpfs_cb_chmod (vpath=<optimized out>,
mode=<optimized out>) at ../../../../src/vfs/sftpfs/vfs_class.c:518
#3 0x00005576575c95a0 in mc_chmod (vpath=vpath@entry=0x557659555750,
mode=16877) at ../../../lib/vfs/interface.c:252
#4 0x0000557657633479 in copy_dir_dir (tctx=tctx@entry=0x557659561b80,
ctx=ctx@entry=0x55765958f500,
s=0x557659555820 «/home/alex/tmp/yii2-basic/basic/assets»,
d=<optimized out>,
d@entry=0x5576595808e0
«/sftp://pi@firefly/var/www/vhosts/yii2bm/assets»,
toplevel=toplevel@entry=1, move_over=move_over@entry=0, do_delete=0,
parent_dirs=0x55765954a240) at ../../../src/filemanager/file.c:2275
#5 0x000055765763544f in panel_operate (source_panel=0x557659555930,
operation=operation@entry=OP_COPY, force_single=force_single@entry=0)
at ../../../src/filemanager/file.c:2905
#6 0x000055765762ccbc in copy_cmd () at
../../../src/filemanager/cmd.c:802
#7 0x00005576575d34a5 in midnight_execute_cmd (sender=0x557659557410,
command=22) at ../../../src/filemanager/midnight.c:1142
#8 0x00005576575b8170 in buttonbar_callback (w=0x557659557410,

sender=<optimized out>, msg=<optimized out>, parm=<optimized out>,
data=<optimized out>) at ../../../lib/widget/buttonbar.c:171

#9 0x00005576575bc4fa in send_message (data=0x0, parm=1005,

msg=MSG_HOTKEY, sender=0x0, w=<optimized out>)
at ../../../lib/widget/widget-common.h:210

#10 dlg_try_hotkey (h=0x557659552490, h=0x557659552490, d_key=1005) at
../../../lib/widget/dialog.c:434
#11 dlg_key_event (d_key=1005, h=0x557659552490) at
../../../lib/widget/dialog.c:479
#12 dlg_process_event (h=0x557659552490, key=1005, event=<optimized out>)
at ../../../lib/widget/dialog.c:1165
#13 0x00005576575bc850 in frontend_dlg_run (h=0x557659552490) at
../../../lib/widget/dialog.c:541
#14 dlg_run (h=0x557659552490) at ../../../lib/widget/dialog.c:1196
#15 0x00005576575d4706 in create_panels_and_run_mc () at
../../../src/filemanager/midnight.c:954
#16 do_nc () at ../../../src/filemanager/midnight.c:1770
#17 0x00005576575b0f1e in main (argc=<optimized out>, argv=<optimized

out>) at ../../src/main.c:407
}}}


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:15>

Ticket System

unread,

Dec 30, 2016, 7:11:48 PM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

> There are 4 call to libssh2_sftp_stat_ex in internal.c but you’re right

the only one failing is in sftpfs_stat, and with your patch -31:2 is gone.

Yes, this is absolutely disgusting copy & paste programming, how about
properly rewriting all this stuff and covering it with tests? ;-P

> I tried some copy and every backtrace looks almost the same, the failure
seems to be from sftpfs_chmod() (on created directory maybe?)

Probably changing the permissions fails, and this error is not suppressed.
Try (untested) patch:

{{{
diff —git a/src/vfs/sftpfs/internal.c b/src/vfs/sftpfs/internal.c
index 5377b66..2bdec11 100644
— a/src/vfs/sftpfs/internal.c
+++ b/src/vfs/sftpfs/internal.c
@@ -470,7 +470,15 @@ sftpfs_chmod (const vfs_path_t * vpath, mode_t mode,
GError ** mcerror)
sftpfs_filename_buffer->len,
LIBSSH2_SFTP_SETSTAT, &attrs);

— else if (res != LIBSSH2_ERROR_EAGAIN)
+

+ if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
+ libssh2_sftp_last_error(super_data->sftp_session) ==

LIBSSH2_FX_FAILURE)
+ {
+ res = 0; /* need something like ftpfs_ignore_chattr_errors
*/
+ break;
+ }
+

+ if (res != LIBSSH2_ERROR_EAGAIN)
{
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);

return -1;
}}}


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:16>

Ticket System

unread,

Dec 30, 2016, 7:19:53 PM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

Thump up! -31:4 gone too :-D


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:17>

Ticket System

unread,

Dec 30, 2016, 10:10:16 PM12/30/16

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

> I’m not 100% sure, I don’t think is about permissions, the user
connecting via sftp own the target directory with full perms +rwx.

Could be UID / GID mismatch though…

> I can take a look (or wasn’t for me?) but not this year :-D

It was for anyone potentially willing to take a look, including you. The
plan would be:

0. Merge Andrew’s fix for segfault
1. Clean up the copy & paste WTF
2. Rebase patches by @and
3. Clean up my patches
a. As you noted, I only patched functions that caused trouble in your
particular case, others are still problematic, but maybe after eliminating
copy & paste it will be straightforward.
b. Think about a better solution for ignoring chattr errors; maybe
introduce a generic option that will be valid for both ftpfs, sftpfs and
whatever other VFSes? Needs input, e.g. from Andrew.
4. Add unit tests where possible

> There’s some automated test or are you talking about the old fashion?

We have some unit tests implemented with the check framework.

> Thanks a lot for the support! I’m gonna stress sftp a bit in the next
days with some daily work.

I’m glad we finally identified the reason behind these annoying -31
errors. Thanks for your help as well, hopefully someone will manage to
clean up this mess. Happy New Year to you too!


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:18>

Ticket System

unread,

Jan 9, 2017, 1:32:16 AM1/9/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

@zaytsev, challenge accepted :)

I took some time this evening, please see the attached {{{internal.c}}},
I’ve identified some pattern in the copy&paste code an tried to normalize
it, beside the names of added functions/type/macro… let me know what you
think about.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:19>

Ticket System

unread,

Jan 9, 2017, 10:34:46 PM1/9/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

Thank you for your help, however, the attached file is of little use for
us. Please commit your changes as separate patches and attach those to the
ticket. We have a few wiki pages which explain how to work with git:
GitGuideLines / WorkingGuideLines — patches from your local branch can be
produced with `git format-patch` command. Regarding tests, all we have is
in the `tests` directory. See the `README` file there. In as far as
ciphers are concerned, sorry, I’ve got no clue; it would be awesome if
sftp respected the `ssh_config` file, but I don’t know if there are any
facilities in the library you can make use of to that end.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:20>

Ticket System

unread,

Jan 10, 2017, 1:46:25 PM1/10/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

@zaytsev, before any »official» patch I’d like to know if the changes I
did are aligned with your idea of cleanup, and eventually I’d really like
suggestions/help naming the new functions/macro.

attached a patch, but is only for review (last commit of {{{internal.c}}}
was {{{471ea781cacda6ddf324c614e2cf915d59325375}}}).

while there are a lot of changes at once I think they are quite easy to
»read», if you prefer a set of progressive patches I can do that, will
require some more work, just matter of time.

the API of {{{internal.c}}} isn’t changed, I added only static functions
and a couple of macro.

the {{{sftpfs_*}}} functions had almost all the same pattern:

— a »prepare» stage at the top which initialized some variable, I moved
all this stuff to {{{_sftpfs_op_init}}}, {{{struct vfs_s_super *super}}}
is used only there, so has been removed from all other function;

— at the bottom, within the {{{do {…} while(res == EAGAIN)}}}, there was
always the same check, if the error isn’t EAGAIN map the ssh error to glib
and return -1, optionally g_free a temporary path allocated, else call
{{{sftpfs_waitsocket}}} and when it return check again for errors. I moved
all this into {{{_waitsocket_or_error}}}, which eventually call the added
macro {{{mc_return_val_if_error_and_free}}}, they both take into account
the optional (non NULL) pointer to free.

{{{sftpfs_lstat}}}, {{{sftpfs_stat}}} and {{{sftpfs_chmod}}} now simply
call {{{_sftpfs_stat}}}, only {{{stat_type}}} may be different.

only {{{sftpfs_lstat}}} and {{{sftpfs_stat}}} call
{{{_sftpfs_attr_to_buf}}} which I think is self explanatory.

the patch for the for regression which caused segfault is within
{{{_sftpfs_attr_to_buf}}} (below the comment)


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:21>

Ticket System

unread,

Jan 10, 2017, 2:02:20 PM1/10/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by andrew_b):

I think we should use #3749 as base for this.

{{{
if (to_free != NULL)
g_free(to_free);
}}}
@sand, this check is redundant. g_free() makes this check itself.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:22>

Ticket System

unread,

Jan 10, 2017, 4:09:10 PM1/10/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by sand):

@andrew_b thanks, done, I didn’t know.

Also, as mentioned somewhere above, I think all »fix statements» could
be moved outside of the {{{do{…}while(EAGAIN)}}}, {{{fixfname}}} are
declared as {{{const}}}, the {{{libssh2_sftp_*_ex}}} calls shouldn’t touch
its content, or I’m missing something?:
{{{
const char *fixfname;

fixfname = sftpfs_fix_filename…
}}}

If you can confirm the patch is moving in the right direction I’ll look
into testing the changes.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:23>

Ticket System

unread,

Jan 15, 2017, 5:57:50 PM1/15/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by andrew_b):

Branch: 3406_sftp_error_31
Initial changeset:822a0705a70fa44c7324923a5c9947faffb8a35e

Both and’s patches are applied.
sand’s big patch was split by several small patches and applied with some
modification.

The work is not finished. Refactoring of internal.c only was made. Such
refactoring is required for file.c and dir.c.

Currently we still have the -31 error at least in following two cases:
* remove file in sftp server;
* download file from sftp server.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:24>

Ticket System

unread,

Jan 15, 2017, 8:31:24 PM1/15/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link

—————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

Great work, awesome!

Nitpick:

The code in 38344f3fa68b0705d686747cd99348f6420e16b7:

{{{
545 if (sftpfs_is_sftp_error
(super_data->sftp_session, res, LIBSSH2_FX_NO_SUCH_FILE))
546 return ENOENT;
547
548 if (sftpfs_is_sftp_error
(super_data->sftp_session, res, LIBSSH2_FX_FAILURE))
549 {
550 res = 0; /* need something like
ftpfs_ignore_chattr_errors */
551 break;
552 }
}}}

Should have been added in 10fedd5defa2d0c64bc8a1bd6d4f8c2e7a9fccf0 I
think.

Question:

In 1740153a767e31523773046fffb7fe60c275f70f maybe

{{{
439 if (res == -1 || res == EACCES || res == ENOENT)
440 return res;
}}}

should be `if (res < 0)` ? Otherwise these lines will have always to be
kept in sync with what ` sftpfs_internal_stat` can return?


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:25>

Ticket System

unread,

Jan 16, 2017, 1:17:04 PM1/16/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by andrew_b):

Replying to [comment:25 zaytsev]:

> Should have been added in 10fedd5defa2d0c64bc8a1bd6d4f8c2e7a9fccf0 I
think.

> […]

> should be `if (res < 0)` ?

Done.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:26>

Ticket System

unread,

Jan 18, 2017, 10:44:43 AM1/18/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by andrew_b):

Replying to [comment:13 zaytsev]:
> {{{

> + if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
> + libssh2_sftp_last_error(super_data->sftp_session) ==

LIBSSH2_FX_NO_SUCH_FILE)
> + return ENOENT;
> +
> }}}

Well, I have read `man 2 stat` (really, I done it!) and found out that we
can’t use such way because:
* `E*` constants are positive, and if we want return negative values on
error, we must return `-EACCES` `-ENOENT`, etc.
* on error, *stat should `return (-1)` and set `errno`. In our case
`errno` is `vfs_calss::verrno` and E* conatsnts are values for that.

As a result of above, the branch should be reworked almost totally.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:27>

Ticket System

unread,

Jan 24, 2017, 11:27:06 PM1/24/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

Oh, my fault, I’ve just copied what Andreas did, sorry about that :-/ So,
these two commits:

* 7b668721531521b7477c4bb6cf648dbbab63ce81
* 22aa301fbaf152dfde57b24069eddb6b49b4aa22

are completely wrong, and, consequently, everything that follows them has
to be updated :-|

Of course, you are right about E* being positive, but I think that we
shouldn’t rely on that, and the second approach you suggested must be
followed.

Are you planning to work on this anytime in the future? I’m asking because
currently the branch does not compile due to latest commits.

{{{
../../../../src/vfs/sftpfs/file.c: In function
‘sftpfs_file__handle_error’:

../../../../src/vfs/sftpfs/file.c:84:16: error: ‘EACCES’ undeclared (first
use in this function)

../../../../src/vfs/sftpfs/file.c:84:16: note: each undeclared identifier
is reported only once for each function it appears in

../../../../src/vfs/sftpfs/file.c:87:16: error: ‘ENOENT’ undeclared (first
use in this function)
}}}


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:28>

Ticket System

unread,

Dec 3, 2017, 12:03:23 PM12/3/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
—————————+———————————————

Comment (by andrew_b):

> REMOVE REMOTE FILE: «-31: Failed opening remote file»
The root of the this problem is the passing the file to the opendir()
callback:

panel_operate -> panel_operate_init_totals -> compute_dir_size ->
do_compute_dir_size -> mc_opendir -> sftpfs_opendir ->
libssh2_sftp_open_ex (…, fixfname, …, LIBSSH2_SFTP_OPENDIR);

Here the «fixfname» is the file not a directory, but we try use it as
directory.

Branch: 3406_sftp_error_31
Initial changeset:8d2bf20aa44912565dffe41deaa433467ad37668

Please review.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:29>

Ticket System

unread,

Dec 3, 2017, 12:04:12 PM12/3/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new

Priority: minor | Milestone: 4.8.21

Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:

Branch state: on review | Votes for changeset:
—————————+———————————————
Changes (by andrew_b):

* branch_state: no branch => on review
* milestone: Future Releases => 4.8.21


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:30>

Ticket System

unread,

Dec 3, 2017, 1:18:27 PM12/3/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
—————————+———————————————

Comment (by zaytsev):

The refactoring looks awesome, it’s exactly what I had in mind plus much
more, however, I can’t currently test this code. Could one of the long
term error -31 sufferers please check this branch?


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:31>

Ticket System

unread,

Dec 19, 2017, 4:12:28 PM12/19/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
—————————+———————————————

Comment (by aloy):

I’ve just tested this branch and it seems to fix the -31 error for me.
Might need some more testing but it looks like the error is gone for me.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:32>

Ticket System

unread,

Dec 21, 2017, 11:33:19 AM12/21/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
—————————+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
—————————+———————————————

Comment (by andrew_b):

Thanks for feedback.
I’m going to merge this branch at the weekend.


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:33>

Ticket System

unread,

Dec 28, 2017, 10:25:05 AM12/28/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————-+———————————————
Reporter: pingu | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:

Branch state: approved | Votes for changeset: andrew_b
————————-+———————————————
Changes (by andrew_b):

* votes: => andrew_b
* branch_state: on review => approved


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:34>

Ticket System

unread,

Dec 28, 2017, 10:26:10 AM12/28/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: closed

Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master

Resolution: fixed | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
————————+———————————————
Changes (by andrew_b):

* status: new => closed
* votes: andrew_b => committed-master
* resolution: => fixed
* branch_state: approved => merged

Comment:

Merged to master: 79b6a772fe3677f5f8752f317a689570db871359[].
{{{
git log —pretty=oneline 218dcea..79b6a77
}}}


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:35>

Ticket System

unread,

Dec 28, 2017, 10:28:12 AM12/28/17

to junk…@inbox.lv, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————+———————————————
Reporter: pingu | Owner:

Type: defect | Status: reopened

Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master

Resolution: | Keywords: -31 sftp error chiper

Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
————————+———————————————
Changes (by andrew_b):

* status: closed => reopened
* resolution: fixed =>


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:36>

Ticket System

unread,

Dec 28, 2017, 10:28:51 AM12/28/17

to junk…@inbox.lv, andrew….@gmail.com, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————+———————————————

Reporter: pingu | Owner: andrew_b
Type: defect | Status: accepted

Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master
Resolution: | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
————————+———————————————
Changes (by andrew_b):

* owner: => andrew_b
* status: reopened => accepted


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:37>

Ticket System

unread,

Dec 28, 2017, 10:29:30 AM12/28/17

to junk…@inbox.lv, andrew….@gmail.com, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————+———————————————
Reporter: pingu | Owner: andrew_b

Type: defect | Status: testing

Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master

Resolution: fixed | Keywords: -31 sftp error chiper

Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
————————+———————————————
Changes (by andrew_b):

* status: accepted => testing
* resolution: => fixed


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:38>

Ticket System

unread,

Dec 28, 2017, 10:30:09 AM12/28/17

to junk…@inbox.lv, andrew….@gmail.com, mc-…@googlegroups.com, gra…@nerve.org.za

#3406: -31: SFTP Protocol Error when transferring file via SFTP Link
————————+———————————————
Reporter: pingu | Owner: andrew_b

Type: defect | Status: closed

Priority: minor | Milestone: 4.8.21
Component: mc-vfs | Version: master
Resolution: fixed | Keywords: -31 sftp error chiper
Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
————————+———————————————
Changes (by andrew_b):

* status: testing => closed


Ticket URL: <http://www.midnight-commander.org/ticket/3406#comment:39>

After upgrading to Mint 18 (MATE Desktop) when I use sftp file transfer with mc, I get a «-31: SFTP Protocol error» when transferring a file.
I suspect it has something to do with permissions or attribute changes — I can acknowledge the error and the file transfer will start and the file is transmitted intact with no obvious changes in attributes.

This happens for every file, regardless of permissions or permissions of the user on the destination file system.

I have beat my head bloody over this, comparing system transferring the same file from Mint 17 and Mint 18 systems to the same target Ubuntu 14.x LTS server, using the same user id. Google isn’t giving me anything either.

Hopefully someone still uses mc and knows what changed in 18 that triggers this behavior… And even better has a simple fix.

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

Debian Bug report logs —
#866019
mc: Crash On SFTP Upload

version graph

Reported by: Edy Corak <edy@loenshotel.de>

Date: Mon, 26 Jun 2017 16:57:01 UTC

Severity: normal

Found in version mc/3:4.8.18-1

Fixed in version mc/3:4.8.19-1

Done: Denis Briand <debian@denis-briand.fr>

Bug is archived. No further changes may be made.

Toggle useless messages


Report forwarded
to debian-bugs-dist@lists.debian.org, edy@loenshotel.de, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>:
Bug#866019; Package mc.
(Mon, 26 Jun 2017 16:57:03 GMT) (full text, mbox, link).


Acknowledgement sent
to Edy Corak <edy@loenshotel.de>:
New Bug report received and forwarded. Copy sent to edy@loenshotel.de, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>.
(Mon, 26 Jun 2017 16:57:03 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

Package: mc
Version: 3:4.8.18-1
Severity: normal

Dear Maintainer,

when I try to upload a file with SFTP then MC crashes with following error:

mc:7228 GLib-ERROR ** /build/.../glib/gmem.c:100 failed to allocate ... bytes

Trace/Breakpoint

Jun 26 18:33:54 - kernel: [10139.526827] do_trap: 93 callbacks suppressed
Jun 26 18:33:54 - kernel: [10139.526834] traps: mc[7228] trap int3
ip:7f96dfacd261 sp:7ffec9304350 error:0
Jun 26 18:33:54 - kernel: [10139.526842]  in
libglib-2.0.so.0.5000.3[7f96dfa7d000+112000]

Download is fine.

And there are some SFTP Protocol Error -31

Thanks

Kind regards

Edy Corak



-- System Information:
Debian Release: 9.0
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), LANGUAGE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mc depends on:
ii  e2fslibs      1.43.4-2
ii  libc6         2.24-11+deb9u1
ii  libglib2.0-0  2.50.3-2
ii  libgpm2       1.20.4-6.2+b1
ii  libslang2     2.3.1-5
ii  libssh2-1     1.7.0-1
ii  mc-data       3:4.8.18-1

Versions of packages mc recommends:
ii  mime-support  3.60
ii  perl          5.24.1-3
ii  unzip         6.0-21

Versions of packages mc suggests:
ii  arj                               3.10.22-15
ii  bzip2                             1.0.6-8.1
pn  dbview                            <none>
pn  djvulibre-bin                     <none>
ii  evince [pdf-viewer]               3.22.1-3
ii  file                              1:5.30-1
ii  genisoimage                       9:1.1.11-3+b2
pn  gv                                <none>
ii  imagemagick                       8:6.9.7.4+dfsg-11
ii  imagemagick-6.q16 [imagemagick]   8:6.9.7.4+dfsg-11
pn  libaspell-dev                     <none>
pn  odt2txt                           <none>
ii  poppler-utils                     0.48.0-2
ii  python                            2.7.13-2
pn  python-boto                       <none>
ii  python-tz                         2016.7-0.3
ii  texlive-binaries                  2016.20160513.41080.dfsg-2
ii  w3m                               0.5.3-34
ii  zathura-pdf-poppler [pdf-viewer]  0.2.7-1
ii  zip                               3.0-11+b1

-- no debconf information



Information forwarded
to debian-bugs-dist@lists.debian.org, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>:
Bug#866019; Package mc.
(Mon, 26 Jun 2017 18:48:05 GMT) (full text, mbox, link).


Acknowledgement sent
to "Yury V. Zaytsev" <yury@shurup.com>:
Extra info received and forwarded to list. Copy sent to Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>.
(Mon, 26 Jun 2017 18:48:05 GMT) (full text, mbox, link).


Message #10 received at 866019@bugs.debian.org (full text, mbox, reply):

On Mon, 26 Jun 2017, Edy Corak wrote:

> Package: mc
> Version: 3:4.8.18-1
> Severity: normal

Check this out, I suppose it's fixed in 4.8.19:

http://midnight-commander.org/ticket/3749

-- 
Sincerely yours,
Yury V. Zaytsev



Information forwarded
to debian-bugs-dist@lists.debian.org, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>:
Bug#866019; Package mc.
(Mon, 26 Jun 2017 19:09:03 GMT) (full text, mbox, link).


Acknowledgement sent
to Loens Hotel <info@loenshotel.de>:
Extra info received and forwarded to list. Copy sent to Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>.
(Mon, 26 Jun 2017 19:09:03 GMT) (full text, mbox, link).


Message #15 received at 866019@bugs.debian.org (full text, mbox, reply):

On Mo 26 Jun 2017 20:38:19 CEST
"Yury V. Zaytsev" <yury@shurup.com> wrote:

>On Mon, 26 Jun 2017, Edy Corak wrote:
>
>> Package: mc
>> Version: 3:4.8.18-1
>> Severity: normal
>
>Check this out, I suppose it's fixed in 4.8.19:
>
>http://midnight-commander.org/ticket/3749
>
>-- 
>Sincerely yours,
>Yury V. Zaytsev


I will try it.

Thank you very much

Kind regards

Edy Corak



Information forwarded
to debian-bugs-dist@lists.debian.org, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>:
Bug#866019; Package mc.
(Tue, 27 Jun 2017 14:45:02 GMT) (full text, mbox, link).


Acknowledgement sent
to Edy Corak <edy@loenshotel.de>:
Extra info received and forwarded to list. Copy sent to Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>.
(Tue, 27 Jun 2017 14:45:02 GMT) (full text, mbox, link).


Message #20 received at 866019@bugs.debian.org (full text, mbox, reply):

Today I have tried mc 4.8.19 from source

Default compiler flags

GNU Midnight Commander 4.8.19
Built with GLib 2.50.3
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t:
64;

As Yury has already said, the problem has been fixed in version 4.8.19

I think that after updating to version 4.8.19, the bug can be closed.

The only problem that has not been fixed yet is SFTP Protocol Error (-31)

Link:

https://midnight-commander.org/ticket/3406

-- 

Kind regards

Edy Corak
edy@loenshotel.de



Information forwarded
to debian-bugs-dist@lists.debian.org, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>:
Bug#866019; Package mc.
(Tue, 27 Jun 2017 15:09:02 GMT) (full text, mbox, link).


Acknowledgement sent
to Denis Briand <debian@denis-briand.fr>:
Extra info received and forwarded to list. Copy sent to Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>.
(Tue, 27 Jun 2017 15:09:02 GMT) (full text, mbox, link).


Message #25 received at 866019@bugs.debian.org (full text, mbox, reply):

[Message part 1 (text/plain, inline)]
Hello,
Thank you very much, I will prepare this new version as soon as possible.

Best regards

Denis Briand


Le 27/06/2017 à 16:32, Edy Corak a écrit :
> Today I have tried mc 4.8.19 from source
> 
> Default compiler flags
> 
> GNU Midnight Commander 4.8.19
> Built with GLib 2.50.3
> Using the S-Lang library with terminfo database
> With builtin Editor
> With subshell support as default
> With support for background operations
> With mouse support on xterm and Linux console
> With support for X11 events
> With internationalization support
> With multiple codepages support
> Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
> Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t:
> 64;
> 
> As Yury has already said, the problem has been fixed in version 4.8.19
> 
> I think that after updating to version 4.8.19, the bug can be closed.
> 
> The only problem that has not been fixed yet is SFTP Protocol Error (-31)
> 
> Link:
> 
> https://midnight-commander.org/ticket/3406
> 

[signature.asc (application/pgp-signature, attachment)]

Information forwarded
to debian-bugs-dist@lists.debian.org, Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>:
Bug#866019; Package mc.
(Tue, 27 Jun 2017 15:18:02 GMT) (full text, mbox, link).


Acknowledgement sent
to "Yury V. Zaytsev" <yury@shurup.com>:
Extra info received and forwarded to list. Copy sent to Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>.
(Tue, 27 Jun 2017 15:18:02 GMT) (full text, mbox, link).


Message #30 received at 866019@bugs.debian.org (full text, mbox, reply):

On Tue, 27 Jun 2017, Edy Corak wrote:

> Today I have tried mc 4.8.19 from source
>
> As Yury has already said, the problem has been fixed in version 4.8.19
>
> I think that after updating to version 4.8.19, the bug can be closed.

Good to know!

> The only problem that has not been fixed yet is SFTP Protocol Error (-31)
>
> Link:
>
> https://midnight-commander.org/ticket/3406

Yes, this is a long-standing problem, unfortunately, no easy solution 
exists, and my hacks attempting to fix it were wrong; I hope someone finds 
time to work on this branch in the future and implements the right fix.

-- 
Sincerely yours,
Yury V. Zaytsev



Added tag(s) pending.
Request was from Denis Briand <debian@denis-briand.fr>
to control@bugs.debian.org.
(Wed, 12 Jul 2017 19:06:07 GMT) (full text, mbox, link).


Reply sent
to Denis Briand <debian@denis-briand.fr>:
You have taken responsibility.
(Thu, 24 Aug 2017 13:39:08 GMT) (full text, mbox, link).


Notification sent
to Edy Corak <edy@loenshotel.de>:
Bug acknowledged by developer.
(Thu, 24 Aug 2017 13:39:09 GMT) (full text, mbox, link).


Message #37 received at 866019-close@bugs.debian.org (full text, mbox, reply):

Source: mc
Source-Version: 3:4.8.19-1

We believe that the bug you reported is fixed in the latest version of
mc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 866019@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Denis Briand <debian@denis-briand.fr> (supplier of updated mc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 04 Aug 2017 23:03:29 +0200
Source: mc
Binary: mc mc-data
Architecture: source
Version: 3:4.8.19-1
Distribution: unstable
Urgency: low
Maintainer: Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org>
Changed-By: Denis Briand <debian@denis-briand.fr>
Description:
 mc         - Midnight Commander - a powerful file manager
 mc-data    - Midnight Commander - a powerful file manager -- data files
Closes: 808303 825974 863984 866019 867758
Changes:
 mc (3:4.8.19-1) unstable; urgency=low
 .
   * new upstream release
     + Closes: #866019
     + Closes: #808303
     + Closes: #825974
 .
   * remove merged patches:
     + uzip_528239.patch
 .
   * update patches: (use gboolean instead of int)
     + disable_internal_editor.patch
     + mcedit_full_path.patch
     + mcedit_auto_indent.patch
     + mcedit_group_undo.patch
 .
   * Remove Patrick Winnertz <winnie@debian.org> from
     the Uploaders List (MIA). Thank you Patrick for
     all your work on mc package.
     It was a pleasure to work with you.
     (Closes: #867758).
 .
   * Fix some spelling errors in manpage.
   * Bump standard version to 4.0.0
   * Use secure URI for upstream web site.
   * fix error message when you gzip or bzip files from user menu.
     Thanks to Yuriy M. Kaminskiy (Closes:  #863984).
Checksums-Sha1:
 e7ec9851617152d61b0b5214ae2e0edcfec92fd1 2249 mc_4.8.19-1.dsc
 850747ae43a5c81f1dd0d906dfa9e149eb19748a 2521808 mc_4.8.19.orig.tar.xz
 7353c84214458506c460ce3b3000733cd2a65b6c 47760 mc_4.8.19-1.debian.tar.xz
 6a580cda4cdc94cf4070738bc15daae8cbe2d609 14426 mc_4.8.19-1_source.buildinfo
Checksums-Sha256:
 c3c811584f551fbd2500769824e42fe88cec68d5b9a6d5a5295813422f4099ed 2249 mc_4.8.19-1.dsc
 eb9e56bbb5b2893601d100d0e0293983049b302c5ab61bfb544ad0ee2cc1f2df 2521808 mc_4.8.19.orig.tar.xz
 61eb07328937bd65202111887a59ebc13125fe8702463987691de569e8aaac3e 47760 mc_4.8.19-1.debian.tar.xz
 d62375fc86105a4216e45ff5e9bfbb29f79e376147bee748458c391a90930d44 14426 mc_4.8.19-1_source.buildinfo
Files:
 89da33a773e69408710821be064df380 2249 utils optional mc_4.8.19-1.dsc
 57209d138c0adcb9ea01dfe6bbb4cb87 2521808 utils optional mc_4.8.19.orig.tar.xz
 6a2ed775091bfaad9b1d7ce5f34128a0 47760 utils optional mc_4.8.19-1.debian.tar.xz
 d505d2000dd652e913d72b155f366909 14426 utils optional mc_4.8.19-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJCBAEBCAAsFiEE8fAHMgoDVUHwpmPKV4oElNHGRtEFAlmez7QOHHRpbGxlYUBy
a2kuZGUACgkQV4oElNHGRtF2UQ//Xfc4+os9SOBzDw0VHgPjpB1Z96n41qrjUnkP
oEkIEm/53syMZRC4DYZDzvVh0HWcM5SirtJ+UiIhhdoo2JskrPBPT8vRzOIvC8gk
qaDhptTZBeyyK+wlP9De2XLb023kUsx9H+Au4frR1LZ7TVpdI9JK5+l+ks73W9uz
CJtX9VJNV2GdergWp3FRXGcaSauKU/OkocVz1/C7fUftXBAppmPU1vTyYGe7c13d
kNFgqXKJgoUIipEvJojDfuZGUEzSwf9IaOUMvCBmFi7EMTYqH9jg7hckXAm6mJje
dQCVww9UcuNCdGpm1ej3eZAnexXGLueim241692GqUOusXuU75y28CnjziahMO+P
GMNNE8Id2W4gdw3ElU/a/NcX8mVUz8uyv90mb7fwoORtwsiow9N8meyfgIeTGD7o
rt+SMWmnC7QMoo/fzBEqaGmhCFBKtn78gigZrAXDBBdNrm1fw7D5onRJETV3jp4L
rvhbdR9cBqOjvhx8HTOxM5Oxf3gZhY40Medq45pURERs+GEXbwotM70KJ8CVy06M
K1jglftUtqusxiFNwlEydl1ZRT/qaO+upcNgjbW6K1TELkBK+xZaKydWtRg8g47u
ZJ6BCxVkv9mdvANfwbWMMTKpZrj2WpBVkenx/WOkqGXybs7QF5xRvGdb+GJZxxxz
mFopeME=
=w4NH
-----END PGP SIGNATURE-----




Bug archived.
Request was from Debbugs Internal Request <owner@bugs.debian.org>
to internal_control@bugs.debian.org.
(Sun, 01 Oct 2017 07:26:15 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Mon Apr 10 08:41:07 2023;
Machine Name:
buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.

Bug 1211902
Every time when I tried copy file from sftp I see strange error «-31: Failed opening remote file»

Summary:

Every time when I tried copy file from sftp I see strange error «-31: Failed …

Keywords:
Status: CLOSED
EOL

Alias:

None

Product:

Fedora

Classification:

Fedora

Component:

mc

Sub Component:

Version:

24

Hardware:

Unspecified

OS:

Unspecified

Priority:

unspecified
Severity: unspecified

Target Milestone:


Assignee:

Jindrich Novy

QA Contact:

Fedora Extras Quality Assurance

Docs Contact:


URL:


Whiteboard:

Depends On:


Blocks:


TreeView+

depends on /

blocked

Reported: 2015-04-15 08:03 UTC by Mikhail
Modified: 2017-08-08 11:56 UTC
(History)

CC List:

6
users

(show)

Fixed In Version:

Doc Type:

Bug Fix

Doc Text:

Clone Of:

Environment:

Last Closed:

2017-08-08 11:56:49 UTC

Type:

Bug

Dependent Products:


Attachments (Terms of Use)


Аватара пользователя

Zyxmon

Администратор
Сообщения: 1910
Зарегистрирован: 09 авг 2015, 15:33

Yrzorg писал(а):Источник цитаты я поставил Entware3x-alt, но использую прошивочный openssh

Как у Вас всё запущенно! Ведь при этом установлен и openssh из entware и он, скорее всего, в PATH раньше, чем прошивочный. Сходу не представляю, как разбираться с возникшем бардаком.


Yrzorg

Сообщения: 82
Зарегистрирован: 05 окт 2015, 13:23

Сообщение Yrzorg » 16 май 2017, 23:55

Честно говоря не вижу причин для паники, openssh из entware хоть и установлен, но не запущен и не используется, т.к. его использование влечёт за собой определённые проблемы. Мне больше любопытно, почему mc ищет конфиг в другом месте, считая при этом /home/admin домашней директорией

Код: Выделить всё

[admin@KN-ULTRA2 : /opt/home/admin]#>mc -F
Home directory: /home/admin
Profile root directory: /home/admin

[System data]
    Config directory: /opt/etc/mc/
    Data directory:   /opt/share/mc/
    File extension handlers: /opt/lib/mc/ext.d/
    VFS plugins and scripts: /opt/lib/mc/
        extfs.d:        /opt/lib/mc/extfs.d/
        fish:           /opt/lib/mc/fish/

[User data]
    Config directory: /opt/etc/mc/
    Data directory:   /opt/etc/mc/
        skins:          /opt/etc/mc/skins/
        extfs.d:        /opt/etc/mc/extfs.d/
        fish:           /opt/etc/mc/fish/
        mcedit macros:  /opt/etc/mc/mc.macros
        mcedit external macros: /opt/etc/mc/mcedit/macros.d/macro.*
    Cache directory:  /opt/etc/mc/

Keenetic Ultra II+Entware
NDMS 3.7


Аватара пользователя

Zyxmon

Администратор
Сообщения: 1910
Зарегистрирован: 09 авг 2015, 15:33

Сообщение Zyxmon » 17 май 2017, 00:12

Yrzorg писал(а):Источник цитаты его использование влечёт за собой определённые проблемы.

Какие проблемы? Думаю как раз тут решение проблемы.

Yrzorg писал(а):Источник цитаты почему mc ищет конфиг в другом месте, считая при этом /home/admin домашней директорией

Домашняя директория задается в /etc/passwd (стандартная установка) или в /opt/etc/passwd (альтернативная) или переменной HOME. Все конфиги самого mc на месте. Что не так?


kaztost

Сообщения: 223
Зарегистрирован: 17 июл 2017, 00:29

Сообщение kaztost » 18 июл 2017, 18:46

А что, я один на Entware сталкиваюсь с проблемой «Failed opening remote file (-31)» при копировании с sftp-сервера по SFTP link?

screen.jpg
screen.jpg (52.18 КБ) 3861 просмотр

Если нажать на Enter, то файл будет скопирован, и ошибка возникнет на следующем файле. Это похоже тикет3406. Я уже давно решил, что SFTP link в энтварных mc безнадежно сломан, и, поэтому, пользовался беспроблемным shell link. А тут смотрю, что-то обсуждается еще. Может и решение есть, которое я не знаю?


Yrzorg

Сообщения: 82
Зарегистрирован: 05 окт 2015, 13:23

Сообщение Yrzorg » 20 июл 2017, 00:51

SFTP link в энтварных mc безнадежно сломан

у меня он поломался окончательно, теперь всё время требует некий пароль

2017-07-19_234622.jpg
2017-07-19_234622.jpg (14.74 КБ) 3843 просмотра

Keenetic Ultra II+Entware
NDMS 3.7


kaztost

Сообщения: 223
Зарегистрирован: 17 июл 2017, 00:29

Сообщение kaztost » 20 июл 2017, 02:11

Yrzorg писал(а):Источник цитаты теперь всё время требует некий пароль

Что-то такое у меня было ранее на старых сборках. Потом как-то само починилось и стало ключи принимать. Но ошибки при копировании остались. Поэтому пользую Shell link. Хоть он и не умеет ходить по симлинкам (а для андроида это насущно), но зато работает без ошибок.


Yrzorg

Сообщения: 82
Зарегистрирован: 05 окт 2015, 13:23

Сообщение Yrzorg » 22 дек 2017, 23:00

Yrzorg писал(а):Источник цитаты у меня он поломался окончательно, теперь всё время требует некий пароль

заборол таки эту проблему, всё оказалось просто:
из-за путаницы (и моей невнимательности) с HOME — mc не там искал ключи
почему то mc упорно хочет видеть их в /opt/root/.ssh, но в тоже время признаёт, что домашняя директория в /home/admin

Код: Выделить всё

[admin@KN-ULTRA2 : /opt/home/admin]#>mc -F
Home directory: /home/admin
Profile root directory: /home/admin

терзают смутные сомнения, что это у него где-то жёстко зашито

Keenetic Ultra II+Entware
NDMS 3.7


kaztost

Сообщения: 223
Зарегистрирован: 17 июл 2017, 00:29

Сообщение kaztost » 23 дек 2017, 11:55

По идее в vfs/sftpfs/config_parser.c должно стоять

#ifndef SFTPFS_SSH_CONFIG
#define SFTPFS_SSH_CONFIG «~/.ssh/config»
#endif

Возможно проблема возникает при сборке mc не здесь, а где-то выше, где криво определяется SFTPFS_SSH_CONFIG.


Аватара пользователя

Zyxmon

Администратор
Сообщения: 1910
Зарегистрирован: 09 авг 2015, 15:33

Сообщение Zyxmon » 23 дек 2017, 12:55

Проблема скорее в том, что в прошивке Падавана суперпользователь не root, а admin. Последнее легко решается альтернативной установкой Entware-3x (для Android другой и быть не может).


Кто сейчас на конференции

Всего 1 посетитель :: 0 зарегистрированных, 0 скрытых и 1 гость (основано на активности пользователей за последние 5 минут)
Больше всего посетителей (162) здесь было 16 ноя 2019, 18:33

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 1 гость

Время на прочтение
3 мин

Количество просмотров 19K

Это перевод заметки о моем тестировании поддержки SFTP в midnight commander. Оригинал на английском опубликован в моем блоге.

Продолжаю следить за разработкой поддержки SFTP в midnight commander, на этой неделе общался с автором — в поддержке sftp появилась авторизация через ssh-agent. На радостях я быстренько накидал пакет и затестил его.

И первое разочарование — midnight не может авторизоваться через агента. Я попробовал предыдущие схемы авторизации, которые работали в предыдущей версии:

  • по паролю — работает без проблем;
  • по ключу — работает, но только для ключей, которые не защищены паролем (судя по всему это ограничение библиотеки).

Испробовав разные варианты с агентом — поинтересовался у автора, как работает у него. Оказалось, что без проблем. Позже нашел пример авторизации через ssh-agent на сайте разработчиков libssh2 и попробовал его скомпилировать

$ gcc -o agent_auth -Wall -I/usr/include -I. -lssh2 ssh2_agent.c
ssh2_agent.c: In function ‘main’:
ssh2_agent.c:99: warning: implicit declaration of function ‘libssh2_session_handshake’
/home/andrey/tmp/ccmczn2V.o: In function `main':
ssh2_agent.c:(.text+0x1a8): undefined reference to `libssh2_session_handshake'
collect2: ld returned 1 exit status

Сообщение об ошибке навело на мысль, что пример рассчитан на версию, которая новее той, что находится в репозитарии debian squeeze. Попробовал собрать текущую версию libssh2 (1.3.0) и пересобрать пример с уже новой библиотекой.

$ gcc -o agent_auth -Wall -I$PWD/libssh2/include -I. -L$PWD/libssh2/lib -lssh2 ssh2_agent.c

После этого пример собрался без ошибок, но работать отказывался, ссылаясь на невозможность подключения.

$ LD_LIBRARY_PATH=$PWD/libssh2/lib ./agent-auth localhost andrey
failed to connect!
zsh: segmentation fault  ./agent_auth localhost andrey

Запуск под strace показал, что во-первых соединение идет на 255.255.255.255 вместо 127.0.0.1, а во вторых код примера пытается освобождать ресурсы без проверки их использования. Отсюда и segfault при выходе.

munmap(0xb7813000, 4096)                = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("255.255.255.255")}, 16) = -1 ENETUNREACH (Network is unreachable)
write(2, "failed to connect!n", 19failed to connect!
)    = 19
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
zsh: segmentation fault  strace -f ./agent_auth localhost username

Добавил проверку перед освобождением ресурсов

--- ssh2_agent.c.orig   2011-12-08 23:53:41.000000000 +0300
+++ ssh2_agent.c    2011-12-09 00:02:10.000000000 +0300
@@ -231,10 +231,12 @@ int main(int argc, char *argv[])
      */

   shutdown:
-
-    libssh2_agent_disconnect(agent);

-    libssh2_agent_free(agent);
+   if (agent) {
+       libssh2_agent_disconnect(agent);
+
+       libssh2_agent_free(agent);
+   }


     if(session) {

После чего пересобрал и запустил.

$ gcc -o agent_auth -Wall -I$PWD/libssh2/include -I. -L$PWD/libssh2/lib -lssh2 ssh2_agent.c
$ LD_LIBRARY_PATH=$PWD/libssh2/lib ./agent_auth localhost andrey
failed to connect!

Уже лучше — segfault на выходе исчез, но ругается на невозможность подключиться. Снова смотрю в код. Для преобразования хоста в формат понятный функции connect() используется inet_addr()

    if (argc > 1) {
        hostaddr = inet_addr(argv[1]);
    } else {
        hostaddr = htonl(0x7F000001);
    }

Смотрю в man 3 inet_addr и вижу, что функция преобразует символьную запись ip адреса в его бинарное представление. Bingo! Я ведь передаю имя хоста как localhost. Заменив localhost на 127.0.0.1 получаю работающий пример.

$ LD_LIBRARY_PATH=$PWD/libssh2/lib ./agent_auth 127.0.0.1 andrey
Fingerprint: FA F3 92 9E C4 AE 14 B4 FC BE ED 2A E8 33 0C 1E 34 09 9F B3 
Authentication methods: publickey,password
	Authentication with username andrey and public key /home/andrey/.ssh/id_rsa failed!
	Authentication with username andrey and public key /home/andrey/.ssh/id_dsa succeeded!
all done!

Теперь дело за малым — собрать версию libssh2 (1.3.0) для squeeze и пересобрать midnight с новой версией библиотеки. Готовую сборку можно забрать тут

I am hitting a Protocol error while trying to SFTP from one server to another. I have tried to search up Google to no avail. May i know if anyone can help me with this.

rel@kingfisher:/kingfisher_bft/hme/rel>  sftp relst@111.32.171.172
Need basic cursor movement capability, using vt100
error: Could not open connection to `rel@111.32.171.172': Protocol error

asked Oct 16, 2012 at 3:40

OCB's user avatar

The machine you are using to sftp into the remote machine seems to be missing the ncurses libraries. Install them with apt-get install libncurses5 or download them from your distributions web-page.

[ From: http://ftp.vim.org/security/ssh/README.SSH2 ]

If your sftp2 complains something like this: «Need basic
cursor movement capability, using vt100», then no library
containing tgetent() function was found when you ran
./configure . If you have a Linux system, then that is
probably because you don’t have either termcap-devel or
ncurses-devel packages installed. If you want to get rid of
the message, and/or to use some more exotic terminals
capabilities, you should install either package. (A good
place to look for those is your distribution’s web-page.)

answered Oct 16, 2012 at 7:59

Stuffy's user avatar

StuffyStuffy

1771 gold badge1 silver badge9 bronze badges

2

SFTP is a subsystem of the SSH protocol, and has its own protocol. Actually there are 7 SFTP protocol versions (from 0 to 6) and 2 SSH protocol versions (SSH-1 and SSH-2).

What I see here above looks like the client and the server are unable to negotiate a common protocol, and this could be due to several reasons:

  • the client tries a SSH-2 connection to a server that only supports SSH-1
  • the client tries a SFTP protocol version that is not supported by the server
  • unlikely: the client tries to negotiate encryption/MAC algorithms that are unsupported by the server
  • In any case, I would research for the root cause of this issue on the server side.

    answered Oct 15, 2014 at 16:41

    FjodrSo's user avatar

    FjodrSoFjodrSo

    1311 silver badge1 bronze badge

    Аватара пользователя

    Zyxmon

    Администратор
    Сообщения: 1912
    Зарегистрирован: 09 авг 2015, 15:33

    Yrzorg писал(а):Источник цитаты я поставил Entware3x-alt, но использую прошивочный openssh

    Как у Вас всё запущенно! Ведь при этом установлен и openssh из entware и он, скорее всего, в PATH раньше, чем прошивочный. Сходу не представляю, как разбираться с возникшем бардаком.


    Yrzorg

    Сообщения: 82
    Зарегистрирован: 05 окт 2015, 13:23

    Сообщение Yrzorg » 16 май 2017, 23:55

    Честно говоря не вижу причин для паники, openssh из entware хоть и установлен, но не запущен и не используется, т.к. его использование влечёт за собой определённые проблемы. Мне больше любопытно, почему mc ищет конфиг в другом месте, считая при этом /home/admin домашней директорией


     

    Код: Выделить всё

    [admin@KN-ULTRA2 : /opt/home/admin]#>mc -F
    Home directory: /home/admin
    Profile root directory: /home/admin
    
    [System data]
        Config directory: /opt/etc/mc/
        Data directory:   /opt/share/mc/
        File extension handlers: /opt/lib/mc/ext.d/
        VFS plugins and scripts: /opt/lib/mc/
            extfs.d:        /opt/lib/mc/extfs.d/
            fish:           /opt/lib/mc/fish/
    
    [User data]
        Config directory: /opt/etc/mc/
        Data directory:   /opt/etc/mc/
            skins:          /opt/etc/mc/skins/
            extfs.d:        /opt/etc/mc/extfs.d/
            fish:           /opt/etc/mc/fish/
            mcedit macros:  /opt/etc/mc/mc.macros
            mcedit external macros: /opt/etc/mc/mcedit/macros.d/macro.*
        Cache directory:  /opt/etc/mc/
    

    Keenetic Ultra II+Entware
    NDMS 3.7


    Аватара пользователя

    Zyxmon

    Администратор
    Сообщения: 1912
    Зарегистрирован: 09 авг 2015, 15:33

    Сообщение Zyxmon » 17 май 2017, 00:12

    Yrzorg писал(а):Источник цитаты его использование влечёт за собой определённые проблемы.

    Какие проблемы? Думаю как раз тут решение проблемы.

    Yrzorg писал(а):Источник цитаты почему mc ищет конфиг в другом месте, считая при этом /home/admin домашней директорией

    Домашняя директория задается в /etc/passwd (стандартная установка) или в /opt/etc/passwd (альтернативная) или переменной HOME. Все конфиги самого mc на месте. Что не так?


    kaztost

    Сообщения: 223
    Зарегистрирован: 17 июл 2017, 00:29

    Сообщение kaztost » 18 июл 2017, 18:46

    А что, я один на Entware сталкиваюсь с проблемой «Failed opening remote file (-31)» при копировании с sftp-сервера по SFTP link?


     

    screen.jpg
    screen.jpg (52.18 КБ) 4010 просмотров

    Если нажать на Enter, то файл будет скопирован, и ошибка возникнет на следующем файле. Это похоже тикет3406. Я уже давно решил, что SFTP link в энтварных mc безнадежно сломан, и, поэтому, пользовался беспроблемным shell link. А тут смотрю, что-то обсуждается еще. Может и решение есть, которое я не знаю?


    Yrzorg

    Сообщения: 82
    Зарегистрирован: 05 окт 2015, 13:23

    Сообщение Yrzorg » 20 июл 2017, 00:51

    SFTP link в энтварных mc безнадежно сломан

    у меня он поломался окончательно, теперь всё время требует некий пароль


     

    2017-07-19_234622.jpg
    2017-07-19_234622.jpg (14.74 КБ) 3992 просмотра

    Keenetic Ultra II+Entware
    NDMS 3.7


    kaztost

    Сообщения: 223
    Зарегистрирован: 17 июл 2017, 00:29

    Сообщение kaztost » 20 июл 2017, 02:11

    Yrzorg писал(а):Источник цитаты теперь всё время требует некий пароль

    Что-то такое у меня было ранее на старых сборках. Потом как-то само починилось и стало ключи принимать. Но ошибки при копировании остались. Поэтому пользую Shell link. Хоть он и не умеет ходить по симлинкам (а для андроида это насущно), но зато работает без ошибок.


    Yrzorg

    Сообщения: 82
    Зарегистрирован: 05 окт 2015, 13:23

    Сообщение Yrzorg » 22 дек 2017, 23:00

    Yrzorg писал(а):Источник цитаты у меня он поломался окончательно, теперь всё время требует некий пароль

    заборол таки эту проблему, всё оказалось просто:
    из-за путаницы (и моей невнимательности) с HOME — mc не там искал ключи
    почему то mc упорно хочет видеть их в /opt/root/.ssh, но в тоже время признаёт, что домашняя директория в /home/admin

    Код: Выделить всё

    [admin@KN-ULTRA2 : /opt/home/admin]#>mc -F
    Home directory: /home/admin
    Profile root directory: /home/admin
    

    терзают смутные сомнения, что это у него где-то жёстко зашито

    Keenetic Ultra II+Entware
    NDMS 3.7


    kaztost

    Сообщения: 223
    Зарегистрирован: 17 июл 2017, 00:29

    Сообщение kaztost » 23 дек 2017, 11:55

    По идее в vfs/sftpfs/config_parser.c должно стоять

    #ifndef SFTPFS_SSH_CONFIG
    #define SFTPFS_SSH_CONFIG «~/.ssh/config»
    #endif

    Возможно проблема возникает при сборке mc не здесь, а где-то выше, где криво определяется SFTPFS_SSH_CONFIG.


    Аватара пользователя

    Zyxmon

    Администратор
    Сообщения: 1912
    Зарегистрирован: 09 авг 2015, 15:33

    Сообщение Zyxmon » 23 дек 2017, 12:55

    Проблема скорее в том, что в прошивке Падавана суперпользователь не root, а admin. Последнее легко решается альтернативной установкой Entware-3x (для Android другой и быть не может).


    Кто сейчас на конференции

    Всего 1 посетитель :: 0 зарегистрированных, 0 скрытых и 1 гость (основано на активности пользователей за последние 5 минут)
    Больше всего посетителей (162) здесь было 16 ноя 2019, 18:33

    Сейчас этот форум просматривают: нет зарегистрированных пользователей и 1 гость

    Понравилась статья? Поделить с друзьями:
  • Sfml ошибка при запуске приложения 0xc000007b
  • Sfc scannow как исправить ошибки
  • Sfc dll ошибка
  • Sfml graphics d 2 dll ошибка
  • Sew movimot коды ошибок