Commit Graph

15049 Commits

Author SHA1 Message Date
Andrew Borodin
0aaf74777d Merge branch '2919_visible'
* 2919_visible:
  WMenubar: remove unneeded action.
  (setup_panels): reduce the number of redraws.
  (setup_panels, setup_cmdline): use WST_VISIBLE to set up prompt and command line.
  (setup_panels): use WST_VISIBLE to set up hint bar.
  Buttonbar: use WST_VISIBLE state
  Menubar: use WST_VISIBLE state
  Add WST_VISIBLE widget state.
  Ticket #2919: implement WST_VISIBLE widget state.
2021-04-11 17:11:00 +03:00
Andrew Borodin
53d073758f WMenubar: remove unneeded action.
(menubar_activate): do not focus explicitly. Focus is made in
widget_select().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:14 +03:00
Andrew Borodin
789aa0bb22 (setup_panels): reduce the number of redraws.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:14 +03:00
Andrew Borodin
57fd21c7a0 (setup_panels, setup_cmdline): use WST_VISIBLE to set up prompt and command line.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:13 +03:00
Andrew Borodin
9ac272a287 (setup_panels): use WST_VISIBLE to set up hint bar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:13 +03:00
Andrew Borodin
913403b10c Buttonbar: use WST_VISIBLE state
...instead of WButtonBar::visible member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:08 +03:00
Andrew Borodin
0e75e85598 Menubar: use WST_VISIBLE state
...instead of WMenuBar::is_visible member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:09:53 +03:00
Andrew Borodin
7196a15d81 Add WST_VISIBLE widget state.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:06:28 +03:00
Andrew Borodin
4598667b4d Ticket #2919: implement WST_VISIBLE widget state.
(widget_is_focusable): new widget API.
Use it to detect if widget can take focus or not.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:06:28 +03:00
Andrew Borodin
f67b6c1d00 Merge branch '2252_rebuild'
* 2252_rebuild:
  Rename DISTR_VERSION macro to MAN_VERSION.
  Rename version.h to mc-version.h.
  Ticket #2252: reduce rebuld time.
2021-04-11 17:00:11 +03:00
Andrew Borodin
3b16728742 Rename DISTR_VERSION macro to MAN_VERSION.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 16:58:31 +03:00
Andrew Borodin
30480df7c9 Rename version.h to mc-version.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 16:58:31 +03:00
Andrew Borodin
32621b96d1 Ticket #2252: reduce rebuld time.
The build system runs configure script after switching to another branch
or changeset, which basically means that each git operation which
modifies HEAD will cause a full rebuild. This is highly annoying, in
particular during bisecting.

Solution:
Don't define version in config.h.
Add mc_version member to mc_global_t structure and use it instead of
VERSION macro.
Now only lib/global.c depends on MC version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 16:58:31 +03:00
Andrew Borodin
b5febbdd90 Merge branch '3985_symlink_preserve_timestamp'
* 3985_symlink_preserve_timestamp:
  Preserve timestamp for other file types: socket, fifo, etc.
  Ticket #3985: preserve timestamp for synlinks.
2021-04-11 16:23:47 +03:00
Andrew Borodin
14e84cbf8e Preserve timestamp for other file types: socket, fifo, etc.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-04 10:20:50 +03:00
Andrew Borodin
109af564bc Ticket #3985: preserve timestamp for synlinks.
* (local_utime): pass AT_SYMLINK_NOFOLLOW to utimensat() to update
    timestamps of the link,  rather  than the file to which it refers.
  * (move_file_file): preserve timestamp of the link.
  * (copy_file_file): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-03 16:15:44 +03:00
Andrew Borodin
9436bd1fa4 Merge branch '4222_search_segfault'
* 4222_search_segfault:
  Ticket #4222: fix segfault in search.
2021-04-03 12:34:49 +03:00
Andreas Mohr
3c287cef95 Ticket #4222: fix segfault in search.
(mc_search__g_regex_match_full_safe): fix out of bound read:
g_utf8_get_char_validated() expects a nul-terminated string.

Test case: search for "test" in
https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-20201218.tar.xz

Found by clang-11

