Commit Graph

16172 Commits

Author SHA1 Message Date
Andrew Borodin
b232229b46 src/filemanager/{achown,chattr,chmod,chown}.c: get rid of code duplication.
* (panel_find_marked_file):
  * (panel_get_marked_file): new WPanel APIs.
  * Use these APIs in src/filemanager/{achown,chattr,chmod,chown}.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 20:45:22 +03:00
Andrew Borodin
2d9383fd54 (panel_callback) [MSG_FOCUS]: remove self-draw here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 20:02:59 +03:00
Andrew Borodin
b14f778e6b Disable all cursor movements if file panel is empty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 20:02:59 +03:00
Andrew Borodin
562eb7449a (start_search): don't start quick search if file panel is empty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 11:40:36 +03:00
Andrew Borodin
f147c8b3e2 Clarify panel->currrent if file panel is empty.
* (panel_do_cd_int): set panel->current to -1 file list is empty.
  * (panel_set_current_by_name): likewise.
  * (panel_sized_with_dir_new): likewise.
  * (panel_reload): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 11:40:36 +03:00
Andrew Borodin
1ac839d20c Ticket #4600: fix segfault on panel filter.
mc segfaults if filter makes file panel empty.

  * (panel_current_entry): improve. Add checks if panel->current is in
  range of file list.
  * A lot of changes to use modified panel_current_entry().
  * (format_file):
  * (display_mini_info): fix drawing of mini-status if file panel is
  empty.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 11:38:31 +03:00
Yury V. Zaytsev
65fee2daf7 Merge branch '4584_tests_weak_symbols'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 09:01:19 +02:00
Yury V. Zaytsev
6c5cf214a9 extfs: use numeric (0/0) root user uid/gid in helpers instead of root/root
Non-Linux systems don't always name the user and group with uid/gid of 0
"root". On macOS group "wheel" has gid of 0 and group "root" doesn't exist. On
FreeBSD there is a user with gid of 0 named "toor". This causes user/group id
lookups in mc to fail and instead return the uid/gid of the current user.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
877ef7d78b tests: don't free after ck_abort_msg as it's marked no-return
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
22b80bf2d4 tests: fix -Winvalid-source-encoding warnings in path_recode
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
5779e51e69 tests: fix -Winvalid-source-encoding warnings in config_string
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
15eeb94d2c tests: fix -Wmissing-variable-declarations warnings in vfs tests
```
../../../../tests/lib/vfs/vfs_parse_ls_lga.c:39:23: warning: no previous extern declaration for non-static variable 'test_subclass1' [-Wmissing-variable-declarations]
struct vfs_s_subclass test_subclass1;
                      ^
../../../../tests/lib/vfs/vfs_parse_ls_lga.c:42:21: warning: no previous extern declaration for non-static variable 'vfs_root_entry' [-Wmissing-variable-declarations]
struct vfs_s_entry *vfs_root_entry;
                    ^
../../../../tests/lib/vfs/vfs_s_get_path.c:40:23: warning: no previous extern declaration for non-static variable 'test_subclass1' [-Wmissing-variable-declarations]
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
                      ^
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
5b63416d04 tests: fix -Wmissing-variable-declarations warnings in filevercmp
```
../../../../tests/lib/strutil/filevercmp.c:213:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds2_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds2_len = G_N_ELEMENTS (filevercmp_test_ds2);
             ^
../../../../tests/lib/strutil/filevercmp.c:250:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds3_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds3_len = G_N_ELEMENTS (filevercmp_test_ds3);
             ^
../../../../tests/lib/strutil/filevercmp.c:288:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds4_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds4_len = G_N_ELEMENTS (filevercmp_test_ds4);
             ^
