Commit Graph

260 Commits

Author SHA1 Message Date
Yury V. Zaytsev
1e0e6b5e1e charset: rename IBM866 to CP866 for iconv and adjust charset names for codeset
```
linux $ iconv -l | grep 866
866//
866NAV//
CP866//
CP866NAV//
CSIBM866//
IBM866//
IBM866NAV//

solaris $ iconv -l | grep 866
    CP866 (CP866, CP-866, CP_866, 866),
    IBM-866,

macos % iconv -l | grep 866
CP866 866 CSIBM866 IBM866 MSCP866

musl/src/locale/codepages.h: "cp866\0"
```

On glibc-based systems, codeset will be set to charmap name, on most other systems it seems to be taken from locale name.

## Linux

```
zaytsev@fedora:~$ locale -a | grep ru
ru_RU
ru_RU.cp866
ru_RU.ibm866
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
russian
ru_UA
ru_UA.koi8u
ru_UA.utf8

zaytsev@fedora:~/src$ LC_ALL=ru_RU.cp866 LANG=ru_RU.cp866 ./a.out
IBM866

zaytsev@fedora:~/src$ LC_ALL=ru_RU.koi8r LANG=ru_RU.koi8r ./a.out
KOI8-R

zaytsev@fedora:~/src$ LC_ALL=ru_RU.iso88595 LANG=ru_RU.iso88595 ./a.out
ISO-8859-5
```

## macOS

```
ru_RU.ISO8859-5
ru_RU.CP866
ru_RU.CP1251
ru_RU.UTF-8
ru_RU.KOI8-R
ru_RU

zaytsev@Yurys-MBP mc % LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out
CP866

zaytsev@Yurys-MBP mc % LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out
ISO8859-5
```

## FreeBSD

```
ru_RU.CP1251
ru_RU.CP866
ru_RU.ISO8859-5
ru_RU.KOI8-R
ru_RU.UTF-8

zaytsev@cfarm240:~ $ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out
ISO8859-5

zaytsev@cfarm240:~ $ LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out
CP866
```

## Solaris

```
ru
ru.UTF-8
ru.koi8-r
ru_RU
ru_RU.ANSI1251
ru_RU.ISO8859-5
ru_RU.KOI8-R
ru_RU.UTF-8

zaytsev@gcc-solaris10:~/src$ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.o>
ISO8859-5

zaytsev@gcc-solaris10:~/src$ LANG=ru.koi8-r LC_ALL=ru.koi8-r ./a.out
KOI8-R
```

## AIX

