Commit Graph

15928 Commits

Author SHA1 Message Date
Yury V. Zaytsev
7e2cf63b4e Merge branch '4542_nanoseconds_2'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:01:01 +02:00
Yury V. Zaytsev
0cfccd5882 filemanager: use correct type for results of read in mmap fallback
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
87a76294c4 buildsys: fix ar check by doing it before toolchain checks implicitly looking for ar
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
380c39010a buildsys: support bootstrapping on Solaris by using backticks in autogen.sh
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
eb1375b65d vfs: implement support for all known stat formats and centralize handling
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
c8e8f01faf utilvfs: concentrate timesbuf handling in one place
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
77e5913c02 utilvfs: abstract mc_timesbuf_t handling with own mc_timespec_t type
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
191108766f Ticket #4542: fix support of timestamps with nanosecond precision on macOS
utilvfs: isolate utime / utimensat calls in a helper function

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Andrew Borodin
dbca937c55 Merge branch '4563_reget_on_move'
* 4563_reget_on_move:
  Ticket #4563: support reget in file move operation.
2024-07-28 10:05:33 +03:00
Andrew Borodin
cc34729f45 Ticket #4563: support reget in file move operation.
* (file_op_context_new): change default value of file_op_context_t::do_reget.
  * (overwrite_query_dialog): show the "Reget" button in query dialog for
    move operation.
  * (copy_file_file): keep non-default value of file_op_context_t::do_reget
    that was set before.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-07-27 12:19:08 +03:00
Morthimer McMare
cd8355bfa8 Ticket #4556: color definitions in the "c.syntax" highlight file.
Definitions are provided for:
- Various punctuation (divided into 9 groups);
- Preprocessor;
- Keywords;
- Data types;
- Data type qualifiers;
- Numbers (can be different for the integer, hexadecimal, octal and floatpoint representations);
- Strings and escaped characters;
- Comments (with keywords like "TODO:");
- Labels.
In total 32 "defines"...

Based on the original "c.syntax" file, this version includes most of the content from C89..C23.

Closes MidnightCommander/mc#203.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-07-25 21:38:44 +03:00
Andrew Borodin
45c28d9d11 Merge branch '4562_mcedit_macros_paste'
* 4562_mcedit_macros_paste:
  Ticket #4562: mcedit: don't apply macros to the pasted text.
2024-07-22 21:37:12 +03:00
Andrew Borodin
e9258fcc6c Ticket #4562: mcedit: don't apply macros to the pasted text.
(edit_callback): use bracketed_pasting_in_progress variable to detect
if text is being pasted. If yes, paste text as is without macro
expanaison.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-07-21 19:57:00 +03:00
Andrew Borodin
9f4e88fd70 Merge branch '4561_tar_segfault'
* 4561_tar_segfault:
  Ticket #4561: tar: fix segault on copy fiiles from archive.
2024-07-15 21:42:21 +03:00
Andrew Borodin
ffdb057e5b Ticket #4561: tar: fix segault on copy fiiles from archive.
* (tar_read_header): canonicalize path name after decoding of all
    headers occupied with long file/directory name.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-07-15 21:42:11 +03:00
Andrew Borodin
b68243df1e Merge branch '4560_extfs_open_deleted_archive'
* 4560_extfs_open_deleted_archive:
  Ticket #4560: extfs: fix segfault om enter to deleted archive.
2024-07-11 21:07:32 +03:00
Andrew Borodin
e4c80b5d13 Ticket #4560: extfs: fix segfault om enter to deleted archive.
* (extfs_open_and_read_archive): fix NULL dereference if
    extfs_open_archive() doesn't create an error.
  * (extfs_open_archive): create an error message when mc_open() returns -1.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-07-11 21:06:35 +03:00
Andrew Borodin
7e80ab4dd6 Merge branch '4549_subshell_execl_argv0'
* 4549_subshell_execl_argv0:
  Ticket #4549: subshell: call execl with argv[0] being the actual path to Bash.