../../../../tests/lib/strutil/filevercmp.c:349:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds5_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds5_len = G_N_ELEMENTS (filevercmp_test_ds5);
             ^
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
93b539444b Ticket #4584: re-implement mocking via weak symbols instead of symbol duplication
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:40 +02:00
Yury V. Zaytsev
09320d5381 (attrs_ignore_error): constify input param and fix typos
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:52:28 +02:00
Yury V. Zaytsev
a3a6d00a61 cmd: remove forgotten mmap macros and includes
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:49:49 +02:00
Yury V. Zaytsev
6fb0bb589f Merge branch '4495_alpine_support'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:45:14 +02:00
Yury V. Zaytsev
fc96f96c6a buildsys: sync ax_check_compile_flag.m4 with autoconf archive
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-18 21:05:37 +02:00
Yury V. Zaytsev
b8e2a376e3 Ticket #4495: check if environ is defined to fix redefinition on Alpine
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-18 20:57:43 +02:00
Yury V. Zaytsev
dd12be7c82 (extract_line): remove extra const qualifier erroneously introduced in bb4e152
```
../../lib/util.c:637:7: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
  637 | const const char *
      |       ^
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-18 19:46:17 +02:00
Andrew Borodin
8d0bb40f16 Merge branch '4590_ext2attr_errno'
* 4590_ext2attr_errno:
  (copy_dir_dir): clarify get of mode and attributes of source directory.
  file operations: rename actions and button names:
  Clarify messages of get/set ext2 attributes errors.
  Ticket #4590: clarify handling of ext2 attributes errors.
2024-10-18 20:11:07 +03:00
Andrew Borodin
1f36a3fd80 (copy_dir_dir): clarify get of mode and attributes of source directory.
Use the same way as in copy_file_file().

Signed-off-by: Andrew Borodin <borodin@axion.lan>
2024-10-18 18:37:40 +03:00
Andrew Borodin
5486bdad0e file operations: rename actions and button names:
skip -> ignore
skip all -> ignore all.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-18 18:37:40 +03:00
Andrew Borodin
cbb3c9a372 Clarify messages of get/set ext2 attributes errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-18 18:37:39 +03:00
Andrew Borodin
5f5e71b7f8 Ticket #4590: clarify handling of ext2 attributes errors.
Don't show an error message if mc_fgetflags() and mc_fsetflags()
fails and errno set to ENOTSUP, EOPNOTSUPP, ENOSYS, and EINVAL.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-18 18:37:39 +03:00
Andrew Borodin
de7d72cab4 src/vfs/tar/tar-internal.c: define UINTMAX_WIDTH.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-17 21:10:08 +02:00
Yury V. Zaytsev
2c76c23a8f buildsys: fix bootstrapped build on Solaris and systems with LC_ALL != C
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-17 21:10:08 +02:00
Andrew Borodin
54a4c7d55f Merge branch '4598_tar_segfault'
* 4598_tar_segfault:
  tar: initialize variables passed to stoint().
  (decode_num): simplify expression.
  Ticket #4598: fix segfault on open TAR archive.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-11 17:37:19 +03:00
Andrew Borodin
0c505b9e13 tar: initialize variables passed to stoint().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-10 21:16:32 +03:00
Andrew Borodin
f4740bf0b9 (decode_num): simplify expression.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-10 21:12:21 +03:00
Andrew Borodin
773bb6f60b Ticket #4598: fix segfault on open TAR archive.
(decode_timespec): fix incorrect assignment of variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-10 21:08:13 +03:00
Yury V. Zaytsev
b294d650a3 Merge branch '4596_fix_command_v'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-09 17:26:57 +02:00
Yury V. Zaytsev
f53e9b10bd Ticket #4596: don't suppress command -v output for variable assignments
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-09 09:34:45 +02:00
Andrew Borodin
5e2a484b92 Merge branch '4593_tar_compilation'
* 4593_tar_compilation:
  (user_menu_cmd): minor refactoring.
  (user_menu_cmd): remove unused variable.
  Ticket #4595: tar: fix comparison of integer expressions of different signedness.
  (decode_time): initialize variable.
  Ticket #4593: tar: fix compilation on systems w/o stdckdint.h.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-08 13:03:34 +03:00
Andrew Borodin
b4f4618994 (user_menu_cmd): minor refactoring.
Fix comparison of integer expressions of different signedness.
Reduce variable scope.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-08 13:02:24 +03:00
Andrew Borodin
1719f3383f (user_menu_cmd): remove unused variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-08 13:02:24 +03:00
Andrew Borodin
4b1cdccb48 Ticket #4595: tar: fix comparison of integer expressions of different signedness.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-08 13:02:17 +03:00
Andrew Borodin
9d462b135c (decode_time): initialize variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-08 13:02:17 +03:00
Andrew Borodin
d7b85ed9c9 Ticket #4593: tar: fix compilation on systems w/o stdckdint.h.
* lib/intprops.h: new file.
  * src/vfs/tar/tar-internal.h: include intprops.h, remove macros
    defined there.
  * src/vfs/tar/tar-sparse.c: remove macro, defined in intprops.h.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-08 13:02:17 +03:00
Andrew Borodin
f46406473e Merge branch '4572_cleanup'
* 4572_cleanup: (53 commits)
  doc: fix typos in comments
  Update po/*.po fiies.
  (mcview_display_hex): refactor, fix coding style.
  src/vfs/cpio/cpio.c: fix coding style.
  lib/vfs/path.h: fix coding style.
  (setup__is_cfg_group_must_panel_config): fix coding style.
  (check_format_var): fix coding stile.
  (copy_file_file): handling "Abort" button on chown/chmod/chattr error.
  buildsys: remove orphaned rpc checks after samba was deleted
  src/filemanager/chattr.c: fix coding style.
  (chattrboxes_rename): reduce variable scope.
  (files_error): fix coding style.
  (show_version): add output of uintmax_t size.
  lib/vfs/direntry.c: fix coding style.
  lib/vfs/vfs.c: fix coding style.
  (spell_dialog_spell_suggest_show): refactoring.
  tar: avoid need for base64_init and extra table.
  (tar_from_header): reword to avoid a cast to unsigned char.
  tar: avoid casts in tar_checksum.
  tar: prefer stoint to strtoul and variants.
  ...
2024-10-06 12:11:29 +03:00
Yury V. Zaytsev
d11faea07d doc: fix typos in comments
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 18:55:01 +02:00
Andrew Borodin
699312f9b6 Update po/*.po fiies. 2024-10-05 15:13:07 +03:00
Andrew Borodin
aa4e5019f9 (mcview_display_hex): refactor, fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
918d386172 src/vfs/cpio/cpio.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
c5379ab36e lib/vfs/path.h: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
a92de91616 (setup__is_cfg_group_must_panel_config): fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
4b49c82198 (check_format_var): fix coding stile.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
51ff7dc13c (copy_file_file): handling "Abort" button on chown/chmod/chattr error.
The "Abort" buton must interrupt the copy/move of a directory
mot a file only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Yury V. Zaytsev
901a1a98a9 buildsys: remove orphaned rpc checks after samba was deleted
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 15:07:14 +03:00
Andrew Borodin
6e95a0be43 src/filemanager/chattr.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00