As voted for in Nov 2022 by the BIPM:
https://www.bipm.org/en/cgpm-2022/resolution-3
Sync with gnulib 0ad3ea4951f77835d02180021589f3a849d885f2.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Normal start result in this AddressSanitizer hit.
=================================================================
==17167==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200005b251 at pc 0x5983b1c3be5f bp 0x7ffcc27f4310 sp 0x7ffcc27f4308
WRITE of size 1 at 0x60200005b251 thread T0
#0 0x5983b1c3be5e in mc_search__change_case_str /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/lib.c:84:14
#1 0x5983b1c3c03f in mc_search__toupper_case_str /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/lib.c:200:12
#2 0x5983b1d1b434 in mc_search__cond_struct_new_regex_hex_add /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:130:11
#3 0x5983b1d1ad7f in mc_search__cond_struct_new_regex_accum_append /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:180:17
#4 0x5983b1d147c9 in mc_search__cond_struct_new_regex_ci_str /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:251:5
#5 0x5983b1d136fa in mc_search__cond_struct_new_init_regex /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:817:39
#6 0x5983b1c3d7f0 in mc_search__cond_struct_new /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:80:9
#7 0x5983b1c3d2e5 in mc_search_prepare /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:219:26
#8 0x5983b1c3d9c3 in mc_search_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:297:10
#9 0x5983b1c359f2 in mc_fhl_get_color_regexp /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/filehighlight/get-color.c:243:9
#10 0x5983b1c35385 in mc_fhl_get_color /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/filehighlight/get-color.c:278:19
#11 0x5983b1a1208f in file_compute_color /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:784:12
#12 0x5983b1a10bfd in format_file /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:814:17
#13 0x5983b1a0fb17 in repaint_file /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:954:15
#14 0x5983b1a0c0b6 in paint_dir /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:1071:9
#15 0x5983b19fab96 in panel_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:3731:9
#16 0x5983b1d08775 in widget_draw /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/widget-common.c:539:19
#17 0x5983b1d078eb in widget_default_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/widget-common.c:841:17
#18 0x5983b1cb3c0b in widget_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:383:12
#19 0x5983b1cb286c in group_default_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/group.c:691:17
#20 0x5983b1caa8ab in widget_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:383:12
#21 0x5983b1cacd14 in dlg_init /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:540:5
#22 0x5983b1cada9d in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:601:5
#23 0x5983b19cddd9 in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1827:16
#24 0x5983b1999605 in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:455:21
#25 0x7d3944d620cb (/lib64/libc.so.6+0x220cb)
#26 0x7d3944d6217b in __libc_start_main (/lib64/libc.so.6+0x2217b)
#27 0x5983b18d7d10 in _start (/usr/bin/mc+0x277d10)
0x60200005b251 is located 0 bytes to the right of 1-byte region [0x60200005b250,0x60200005b251)
allocated by thread T0 here:
#0 0x5983b195ee89 in malloc (/usr/bin/mc+0x2fee89)
#1 0x7d3945014ef9 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x54ef9)
#2 0x5983b1c3c03f in mc_search__toupper_case_str /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/lib.c:200:12
#3 0x5983b1d1b434 in mc_search__cond_struct_new_regex_hex_add /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:130:11
#4 0x5983b1d1ad7f in mc_search__cond_struct_new_regex_accum_append /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:180:17
#5 0x5983b1d147c9 in mc_search__cond_struct_new_regex_ci_str /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:251:5
#6 0x5983b1d136fa in mc_search__cond_struct_new_init_regex /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:817:39
#7 0x5983b1c3d7f0 in mc_search__cond_struct_new /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:80:9
#8 0x5983b1c3d2e5 in mc_search_prepare /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:219:26
#9 0x5983b1c3d9c3 in mc_search_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:297:10
#10 0x5983b1c359f2 in mc_fhl_get_color_regexp /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/filehighlight/get-color.c:243:9
#11 0x5983b1c35385 in mc_fhl_get_color /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/filehighlight/get-color.c:278:19
#12 0x5983b1a1208f in file_compute_color /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:784:12
#13 0x5983b1a10bfd in format_file /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:814:17
#14 0x5983b1a0fb17 in repaint_file /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:954:15
#15 0x5983b1a0c0b6 in paint_dir /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:1071:9
#16 0x5983b19fab96 in panel_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:3731:9
#17 0x5983b1d08775 in widget_draw /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/widget-common.c:539:19
#18 0x5983b1d078eb in widget_default_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/widget-common.c:841:17
#19 0x5983b1cb3c0b in widget_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:383:12
#20 0x5983b1cb286c in group_default_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/group.c:691:17
#21 0x5983b1caa8ab in widget_set_state /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:383:12
#22 0x5983b1cacd14 in dlg_init /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:540:5
#23 0x5983b1cada9d in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:601:5
#24 0x5983b19cddd9 in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1827:16
#25 0x5983b1999605 in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:455:21
#26 0x7d3944d620cb (/lib64/libc.so.6+0x220cb)
SUMMARY: AddressSanitizer: heap-buffer-overflow /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/lib.c:84:14 in mc_search__change_case_str
Shadow bytes around the buggy address:
0x0c04800035f0: fa fa fd fa fa fa fd fd fa fa fd fa fa fa fd fa
0x0c0480003600: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c0480003610: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fd
0x0c0480003620: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c0480003630: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
=>0x0c0480003640: fa fa fd fa fa fa fd fa fa fa[01]fa fa fa fa fa
0x0c0480003650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480003660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480003670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480003680: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480003690: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17167==ABORTING
Found by clang 15.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* m4.include/mc-vfs.m4: use $enable_vfs_sftp to test functions
required for network VFSes. Define ENABLE_VFS_NET preprocessor
macro here...
* lib/vfs/vfs.h: ...not here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Fix location of all user's syntax related stuff. Now it is the
~/.local/share/mc/syntax/ directory.
Don't use the system configuration directory (/etc/mc) as a storage
of syntax definitions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Bodies of mc_search__tolower_case_str() and mc_search__toupper_case_str()
are almost same excluding the case conversion function call:
mc_search__tolower_case_str() calls str_tolower() and
mc_search__toupper_case_str() calls str_toupper.
Move this common body to separate function and call case conversion
function via pointer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
(mc_search_t): use GString to keep original search string. Join search string
and charset to structure.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
../../../lib/widget/input.c:573:8: error: 'event_data.ret' may be used uninitialized [-Werror=maybe-uninitialized]
573 | if (event_data.ret)
| ^
../../../lib/widget/input.c:566:35: note: 'event_data.ret' was declared here
566 | ev_clipboard_text_from_file_t event_data;
Found by gcc-11.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
In quick view panel mode, gzip is used for view zip-files.
Initial commit:
(get_compression_type): use hex values instead of octal ones.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Ticket #2773: 'include' keyword (for command class def) have no effect
if it was defined before 'Include' keyword (for command def).
Ticket #3742: update comment in mc.ext.ini.
doc: remove mc.ext.ini format description from manual page.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (mcview_growbuf_read_until): the previous call to mcview_show_error()
invalidates sp by freeing view->ds_stdio_pipe. Reintroduce the check
that was removed in a68f2d1202 but take
sp's invalidity into account.
* (mc_pclose): add a NULL pointer check to play safe.
Signed-off-by: Michael Schuster <michael@schuster.ms>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
In order to use multiline search, select "Regular expression" mode and
use "\n" in the input line:
For example, if file contains lines
aaa
bbb
search string should be "aaa\nbbb".
As a side effect, non-printable ASCII symbols (\r, \t, etc) in the
search string can be used too.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Use it instead of direct access to WInput's buffer.
(handle_cmdline_enter): additional minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (input_get_text): never return NULL. If buffer is empty, return an
empty allocated string.
* (input_push_history): use new input_get_text.
* (find_parameters): likewise.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
If dialog should be placed too high (in the upper half of the screen
closer to the screen top), show it centered.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Remove E_NOTSUPP define. Use ENOTSUP directly where required.
(vfs_clone_file): use ENOTSUP instead of EOPNOTSUPP.
(mc_open): likewize. Fix sign.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
...to pass given WRect object directly to widget callback withowt
constuction/deconstuction of intermediate WRect object.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Rename to input_push_history().
Use input's buffer.
Don't duplicate an empty string, use current one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
filevercmp: don't treat entire filename as suffix.
Sync with gnulib 1ba2b66ea45f9bc43cdc0f6f93efa59157d2b2ba.
(file_prefixlen): When stripping (\.[A-Za-z~][A-Za-z0-9~]*)*$ suffixes,
do not strip the entire file name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
mc_search_struct: add new member prepared.result to keep the result of
the mc_search_prepare() first call. It can be used to check a regexp
before call of mc_search_run() in a loop.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Sync with gnulib 9f48fb992a3d7e96610c4ce8be969cff2d61a01b.
Problems reported by Michael Debertol in <https://bugs.gnu.org/49239>.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
How to reproduce:
1. Set left panel to list mode.
2. Make left panel active.
3. Change left panel to info mode.
Result: segmentation fault.
(widget_replace): fix search of the next focusable widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
The mc's built-in samba library which is used to access data across
smb links is taken from an old samba version.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Fix out-of-boundary access to gname if it's shorter than 255 bytes.
Found by Coverity.
Coverity id #331844.
Fix macro name that is used for array size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Fix out-of-boundary access to uname if it's shorter than 255 bytes.
Found by Coverity.
Coverity id #331835.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Add two widget callbacks:
* (make_global): convert widget coordinates from local (relative to
owner) to global (screen).
* (make_local): convert widget coordinates from global (screen) to
local (relative to owner).
Such conversions are required when nested widgets and groups are added to
or removed from another groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
lib/widget/group.c: fix -Wcast-qual warnings:
group.c:199:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
^
group.c:231:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
^
group.c:263:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
^
Found by Clang-11.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
foot is a "fast, lightweight and minimalistic Wayland terminal emulator"
(see https://codeberg.org/dnkl/foot). Add its default TERM value to the
recognized ones. This enables mc to change the terminal window title and
handle mouse events.
(tty_check_term): add support of foot terminal emulator as xterm-compatible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Alacritty is a "fast, cross-platform, OpenGL terminal emulator" (see
https://github.com/alacritty/alacritty). Add its default TERM value to
the recognized ones. This enables mc to change window title and handle
mouse events.
(tty_check_term): add support of alacritty terminal as xterm-compatible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
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>
(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>
...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>
(group_default_callback): NULLify list of widgets after destroy.
(dlg_default_callback): do nothing in MSG_INIT and MSG_DESTROY handlers.
(dlg_destroy): send MSG_DESTORY to dialog to allow it destroy it's
private data. MSG_DESTROY is a last message sent to dialog before
desctuction.
(edit_dialog_callback): use MSG_DESTROY instead of MSG_END to deinit
editor.
(midnight_callback): use MSG_DESTROY instead of MSG_DESTORY to deinit
file manager.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Custom .zshrc file is ~/.local/share/mc/.zshrc.
If ZDOTDIR environment variable is not set, set it to ~/.local/share/mc
if a .zshrc is found there. It is the only way to point zsh to an other
rc file than the default.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the original
patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
...because the pointer can't be NULL.
Found by Coverity.
Coverity id #110817.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Save file handle for later close, if valid.
Found by Coverity.
Coverity id #32607.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
In the function vfs_expire(), curr_time and exp_time are declared
guint64. curr_time is initialised with a timestamp and exp_time
with this timestamp minus vfs_timeout seconds. Later there is if
(stamping->time <= exp_time). Prior to commit
a94dd7d2de curr_time was initialised with
a value larger than vfs_timeout seconds, so everything was fine. This
commit changed the initialisation to a timer starting when mc is
started. So for the first vfs_timeout seconds, the result of the
subtraction is negative, but it is a guint64, so we just get a VERY
large unsigned value and the if (stamping->time <= exp_time) is always
true. So mc thinks the vfs hasn't been used recently and goes into an
infinite loop.
If one opens a .rpm file with mc and goes into the CONTENTS.cpio and
then tries to go into the .tar.gz there (this is the usual structure of
a .rpm) after waiting vfs_timeout seconds, everything is fine. However,
before vfs_timeout seconds, mc hangs.
Solution: use g_get_real_time() instead of mc_timer_elapsed().
Thanks nvwarr at hotmail.com for finding out the reason for this bug.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Avoid limitation of file name length.
(vfs_dirent): redefined to use instead of standard "struct direct"
to hold file name of any length.
(vfs_class::readdir): return newly allocated vfs_dirent structure.
Related changes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This bug was introduced in 2e734e5618.
(dlg_handle_key): fallback to dialog_map if shortcut is not defined in
filemanager/editor/viewer/diffviewer key map.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
In Solaris 11.4 SPARC, TIOCSWINSZ is defined in termios.h.
lib/tty/tty.c: add #include <termios.h>, because TIOCSWINSZ is used in
tty_resize().
Thanks Alexander <shurik005@gmail.com> for the fix.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (complete): rename to input_complete() and move declaration to
input.h.
* input_complete.h: remove.
* (input_free_completions): rename to input_complete_free() and move
definition to input_complete.c.
* lib/widget/input_complete.c: rename variables and function from
query_* to complete_*.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
How to reproduce:
Run `mcedit .` from an empty shell. mc used to show an error banner. Now
it shows black-on-black error message.
do_refresh() function expects that at least one fullscreen dialog (file
manager, editor, etc) is existing in the dialog stack. If query dialog
is created before any fullscreen one, do_refresh() do nothing.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>