==10142==ERROR: AddressSanitizer: SEGV on unknown address 0x60c001e00000 (pc 0x7ffb352111c0 bp 0x7ffcb5745150 sp 0x7ffcb57450e8 T0)
==10142==The signal is caused by a READ memory access.
    #0 0x7ffb352111c0 in g_utf8_get_char_validated (/usr/lib64/libglib-2.0.so.0+0x811c0)
    #1 0x851e6d in mc_search__g_regex_match_full_safe /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:297:22
    #2 0x851824 in mc_search__regex_found_cond_one /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:328:10
    #3 0x84b955 in mc_search__regex_found_cond /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:377:13
    #4 0x84aa07 in mc_search__run_regex /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:955:17
    #5 0x848969 in mc_search__run_normal /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/normal.c:104:12
    #6 0x77270c in mc_search_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:308:15
    #7 0x514fd9 in search_content /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1123:20
    #8 0x511917 in do_search /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1405:26
    #9 0x512028 in find_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1597:9
    #10 0x7e285f in send_message /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:243:15
    #11 0x7e36d8 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:307:17
    #12 0x7e34c5 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:583:5
    #13 0x510aa1 in run_process /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1755:11
    #14 0x50c29e in do_find /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1789:20
    #15 0x5098e7 in find_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1917:17
    #16 0x504735 in midnight_execute_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1251:9
    #17 0x502e00 in midnight_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1604:21
    #18 0x7eaa5c in send_message /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:243:15
    #19 0x7e7ae9 in group_handle_key /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/group.c:442:19
    #20 0x7e6a4f in group_default_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/group.c:567:16
    #21 0x7e31bf in dlg_key_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:251:19
    #22 0x7e2c12 in dlg_process_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:549:9
    #23 0x7e3746 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:320:9
    #24 0x7e34c5 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:583:5
    #25 0x502866 in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1838:16
    #26 0x4ceb15 in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:455:21
    #27 0x7ffb34f16b49 in __libc_start_main (/lib64/libc.so.6+0x23b49)
    #28 0x4230f9 in _start (/tmp/portage/app-misc/mc-9999/work/mc-9999/src/mc+0x4230f9)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-03 12:33:54 +03:00
Andrew Borodin
8519c7e5b4 Merge branch '3603_version'
* 3603_version:
  Fix deprecated AM_PROG_MKDIR_P warning.
  Ticket #3603: configure.ac: proper AC_INIT and AM_INIT_AUTOMAKE usage.
2021-03-28 19:39:18 +03:00
Andreas Mohr
c6cbc8aca4 Fix deprecated AM_PROG_MKDIR_P warning.
Lets minor bump gettext version to 0.18.2 (release 2012-12-25) to get rid of following warning:
    configure.ac:269: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged.
    configure.ac:269: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
    configure.ac:269: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-28 19:37:58 +03:00
Andreas Mohr
1409eddde3 Ticket #3603: configure.ac: proper AC_INIT and AM_INIT_AUTOMAKE usage.
Fix deprecate warning
configure.ac:13: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:13: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation

Support of m4_esyscmd_s() since autoconf-2.64 (release 2009-07-26).

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-28 19:37:58 +03:00
Andrew Borodin
6a6fdf1ae3 Merge branch '4223_browse_jar'
* 4223_browse_jar:
  Ticket #4223: fix recognition of JAR files as ZIP archives
2021-03-28 19:32:38 +03:00
Piotrek Żygieło
0e023f0dd9 Ticket #4223: fix recognition of JAR files as ZIP archives
Similar to 7881ed2 that solved ticket #4180.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-28 19:30:11 +03:00
Andrew Borodin
fa2cbd2a2c Merge branch '4180_mc.ext_archives'
* 4180_mc.ext_archives:
  Ticket #4180: reorgzanize mc.ext.
2021-03-28 19:19:16 +03:00
Andrew Borodin
c3848a689c Ticket #4180: reorgzanize mc.ext.
$ file -L image.zip
image.zip: Zip archive data, at least v2.0 to extract
$ file -L -z image.zip
image.zip: JPEG image data, JFIF standard 1.01, resolution (DPI),
density 96x96, segment length 16, baseline, precision 8, 1024x768,
frames 3 (Zip archive data, at least v2.0 to extract)

Since in mc.ext

type/^JPEG

is evaluated before