2024-06-20 21:03:38 +03:00
Koichi Murase
61675a90a8 Ticket #4549: subshell: call execl with argv[0] being the actual path to Bash.
We currently call Bash with argv[0] being just the fixed string
"bash", but this confuses Bash when it initializes the shell variable
BASH, which are expected to be the absolute file path to the current
Bash image.  This patch fixes argv[0] to be the actual path that mc
uses to start Bash.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-20 21:02:55 +03:00
Yury V. Zaytsev
ed2c15cc68 Ticket #4550: fix typo in man page reported by @polluks
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-20 17:31:09 +02:00
Yury V. Zaytsev
57dddea47c buildsys: fix broken detection for termcap libraries when using slang
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-15 10:40:22 +02:00
Yury V. Zaytsev
61b22eb606 warnings: mute unused variable warning
../../../src/viewer/datasource.c: In function ‘mcview_set_byte’:
../../../src/viewer/datasource.c:270:38: error: unused parameter ‘offset’ [-Werror=unused-parameter]
  270 | mcview_set_byte (WView * view, off_t offset, byte b)
      |                                ~~~~~~^~~~~~

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-03 21:06:19 +02:00
Yury V. Zaytsev
ab7ed3cf2c maint: fix typo in variable name (parse_ls_vga.c)
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-03 20:44:09 +02:00
Yury V. Zaytsev
335c5a78bb glibcompat: remove g_direct_equal shim
This function is present at least in glib-2.43.92:

../../lib/glibcompat.c:69:1: error: static declaration of 'g_direct_equal' follows non-static declaration
   69 | g_direct_equal (gconstpointer v1, gconstpointer v2)
      | ^~~~~~~~~~~~~~
In file included from /home/zaytsev/opt/glib/include/glib-2.0/glib.h:50,
                 from ../../lib/global.h:10,
                 from ../../lib/glibcompat.c:36:
/home/zaytsev/opt/glib/include/glib-2.0/glib/ghash.h:180:10: note: previous declaration of 'g_direct_equal' was here
  180 | gboolean g_direct_equal (gconstpointer  v1,
      |          ^~~~~~~~~~~~~~

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-03 16:18:12 +02:00
Yury V. Zaytsev
bda4e480d2 maint: fix typos in the code
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-03 16:18:04 +02:00
Andrew Borodin
4139bb82a7 Merge branch '4524_cleanup'
* 4524_cleanup: (41 commits)
  Update po/*.po files.
  Remove src/editor/.gitignore.
  Indentation using GNU indent-2.2.13.
  clang: fix `-Wconstant-conversion` warning
  clang: fix `-Wpointer-sign` warning
  buildsys: prefer gnu indent (gindent) to bsd indent if available
  buildsys: update ax_gcc_func_attribute to fix fallthrough detection
  clang: fix `-Wimplicit-fallthrough` warning
  clang: fix `-Wconditional-uninitialized` warnings
  buildsys: fix build on macOS with libssh2 present via homebrew
  m4: add Werror when checking for compiler flags
  (path_trunc): optimization.
  (vfs_path_build_url_params_str): minor refactoring.
  (vfs_path_from_str_uri_parser): fix coding style.
  (mc_search__glob_translate_to_regex): reduce variable scope, refactor.
  src/filemanager/find.c: remove unneeded intialization of local variables.
  (do_find): minor refactoring.
  src/filemanager/find.c: ret rid of string duplication.
  (search_content): reduce variable scope.
  (do_find): fix coding style.
  ...
2024-06-02 12:52:28 +03:00
Andrew Borodin
4509e1026b Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:51:39 +03:00
Andrew Borodin
b3c6bea510 Remove src/editor/.gitignore.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
6718b3ec26 Indentation using GNU indent-2.2.13.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
ce299bbee9 clang: fix -Wconstant-conversion warning
../../../src/filemanager/filegui.c:1413:35: warning: implicit conversion from 'int' to 'mode_t' (aka 'unsigned short') changes value from 262143 to 65535 [-Wconstant-conversion]
                ctx->umask_kill = 0777777;
                                ~ ^~~~~~~

../../../src/filemanager/fileopctx.c:81:23: warning: implicit conversion from 'int' to 'mode_t' (aka 'unsigned short') changes value from 262143 to 65535 [-Wconstant-conversion]
    ctx->umask_kill = 0777777;
                    ~ ^~~~~~~

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
de06f36ccf clang: fix -Wpointer-sign warning
../../../../src/vfs/sftpfs/connection.c:787:22: warning: passing 'unsigned char *const' to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
        if (strncmp (prompts[i].text, "Password: ", prompts[i].length) == 0)
                     ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:84:26: note: passing argument to parameter '__s1' here
int      strncmp(const char *__s1, const char *__s2, size_t __n);
                             ^

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
482025a286 buildsys: prefer gnu indent (gindent) to bsd indent if available
BSD indent does not have `--gnu-style` flag ;-)

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
87bdeeb591 buildsys: update ax_gcc_func_attribute to fix fallthrough detection
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
40867e5740 clang: fix -Wimplicit-fallthrough warning
../../../lib/search/normal.c:75:9: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
        default:
        ^
../../../lib/search/normal.c:75:9: note: insert 'break;' to avoid fall-through
        default:
        ^
        break;

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
04496c6fc1 clang: fix -Wconditional-uninitialized warnings
../../../src/filemanager/file.c:2402:61: warning: variable 'attrs' may be uninitialized when used here [-Wconditional-uninitialized]
                while (attrs_ok && mc_fsetflags (dst_vpath, attrs) != 0 && !ctx->skip_all)
                                                            ^~~~~
../../../src/filemanager/file.c:2266:24: note: initialize the variable 'attrs' to silence this warning
    unsigned long attrs;
                       ^
                        = 0

../../../src/filemanager/file.c:3227:38: warning: variable 'attrs' may be uninitialized when used here [-Wconditional-uninitialized]
            mc_fsetflags (dst_vpath, attrs);
                                     ^~~~~
../../../src/filemanager/file.c:2942:24: note: initialize the variable 'attrs' to silence this warning
    unsigned long attrs;
                       ^
                        = 0

../../../lib/strutil/tokenize.c:163:44: warning: variable 'delimopen' may be uninitialized when used here [-Wconditional-uninitialized]
        if (nestdelim != 0 && string[i] == delimopen)
                                           ^~~~~~~~~
../../../lib/strutil/tokenize.c:72:19: note: initialize the variable 'delimopen' to silence this warning
    char delimopen;
                  ^
                   = '\0'

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
b76569d5ee buildsys: fix build on macOS with libssh2 present via homebrew
Path to libssh2 headers was missing from CPPFLAGS resulting into FTBFS.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Yury V. Zaytsev
3d75fad259 m4: add Werror when checking for compiler flags
Seemingly that at some point clang started accepting _any_ flags,
whereas previously it would error out.

These days, you can give it -Whamsandwich and it will succeed, while
at the same time throwing an annoying warning.

Add -Werror so that everything gets flagged and set accordingly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108082
Cc: Vinson Lee <vlee@freedesktop.org>
Repored-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
a802f14c2e (path_trunc): optimization.
Get rid of double conversion of path: remove passwords using
vfs_path_from_str_flags (path, VPF_STRIP_PASSWORD).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
5a67afc812 (vfs_path_build_url_params_str): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
9e039f66d1 (vfs_path_from_str_uri_parser): fix coding style.
(vfs_path_to_str_flags): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
482feccca8 (mc_search__glob_translate_to_regex): reduce variable scope, refactor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:12 +03:00
Andrew Borodin
34e78a2127 src/filemanager/find.c: remove unneeded intialization of local variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:12 +03:00
Andrew Borodin
3972b7d502 (do_find): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:12 +03:00
Andrew Borodin
615eda6e9e src/filemanager/find.c: ret rid of string duplication.
* (add_to_list_take): new function: listbox_add_item_take() wrapper.
  * (insert_file): use add_to_list_take().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:12 +03:00
Andrew Borodin
5dd087421e (search_content): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
44e4b7f8b9 (do_find): fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
6f7b4131c6 (panel_operate): remove intermediate variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
ab0ecdabd4 doc/NEWS: format.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
12d117ea60 extfs: lslR: remove unneeded escape of space.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Artem Babii
4c998ac636 sftpfs: expand %h
Properly parse %h hostname token, which is widely used in HostName directive within
~/.ssh/config:

Host testing*
  HostName %h.eu.example.com

Host staging*
  HostName %h.us.example.net

# this host will be expanded to `testing-1.eu.example.com`
% mc sftp://username@testing-1

Closes MidnightCommander/mc#197.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00