```
zaytsev@gcc111:[/home/zaytsev]locale -a
C
POSIX
en_US.8859-15
en_US.IBM-858
en_US.ISO8859-1
en_US

-bash-5.1$ LANG=en_US.ISO8859-1 LC_ALL=en_US.ISO8859-1 ./a.out
ISO8859-1
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
5b335920aa Ticket #3960: remove mmap support in file comparison
It's not working on AIX, but more importantly doesn't offer any benefits in
terms of speed, and we have a fallback anyways.

https://lists.gnu.org/archive/html/autoconf/2024-07/msg00006.html

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-30 21:11:21 +02:00
Yury V. Zaytsev
87a76294c4 buildsys: fix ar check by doing it before toolchain checks implicitly looking for ar
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
eb1375b65d vfs: implement support for all known stat formats and centralize handling
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
482025a286 buildsys: prefer gnu indent (gindent) to bsd indent if available
BSD indent does not have `--gnu-style` flag ;-)

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
6ca4ab4b4e Rename FISH VFS to SHELL one. 2023-10-15 16:04:39 +03:00
Evgeny Grin
68e6d960f8 Replaced unportable 'inplace' sed command
'-i' sed option is not portable, not specified by POSIX and does not
work on same platforms.
Replaced with simple and obvious workarounds.

Closes MidnightCommander/mc#184.

Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-20 19:57:23 +03:00
Evgeny Grin
f45d02ba2a Use configure detected or user specified sed in build system
Sometimes system default sed is not the best option.
With this modification user may easily override sed used by build system
without editing any file.

Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-20 19:56:53 +03:00
Evgeny Grin
054a051b42 Ticket #4459: usage of 'sed' in build system/makefiles is not portable.
configure: add explicit sed detection

Actually SED variable is set automatically by LT_INIT currently.
Having explicit check should help avoiding problems if/when LT_INIT
changed.

Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-20 19:56:32 +03:00
Andrew Borodin
78a25f7800 Ticket #1952: tar: support long file names in archive.
Initial changeset: tar.c: update code to be close to GNU tar.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:49:41 +03:00
Kian-Meng Ang
5001232704 Fix various typos in the source code (closes MidnightCommander/mc#177).
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>
2023-01-28 21:38:05 +03:00
Andrew Borodin
cea7d35209 Ticket #4320: syntax/Syntax: document location of syntax files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-12-18 14:26:30 +03:00
Sergei Trofimovich
8318e3172d Ticket #4400: fix --enable-configure-args description.
Before the change the description said:

    Handle all compiler warnings as errors

Looks like a leftover from --enable-werror copy.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
d9eeec9a5a Port mc.ext to INI format.
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>
2022-09-25 14:55:00 +03:00
Sergei Trofimovich
6b67d231a2 Ticket #4399: configure.ac: introduce PERL_FOR_BUILD
Most of mc uses of PERL is to embed path to the interpreter in VFS
helpers. There we can use path to perl for --host. But
`date-of-man-include.am` is the place where perl is used for --build.

On most systems both paths are expected to be /usr/bin/perl.
But on some systems paths might differ a bit. Most prominent
example is NixOS, where packages get installed into unique prefixes:

$ file /nix/store/...-perl-5.36.0/bin/perl \
       /nix/store/...-perl-powerpc64-unknown-linux-gnu-5.36.0/bin/perl
/nix/store/...-perl-5.36.0/bin/perl:
  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), ...
/nix/store/...-perl-powerpc64-unknown-linux-gnu-5.36.0/bin/perl:
  ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, ...

This allows running both binaries via qemu-user if needed for tests.

The change introduces PERL_FOR_BUILD (similar to autoconf's CC_FOR_BUILD
and friends) to allow passing both PERLs when needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-20 08:26:24 +03:00
Andrew Borodin
debabe561a "file" utility: use -b option if available.
* configure.ac: test if "file" utility has -b option.
  * (regex_check_type): don't compare file names if "file -b" is used.
Reduce variable scope. Rename variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 20:03:47 +03:00
Andreas Mohr
1bc8abd79f configure.ac: replace obsolete AC_PROG_CC_STDC macro.
Since release 2.70 of GNU Autoconf

> *** AC_PROG_CC_STDC, AC_PROG_CC_C89, AC_PROG_CC_C99 are now obsolete.
>  Applications should use AC_PROG_CC.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
ccbac47385 Remove get_process_stats() test.
The GLib API is used for measurement of time intervals.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
62d2580302 Reimplement compiler options checking. 2021-11-21 15:00:39 +03:00
Andrew Borodin
89d8fa4ac1 Ticket #1: remove SMB suport.
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>
2021-09-26 10:03:49 +03:00
Andrew Borodin
6a4107b277 Ticket #4266: fix AC_INIT call for automake >= 1.16.4.
FTBFS with following messages:

autoreconf: running: aclocal -I m4 --force -I m4
configure.ac:31: error: AC_INIT should be called with package and version arguments
/usr/local/Cellar/automake/1.16.4/share/aclocal-1.16/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:31: the top level
autom4te: error: /usr/local/opt/m4/bin/m4 failed with exit status: 1
aclocal: error: /usr/local/Cellar/autoconf/2.71/bin/autom4te failed with exit status: 1
autoreconf: error: aclocal failed with exit status: 1

Initial changeset: partial revert of 32621b96d1.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-07 20:29:05 +03:00
Andrew Borodin
791acb4611 Ticket #4249: Autoreconf is failing with tarball prepared by make dist.
version.sh: move from maint/utils to the root of the source tree
and make it a part of distributable tarball.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-26 21:56:27 +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
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
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
6cc697beff Add test for new ftp parser.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:02:12 +03:00
Andrew Borodin
1ed638d66c Ticket #4180: fix zip handling.
After 8857423e4e zip archives opened with
an error:

    file -L -z archive.zip: Bad system call

This caused by using /usr/bin/file with -z option, because seccomp (a
security sandbox) doesn't allow it..

Solution: use -S option together with -z one.

The file command accepts the -S option since 5.33.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-28 16:39:21 +03:00
Andrew Borodin
285eb5c186 Ticket #3682: drop automatic migration of configuration
...from ~/.mc to XDG-base.

Now MC ignores ~/.mc directory and uses XDG-based only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-22 21:16:52 +03:00
Ilia Maslakov
954e83191c Ticket #4130: add PAK archive support for extfs.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-08 17:36:36 +03:00
Vadim Kalinnikov
942c5549c9 Ticket #4100: extfs vfs: support of WIM archive (image).
wimtools (https://wimlib.net/) are required.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-29 16:58:36 +03:00
Andrew Borodin
e14d44c839 Ticket #3847: chattr command implementattion.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-05 19:06:18 +03:00
Joshua Watt
d009ea7b8b Ticket #4031: add option to control configure args.
Embedding the configure time options into the executable can lead to
non-reproducible builds, since configure options often have embedded
paths. Add a configure time option to control if the configure args are
embedded so this can be disabled.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-11-10 16:24:22 +03:00
Sergei Trofimovich
f30e6ff283 Ticket #3629: configure.ac: drop bundled gettext
Bundled libintl did not support linking to internal static
libraries (libmc in our case): directly specified static
libraries are not pulled by libtool and are not usable for
dynamic libraries as PIC-related flags are not passed for
compilation.

This renders bundled libintl library unusable.

The change drops libintl bundling support and always relies
on external libintl (or falls back to disabled NLS).

On a related note gettext-0.20 drops support for bundling
or libintl and this change will ease migration to newer version.

The change is tested on x86_64-gentoo-linux-musl: mc builds
and links all tests successfully. A few tests fail for lack
of NLS support.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-22 13:10:46 +03:00
Andrew Borodin
dc46dc0009 Ticket #3936: update uc1541 extfs
...from https://github.com/gryf/uc1541.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-21 19:54:54 +03:00
Andrew Borodin
76a5f70f5b Ticket #3992: improve support of Windows 1251 encoding on Solaris.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-07-13 08:58:27 +03:00
Andrew Borodin
dc999a23eb (mc_AC_GET_FS_INFO): rename to mc_GET_FS_INFO...
since it is not from Autoconf.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:01 +03:00
Andreas Mohr
ee013b383f configure.c: fix AX_GCC_FUNC_ATTRIBUTE detection on custom CFLAGS
AX_GCC_FUNC_ATTRIBUTE detect attribute feature by compiler warnings.
Custom or unrecognized CFLAGS can causes extra warnings so attribute
check failed.

Reset CFLAGS and restore after AX_GCC_FUNC_ATTRIBUTE call.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:01 +03:00
Andreas Mohr
8788ff7010 autoconf: AC_PROG_LIBTOOL is obsolete, use LT_INIT instead.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:47:59 +03:00
Andrew Borodin
56320a3314 Ticket 3960: fix compilation fail on AIX 7.2.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-01-19 19:08:01 +03:00
Andrew Borodin
3909ef1bc5 m4.include: move Gnulib modules to their own subdirectory.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Jesse R. Gorzinski
4da6ea8db3 (feed_subshell): on IBM i, read(1) can return 0 for a non-closed fd.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 18:57:56 +03:00
Jesse R. Gorzinski
79e5cdad2f configure.ac: check of Perl, Pyhton and Ruby on IBM i.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 18:57:56 +03:00
Jesse R. Gorzinski
a45337672b Ticket #3927: fix compilation failure on IBM i.
Don't use utimensat() on IBM i due to different timespec structures.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 18:57:56 +03:00
Andrew Borodin
2e5cd866f9 Check linux/fs.h file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-03 09:44:42 +03:00
Andrew Borodin
73979369d1 Support __attribute__((fallthrough)) if possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
fcf5ba5be2 Ticket #3857: avoid glibc 2.25 warnings about major(), minor(), and makedev().
See gnulib a512e041120e9012e69afa2f5c3adc196ec4999a:

glibc 2.25 is deprecating the namespace pollution of <sys/types.h>
injecting major(), minor(), and makedev() into the compilation
environment, with a warning that insists that users include
<sys/sysmacros.h> instead.  However, because the expansion of
AC_HEADER_MAJOR didn't bother checking sys/sysmacros.h until after
probing whether sys/types.h pollutes the namespace, it was not defining
MAJOR_IN_SYSMACROS, with the result that code compiled with -Werror
chokes on the deprecation warnings because it was not including
sysmacros.h.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-20 10:57:42 +03:00
Yury V. Zaytsev
9932087cec Ticket #3836: maint - set default --with-homedir value to .mc instead of yes
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Reviewed-by: Andrew Borodin <aborodin@vmail.ru>
2017-07-15 22:52:47 +02:00
Andrey Gursky
243cdc1755 Ticket #3821: initialize struct stat st_[acm]tim.tv_nsec when present
struct stat in libc for Linux kernel contains few fields more since 14+
years [1]. From bits/stat.h:

```
        struct timespec st_atim;		/* Time of last access.  */
        struct timespec st_mtim;		/* Time of last modification.  */
        struct timespec st_ctim;		/* Time of last status change.  */
    # define st_atime st_atim.tv_sec	/* Backward compatibility.  */
    # define st_mtime st_mtim.tv_sec
    # define st_ctime st_ctim.tv_sec
```

The conventional fields became an alias.

POSIX.1-2008 made struct stat st_[acm]tim mandatory [2].

OS takes care to initialize struct stat properly [3]. By not using an OS
syscall or a libc wrapper to fill struct stat, we have to take care of
initializing all fields (or at least those being used later) explicitly.

[1]: https://www.sourceware.org/ml/libc-alpha/2002-12/msg00011.html
[2]: https://www.sourceware.org/ml/libc-alpha/2009-11/msg00102.html
[3]: https://www.sourceware.org/ml/libc-alpha/2002-12/msg00013.html

Fixes: file timestamps not preserved (https://mail.gnome.org/archives/mc-devel/2017-April/msg00000.html)
Reported-By: Nerijus Baliunas <nerijus@users.sourceforge.net>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Mooffie
e3cef7576b extfs: rpm: introduce the rpm2tags tool.
This is a preliminary step before being able to write tests for our rpm helper.

We introduce 'rpm2tags', a tool for converting RPM packages to parsable text
files. This will enable us to write tests that can run even where the 'rpm'
program isn't installed.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00