Commit Graph

15895 Commits

Author SHA1 Message Date
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
Andrew Borodin
f6afcb7076 (copy_file_file): handle "Abort" button
...when can't get extended attributes.

Clarify f6f7c8c1ce.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
46ea5e2a99 Clarify handling of "#enc:".
* (vfs_canon): treate "#enc:" as a regular part of path in case of
    --disable-charset.
  * (realpath_test): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
8e55057fa3 (vfs_path_from_str_uri_parser): fixups.
Handle potential NULL argument.
Clarify detection of absolute path: handle a case when path starts
with #enc:.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
ab3e3339bb vfs_dirent: add new member d_len to get rid of d_name length calculation.
* (vfs_dirent_assign): set d_len up.
  * (mc_readdir): sync with new vfs_dirent: use d_len member.
  * (filename_completion_function): likewise.
  * (handle_dirent): likewise.
  * (find_ignore_dir_search): add 2nd argument to use length of
    directory name if it's known.
  * (do_search): sync with modified vfs_dirent and find_ignore_dir_search().
  * (NLENGTH): remove.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
f4183ed2f2 (filename_completion_function): use DIR_IS_DOT() macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
fc02bf666b (mc_g_string_append_c_len): new API that extends GString one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
822ef80f5b (spell_available): refactoing.
Simplify detection of aspell functions availability.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
9098dacb8a mecedit: spell: reduce functions scope.
* (aspell_check): make static.
  * (aspell_suggest): likewise.
  * (aspell_array_clean): likewise.
  * (aspell_get_lang_list): likewise.
  * (aspell_get_lang): likewise.
  * (aspell_set_lang): likewise.
  * (aspell_add_to_dict): likewise.
  * (spell_dialog_spell_suggest_show): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
75ee44db20 Use listbox_add_item_take() in obvious cases.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
401cd4a16c (listbox_add_item_take): new WListbox API.
Add new item to a listbox taking ownerhip of item text
and avoid a string duplication.

(listbox_add_item): reimplement using listbox_add_item_take().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
e496af7a1c input complete: reimplement using GPtrArray.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:32 +03:00
Andrew Borodin
4eacf0f99b (insert_text): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:40:02 +03:00
Andrew Borodin
127f975657 (search_content): minor refactoring of file opening.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:40:02 +03:00
Andrew Borodin
e113055175 Constify argument in panel field format functions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:40:02 +03:00
Andrew Borodin
d7b14b8933 Use NULL as initial value for undefined user format.
(panel_load_setup): if user's format of file list and status line
are undefined in the ini file, set them to NULL instead of
DEFAULT_USER_FORMAT.

Move definition of DEFAULT_USER_FORMAT macro from panel.h to panel.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:40:02 +03:00
Andrew Borodin
9ba4691b57 (panel_load_setup): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:40:02 +03:00
Andrew Borodin
34109d5a25 Ticket #4524: code cleanup before 4.8.32 release.
(set_panel_formats): fix coding style.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:40:02 +03:00
Andrew Borodin
9428697134 Merge branch '4502_mc.ext.ini_fixups'
* 4502_mc.ext.ini_fixups:
  mc.ext.ini: grammar.
  mc.ext.ini.in: escape dot in gettext catalogs regex.
  Ticket #4502: mc.ext.ini: escape literal parenthesis, don't escape spaces.
2024-05-30 21:18:43 +03:00
Yury V. Zaytsev
9f02d1339d mc.ext.ini: grammar. 2024-05-30 21:17:00 +03:00
Andrew Borodin
3d9ff0fbb7 mc.ext.ini.in: escape dot in gettext catalogs regex.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-30 21:17:00 +03:00
Andrew Borodin
4988414f18 Ticket #4502: mc.ext.ini: escape literal parenthesis, don't escape spaces.
Escape literal parenthesis with double backslashes: \\( \\).
Spaces are no need to be escaped.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-30 21:17:00 +03:00
Andrew Borodin
cb97cd263b Merge branch '4541_hide_vfs_password'
* 4541_hide_vfs_password:
  (truncFileString): isn't used anymore. Remove.
  Ticket #4541: (file_progress_show_source): hide VFS password.
2024-05-26 20:16:45 +03:00
Andrew Borodin
dffcec5acc (truncFileString): isn't used anymore. Remove.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-26 20:14:43 +03:00
crabique
f1908f4361 Ticket #4541: (file_progress_show_source): hide VFS password.
Closes MidnightCommander/mc#198.

Signed-off-by: crabique <6256096+crabique@users.noreply.github.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-26 20:14:43 +03:00
Andrew Borodin
57cf824a51 Merge branch '4540_mcedit_macro_deletes_text'
* 4540_mcedit_macro_deletes_text:
  Ticket #4540: mcedit: macro deletes text.
2024-05-25 19:25:34 +03:00
Sprite_tm
fdacad8bbb Ticket #4540: mcedit: macro deletes text.
(edit_user_menu): fix misinterpretation of return value of
edit_block_delete_cmd(). The bug was introduced in
e2e34d82ab.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-22 22:06:03 +03:00
Andrew Borodin
425938e460 Merge branch '4292_autocomplete_slashes'
* 4292_autocomplete_slashes:
  Ticket #4292: fix redundant back slashes for autocomplete.
2024-05-19 19:31:14 +03:00
Andrew Borodin
2ee620f74f Ticket #4292: fix redundant back slashes for autocomplete.
Steps to reproduce:

1. Create file owth a space in the name:
  touch "a b"
There should no other files with name begins with "a" in the directory.
2. Press Shift-F4 to open editor
3. Press Shift-F2 to display dialog window "Save as..."
4. Press Esc+Tab to fill an input line

Result:
a\ b will appear in the edit field.
If you attempt to save the file, the back slash will be in the filename.

Expected result:
no any extra back slashes in the file name.

Soution: escape only '?', '*', and '&' symbols as described in the
manual page (see a11995e12b).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-19 19:30:07 +03:00
Andrew Borodin
49e2535c07 Merge branch '3570_xorriso_slow'
* 3570_xorriso_slow:
  extfs: add test data for the iso9660 extfs helper (xorriso part)
  extfs: modify the iso9660 extfs helper to support testing (xorriso part)
  Ticket #3570: reimplement xorriso part of iso9660 listing.
2024-05-18 19:47:31 +03:00
slowpeek
62915a38f1 extfs: add test data for the iso9660 extfs helper (xorriso part)
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-18 19:47:06 +03:00
slowpeek
094a140c26 extfs: modify the iso9660 extfs helper to support testing (xorriso part)
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-18 19:47:06 +03:00
slowpeek
bbcfda3c62 Ticket #3570: reimplement xorriso part of iso9660 listing.
When xorriso is installed, iso9660 listing was done with `xorriso .. -lsl ..`
per dir recursively. It was unbearably slow on iso images with lots of subdirs.
For example, it took my machine 2 minutes to open debian-12.5.0-amd64-DVD-1.iso
which contains 2627 dirs. This commit makes use of `xorriso .. -find / -exec
lsdl ..` instead to list the whole directory tree in a single pass.

Also, parsing of xorriso output has been reworked and as a result such
previously missing items became visible in the listing:
- symlinks
- the boot catalog file

Closes MidnightCommander/mc#196.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-05-18 19:47:06 +03:00
Andrew Borodin
794823b885 Merge branch '4535_tmpdir_name'
* 4535_tmpdir_name:
  Ticket #4535: change name of temporary drirectory.
2024-05-14 21:52:35 +03:00