* m4.include/ax_path_lib_pcre.m4: replace by recent version from GNU
Autoconf Archive.
* m4.include/ax_check_pcre2.m4: get grom GNU Autoconf Archive.
* m4.include/mc-check-search-type.m4: support both PCRE versions.
* */*/Makefile.am: remove @CHECK_CFLAGS@ and @PCRE_LIBS@ ads they are
added via AX_PATH_LIB_PCRE and AX_CHECK_PCRE2.
* lib/search.h, lib/search/: add support of PCRE2. Thanks broly <gagan@hotmail.com>
for the initial patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (simple_status_msg_init_cb): pass NULL instead of "" to label_new()
to get rid of an empty string duplication.
* (advanced_chown_dlg_create): likewise.
* (chown_dlg_create): likewise.
* (dirsize_status_init_cb): likewise.
* (file_op_context_create_ui): likewise.
* (setup_gui): likewise.
* (init_hotlist): likewise.
* (init_learn): likewise.
* (file_progress_show_source): pass NULL instead of "" to
label_set_text() to get rid of an empty string duplication.
* (file_progress_show_target): likewise.
* (create_file_manager): pass NULL instead of 0 to label_new().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Found via `codespell -S
po,doc,./misc/syntax,./src/vfs/extfs/helpers/README.it -L
parm,rouge,sav,ect,vie,te,dum,clen,wee,dynamc,childs,ths,fo,nin,unx,nd,iif,iterm,ser,makrs,wil`
Co-authored-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Kian-Meng Ang <kianmeng@cpan.org>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
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>