Commit Graph

14100 Commits

Author SHA1 Message Date
Andrew Borodin c139b82711 Don't calculate totals for copy and erase operations on single file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:42 +03:00
Andrew Borodin b6a65e084d (file_is_symlink_to_dir): new API.
Returns TRUE if file is symbolic link to directory, FALSE otherwise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:42 +03:00
Andrew Borodin 64526def8a (panel_operate): add TODO for rename/move of several directories.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:42 +03:00
Andrew Borodin 3ba4417c18 Don't calculate totals for move operation on single file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:41 +03:00
Andrew Borodin 7dac8f7bd6 (operate_single_file): don't calculate directory size before rename or move...
...of single directory within same file system.

First try rename the single file/dir. If case of unsuccess, use
copy+delete with directory size calclulation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin ef5d346dd9 (operate_single_file): make src and dest file name unescaping
...as it made in operate_one_file.

(build_dest): make dest file name unescaping here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 1071c232c7 Refactor preparation of file/dir operation.
(transform_source): rename to build_dest and really build destination
file name here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 1337ed1c55 (transform_source): fix memory leak in error case.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 763e996076 (operate_one_file): refactoring, add extra variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 816b503e3a (operate_single_file): refactoring, add extra variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 07bbfb73e3 (move_dir_dir): refactoring: move erase of copied directories to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 93c6687cb7 Refactoring: move file remove to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 9d55d861e2 Refactroing: move same file/dir check to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 6ea94459d3 Refactoring: move of directory erase to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 9ff91634f5 (panel_operate): refactoring: move file/dir operation to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin cd7db69e69 (panel_operate): refactoring: move single file/dir operation to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 5d98418133 (panel_operate): refactoring: move copy/move confirmation prompt to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 4aad3c524a (panel_operate): refactoring: move delete confirmation prompt to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin ead9063880 (panel_operate): refactoring: move check of single entry to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin edd67ef445 Ticket #3149: don't calculate directory size before rename or move...
...whitin same file system.

Initial commit: cleanup: WITH_FULL_PATHS is defined permanently.
Remove it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin 17828095f1 Merge branch '3857_mekedev'
* 3857_mekedev:
  Ticket #3857: avoid glibc 2.25 warnings about major(), minor(), and makedev().
2018-01-20 10:58:32 +03:00
Andrew Borodin fcf5ba5be2 Ticket #3857: avoid glibc 2.25 warnings about major(), minor(), and makedev().
See gnulib a512e041120e9012e69afa2f5c3adc196ec4999a:

glibc 2.25 is deprecating the namespace pollution of <sys/types.h>
injecting major(), minor(), and makedev() into the compilation
environment, with a warning that insists that users include
<sys/sysmacros.h> instead.  However, because the expansion of
AC_HEADER_MAJOR didn't bother checking sys/sysmacros.h until after
probing whether sys/types.h pollutes the namespace, it was not defining
MAJOR_IN_SYSMACROS, with the result that code compiled with -Werror
chokes on the deprecation warnings because it was not including
sysmacros.h.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-20 10:57:42 +03:00
Andrew V. Samoilov d94a568cbf * doc/NEWS: typo
Signed-off-by: Andrew V. Samoilov <asamoilov@gmail.com>
2018-01-12 00:42:40 +02:00
Andrew Borodin 79b6a772fe Merge branch '3406_sftp_error_31'
* 3406_sftp_error_31:
  (panel_operate_init_totals): fix directory size calculation.
  (panel_operate_init_totals): change the 'source' argument type...
  sftpfs: handle file operation errors.
  (sftpfs_close_file): return actual result of sftp file close operation.
  (sftpfs_waitsocket): refactor and use it for file and directory operations.
  Clarify usage of sftpfs_internal_stat() return value.
  sftpfs: refactoring: move initialization of sftp stat operations to separate function.
  sftpfs: refactoring: move initialization of sftp operation to separate function.
  (sftpfs_waitsocket): handle socket errors.
  sftpfs: refactoring: move handling of socket errors to separate function.
  (sftpfs_fstat): use sftpfs_attr_to_stat().
  sftpfs: refactoring: move obtaining of stat info from sftp attributes to separate function.
  sftpfs: refactoring: move error check to separate function.
  Fix sftp error 31 (proto 4 and 2)
  sftp handle LIBSSH2_FX_PERMISSION_DENIED as EACCES.
  Ticket #3406: sftpfs: fix -31 SFTP Protocol Error when transferring file via SFTP Link.