type/\(Zip archive

mc assume image.zip is a image not an archive.

To solve this, since we use "file -z", match file name at first
(regex/ and shell/), then type/.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-28 15:36:42 +03:00
Andrew Borodin
6d67058499 Merge branch '4217_remove_distro_specific_stuff'
* 4217_remove_distro_specific_stuff:
  Ticket #4217: remove OS/distro-specific stuff.
2021-03-21 20:32:28 +03:00
Andrew Borodin
63d50df5d9 Ticket #4217: remove OS/distro-specific stuff.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-21 20:30:30 +03:00
Andrew Borodin
3ba4229508 (do_panelize_cd): fix memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-18 16:41:36 +03:00
Andrew Borodin
11ed948f02 (do_find): fix wrong duplication of file name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-18 16:39:31 +03:00
Andrew Borodin
4df5bbf9ef Fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 20:15:00 +03:00
Andrew Borodin
f223210dcd Merge branch '4179_cleanup'
* 4179_cleanup: (38 commits)
  Update po/*.po files.
  libcheck: replace deprecated fail_unless() function.
  libcheck: replace deprecated fail() function.
  (hex_translate_to_regex.c): fix maybe-uninitialized warning.
  Fix lto-type-mismatch warning.
  (rotate_dash): type accuracy.
  (widget_set_size): call widget_draw() to get rid of code duplication.
  (mc_g_string_dup): new API that extends GString one.
  (file_entry_t): use GString instead of fname & fnamelen.
  (vfs_path_free): add 2nd parameter...
  (init_subshell_child): use g_setenv() instead of putenv().
  Define macros for bashrc, ashrc, and inputrc files.
  Refactoring of keymap load/save.
  (struct key_config_t): remove.
  (struct name_keymap_t): move from lib/keybind.h to lib/keybind.c.
  (mc_tmpdir): use $MC_TMPDIR if set.
  (show_file_history): keep order of modified history items.
  filemanager/chattr.c: remove TODO.
  Clarify check of 256 colors support.
  Ticket #4173: fix linking of libmc.la.
  ...
2021-03-14 20:03:20 +03:00
Andrew Borodin
bb51da6590 Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 20:02:52 +03:00
Andreas Mohr
fa8c5e1c37 libcheck: replace deprecated fail_unless() function.
libcheck fail_unless() is deprecated since 0.10.0.
Also fix -Wformat-extra-args warnings.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:25 +03:00
Andreas Mohr
da97a2a626 libcheck: replace deprecated fail() function.
libcheck fail() is deprecated since 0.10.0.
Also fix -Wformat-extra-args warnings.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:25 +03:00
Andreas Mohr
79fb2be8d1 (hex_translate_to_regex.c): fix maybe-uninitialized warning.
hex_translate_to_regex.c: In function 'test_hex_translate_to_regex_fn':
hex_translate_to_regex.c:172:9: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  172 |         mctest_assert_int_eq (error, data->expected_error);
      |         ^
hex_translate_to_regex.c:154:33: note: 'error' was declared here
  154 |     mc_search_hex_parse_error_t error;
      |                                 ^

Found by gcc-9.3.0

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andreas Mohr
7b9c9564e8 Fix lto-type-mismatch warning.
Found by gcc-9.3.0.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin
ca126b3f69 (rotate_dash): type accuracy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin
4faf4cb2d7 (widget_set_size): call widget_draw() to get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin
d88f439a69 (mc_g_string_dup): new API that extends GString one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin
6f859e52d0 (file_entry_t): use GString instead of fname & fnamelen.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin
536fb676d8 (vfs_path_free): add 2nd parameter...
...to free or not to free the string representation
of vfs_path_t object.

It allows to get rid of string duplication in following cases:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = g_strdup (vfs_path_as_str (vpath));
vfs_path_free (vpath);

Now we can write:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = vfs_path_free (vpath, FALSE);

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin
6903d15b97 (init_subshell_child): use g_setenv() instead of putenv().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:38 +03:00
Andrew Borodin
0c02118fad Define macros for bashrc, ashrc, and inputrc files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:38 +03:00
Andrew Borodin
269ace6bf2 Refactoring of keymap load/save.
src/keymap.[ch]: rename from src/keybind-defaults.[ch].

(keymap_load): rename from load_keymap_defs().
(keymap_free): rename from free_keymap_defs().

Move keymap load/save functions from src/setup.c to src/keymap.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
2ab7fd0390 (struct key_config_t): remove.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
fb3ea27299 (struct name_keymap_t): move from lib/keybind.h to lib/keybind.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
faa195ae59 (mc_tmpdir): use $MC_TMPDIR if set. 2021-03-14 19:48:59 +03:00
Andrew Borodin
7b5b56104b (show_file_history): keep order of modified history items.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
48dea680e6 filemanager/chattr.c: remove TODO.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
4cbc61a775 Clarify check of 256 colors support.
(tty_use_truecolors): don't check 256 colors here.
(tty_use_256colors): generate error message if 256 colors aren't
supported.
(tty_init): sync with modified tty_use_256colors().
(tty_color_try_alloc_pair_lib): likewise.
(mc_skin_init): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00