2017-12-28 10:25:24 +03:00
Andrew Borodin 322d0804c7 (panel_operate_init_totals): fix directory size calculation.
Don't calculate directory size if object is not a directory.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:22:00 +03:00
Andrew Borodin 212207026b (panel_operate_init_totals): change the 'source' argument type...
...to get rid of vfs_path_t -> char * -> vfs_path_t conversion.
2017-12-28 10:22:00 +03:00
Andrew Borodin f46c483e64 sftpfs: handle file operation errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:22:00 +03:00
Andrew Borodin bcdb78c7a0 (sftpfs_close_file): return actual result of sftp file close operation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:22:00 +03:00
Andrew Borodin 57be6c6c80 (sftpfs_waitsocket): refactor and use it for file and directory operations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:21:50 +03:00
Andrew Borodin a3b54e4003 Clarify usage of sftpfs_internal_stat() return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi 77a273a0fd sftpfs: refactoring: move initialization of sftp stat operations to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi bbef777867 sftpfs: refactoring: move initialization of sftp operation to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin a63950710c (sftpfs_waitsocket): handle socket errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi d5f6f317b2 sftpfs: refactoring: move handling of socket errors to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin 29b9c1d81d (sftpfs_fstat): use sftpfs_attr_to_stat().
* (sftpfs_attr_to_stat): make public.
  * (sftpfs_blksize): make static.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi 8e8229931e sftpfs: refactoring: move obtaining of stat info from sftp attributes to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin b5cf04bc8d sftpfs: refactoring: move error check to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi a241f472bf Fix sftp error 31 (proto 4 and 2)
See https://midnight-commander.org/ticket/3406#comment:13
and https://midnight-commander.org/ticket/3406#comment:16.

Both _lstat and _stat need to handle NO_SUCH_FILE while
copying to a remote sftp.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andreas Mohr 1866f9169f sftp handle LIBSSH2_FX_PERMISSION_DENIED as EACCES.
When libssh2_sftp_stat_ex(LIBSSH2_SFTP_STAT|LIBSSH2_SFTP_LSTAT) returns with
LIBSSH2_ERROR_SFTP_PROTOCOL (-31) and LIBSSH2_FX_PERMISSION_DENIED (3)
handle this error case like local stat/lstat() returns -EACCES.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andreas Mohr 22076e2d8b Ticket #3406: sftpfs: fix -31 SFTP Protocol Error when transferring file via SFTP Link.
Initial commit: extend error message with sftp session error.

When LIBSSH2_ERROR_SFTP_PROTOCOL (-31) occurs extend error message
with sftp last error for better failure tracking.

With #3269 patch further sftp protocol error message now looks like
SFTP Protocol Error 3 (-31).

Currently I have no nice solution for print relevant called libssh2 function too
I don't want pollute _to_gliberror() with contant strings all over.

sftp session error 3 means (file) permission denied.

From libssh2-1.5.0/include/libssh2_sftp.h

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin 218dcea543 Merge branch '3865_exfs_rpm_scripts'
* 3865_exfs_rpm_scripts:
  extfs: rpm: unset hardcoded irrelevant size of RPM scripts.
  Ticket #3865: extfs: rpm: INSTALL is truncated in the viewer
2017-12-24 09:44:36 +03:00
Andrew Borodin 8d0c1c305a extfs: rpm: unset hardcoded irrelevant size of RPM scripts.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-24 09:44:24 +03:00
Anatoly Borodin cf94e56acf Ticket #3865: extfs: rpm: INSTALL is truncated in the viewer
Before the rewrite e7ed071be7, the files
`INSTALL`, `UPGRADE`, and `REBUILD` were just text files with fixed
length of 39 characters. After the rewrite, the corresponding `rpm`
commands (of variable length) have been added.

If one of these files is being opened with the internal viewer, only the
first 39 characters (hardcoded in `mcrpmfs_list()`) are shown, e.g.
`INSTALL` (before the previous commit):

	# Run this script to install this RPM p

The word 'script' was added inconsistently (compare with `UPGRADE` and
`REBUILD`) and can be removed. The `rpm` commands can be also removed:
they may fail to work if there is a whitespace in the path, so they
cannot always be simply copy&pasted; it's is still possible to "run" the
script files with Enter.

Signed-off-by: Anatoly Borodin <anatoly.borodin@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-24 09:44:24 +03:00
Yury V. Zaytsev 38ce185cd3 Merge branch '3890_syntax_mjs' 2017-12-24 06:58:37 +01:00
Yury V. Zaytsev a778825d0e Ticket #3890: syntax - add mjs extension to JavaScript pattern
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-12-23 20:09:17 +01:00
Andrew Borodin 4fcc19b581 Syntax.in: fix pattern for Ruby program. 2017-12-18 11:01:35 +03:00
Andrew Borodin 312b316577 Merge branch '3148_achown_mouse'
* 3148_achown_mouse:
  achown: add mouse support for permission buttons.
  achown: use Space key to invert current permission flag.
  (advanced_chown_callback): button is already focused, don't focus it again.
  achown: handle some keys in permission button callback.
  achown: add callback for permission buttons
  achown: clarify text positions.
  achown: clarify location of user and group listbox window.
  Ticket #3148: add mouse support in 'Advanced chown' window.
2017-12-16 14:08:43 +03:00
Andrew Borodin 5eb4010b0d achown: add mouse support for permission buttons.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin aa36eb38ce achown: use Space key to invert current permission flag.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin fe63828b8b (advanced_chown_callback): button is already focused, don't focus it again.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00