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>
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>
We introduce a mechanism by which tests can easily access configure-time
parameters (like @PERL@, @AWK@, ...).
It works by "sourcing" a file named config.sh (residing in the build tree):
. "$MC_TEST_EXTFS_CONFIG_SH"
$PERL -e 'print "hello"'
(Although config.sh has a shell syntax, Perl and Python programs too can
benefit from it, because it can be sourced into an .env_vars file and the
values exported from there.)
Of course, one can also use the traditional method, of *.in files listed in
configure.ac, but the mechanism introduced here is a more comfortable approach.
Signed-off-by: Mooffie <mooffie@gmail.com>
MC truncates timestamps during file copy and drops sub-second precision.
Make use of utimensat(), introduced in Linux kernel 2.6.22 (and since
2.6.26 compatible with POSIX-1.2008).
Signed-off-by: Andrey Gursky <andrey.gursky@e-mail.ua>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
We introduce 'mc_parse_ls_l', a tool for parsing file-listings in format
similar to that of 'ls -l'. This format is used by the various extfs helpers.
We'll use this tool, in the next commit, to build a tester.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
m4.include/stat-size.m4, lib/stat-size.h: get these files from Gnulib.
src/filemanager/ioblksize.h: get this file from Coreutils.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
On systems where 'mode_t' is smaller than 'int', doing 'va_arg (ap, mode_t)' is
wrong because of C's "default argument promotions". GCC 4 creates crashing code
in this case.
The "va_arg" page of Gnulib's manual describes the problem and a simple solution:
https://www.gnu.org/software/gnulib/manual/html_node/va_005farg.html
However, since that solution reportedly (see thread at next link) still causes
GCC to print warnings (for no good reason; perhaps this was fixed in newer
GCCs), we pick a solution that defines a PROMOTED_MODE_T at the configuration
stage:
https://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00231.html
(We take our 'mode_t.m4' from the most recent Gnulib source.)
(If any of the URLs above no longer works, simply search the web for the
mentioned words.)
Macros get from other projects keep their original names:
gl_FSTYPENAME, AX_PATH_LIB_PCRE, etc.
Macros initially writtem for MC have original names with prefix mc_:
mc_VERSION, mc_CHECK_GLIB, etc
Macros get from other projects and modified for MC keep their
original names with prefix mc_:
mc_cu_PREREQ_STAT_PROG, mc_AC_GET_FS_INFO.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Instead of checking for sys/mkdev.h headerfile, there is the
AC_HEADER_MAJOR helper for how to get major(), minor(), makedev().
Sinc with GLib efb1701bf3baf6f5b05fd1a7a5a4ff990a7dc460.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
As we use 'AC_CONFIG_SUBDIRS' macro for samba sources option checking is
disabled for us.
Before the patch:
$ ./configure --with-i-have-misspelled-editor-for-edit
...
# no warnings
The patch enables warnings back only for top-level ./configure:
$ ./configure --with-i-have-misspelled-editor-for-edit
...
configure: WARNING: unrecognized options: --with-i-have-misspelled-editor-for-edit
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Remove tests whose results are not used:
* AC_CHECK_HEADERS of unistd.h, fcntl.h, sys/time.h, sys/types.h
* AC_HEADER_MAJOR
* AC_HEADER_TIME
* AC_HEADER_DIRENT
* AC_CHECK_FUNCS of isascii, statfs, sysconf, tcgetattr, tcsetattr, ftruncate
* AC_FUNC_STRCOLL
AC_C_CONST is obsolete, today it is safe to assume all C compilers
support at least C89.
The INTERACTIVE UNIX that needed AC_ISC_POSIX is long dead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
For upload English hint-file to transifex, type:
cd doc/hints/po && make to-transifex
For download translation from Transifex type:
cd doc/hints/po && make from-transifex && \
git add ../l10n/mc.hints.* && \
git commit -s -m 'Update hints files from Transifex'
WARNING! For the functionality you should have installed 'tx' and 'po4a'
utilities. These utilities isn't required for compile and install mc
(you may install these utilities only if you want to interact with Transifex).
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Fix of exec_prefix expansion and usage.
Some distros use autoconf site scripts resourced via $CONFIG_SITE
environment varaible. That scripts are defined variable libexecdir
as
libexecdir='${exec_prefix}/lib'
In this case, EXTHELPERSDIR variable is generated wrongly, because
the 'exec_prefix' variable isn't expanded.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Due to date formatting, uc1541 extfs plugin is unusable, even tough the date formatting,
which is the one cause of the problem is coherent with the attached documentation (MM-DD-YYYY hh:mm).
Another problem with uc1541 script is connected rather with legal characters used in filename
rather than with script itself - in PET ASCII it is perfectly fine to use slash "/" character
in filenames, and as a side effect all files containing slash inside d64 image are represented
as directories on MC.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
If --prefix is not set in command line, EXTHELPERSDIR was expanded to
NONE/libexec/mc/ext.d in misc/mc.ext and misc/ext.d/Makefile.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
src/filemanager/filegui.c does not compile on Solaris due to missing macros.
AVE_STRUCT_STATVFS_F_BASETYPE and HAVE_STRUCT_STATVFS_F_FSTYPENAME macros
are not set or even defined in config.h. configure scrips does not even
check for those members.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
What steps will reproduce the problem?
* View some text (log) file (F3), or edit (F4).
* Open search dialog (F7).
* Enter string starting with space and ending with space (I used " ERROR " without quotes), press Enter
* Press F7 to open search dialog again.
What is the expected output?
* Original string in search dialog (" ERROR " without quotes)
What do you see instead?
* "ERROR " (without leading space!)
What solution?
* In function mc_config_set_string_raw() use g_key_file_set_string() instead of g_key_file_set_value()
* change src/learn.c for handle new behavior
* write some tests for new behavior
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Don't install man pages, help and hint files if mc is built with
--disable-nls key.
Thanks Max Khon <fjoe samodelkin net> for the original patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* moved from lib/vfs/mc-vfs to lib/vfs;
* split by directories for VFS-plugins and moved to src/vfs;
* lib/vfs/vfs-impl.h was merged into lib/vfs/vfs.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Example:
gboolean mkdir_callback(const gchar *event_group, const gchar *event_name, gpointer init_data, gpointer event_data)
{
... /* some action for handle event */
return TRUE; /* got chance to run other callbacks for this event or */
return FALSE; /* break execution for other callbacks */
}
mc_event_add ("filesystem", "mkdir", mkdir_callback, "some init data", NULL);
mc_event_add ("filesystem", "mkdir", mkdir_log_callback, "some init data", NULL);
mc_event_add ("filesystem", "mkdir", third_callback, NULL, NULL);
/*
Last add - first run. In this case execution order is
* third_callback
* mkdir_log_callback
* mkdir_callback
if third_callback fuctions will return FALSE, then other callbacks
(mkdir_log_callback and mkdir_callback) never run!
*/
... /* some code */
/* for example, after pressing F7 */
mc_event_raise("filesystem", "mkdir", "some event_data... path to directory");
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
added rules for misc/macros.d/*. in the process of installation, example scripts will be copied into share/mc/examples/macros.d
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Don't mix GLib and GModule compiler and linker options.
Use gmodule-no-export if present to avoid use -Wl,--export-dynamic
option with some linkers. If gmodule-no-export is not available,
use generic gmodule.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Currently the date and the version of Midnight Commander in the man
pages has to be changed manually every release. This is being done
sporadically and as the result, the man pages shipped for e.g. 4.7.2
release contain the 4.7.0-pre1 signature, which is quite confusing.
With this patch, the version is substituted with @DISTR_VERSION@ for all
the man pages and the date is automatically updated to the English man
pages. Other man pages still have the manually updated date of the last
translation.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Removed mcserver and mcfs support.
Reasons:
(1) no longer builds
(2) no one is willing to support it
(3) possibly contains unfixed security holes
(4) makes no sense in view of the availability of FISH
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* split m4.include/mc-with-screen.m4 file in two files: mc-with-screen-slang.m4 and mc-with-screen.m4
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
We have several AC_TRY_RUN's in the configure/m4 stuff,
which obviously breaks crosscompiling.
This changeset contain fixies for S-Lang library. First try to search
library via 'pkg-config slang' and then try to go in old search way.
Macro AC_TRY_RUN() now replaced by AC_RUN_IFELSE()
Also, next changes was made:
* Removed AC_TRY_RUN() from gmodule checking code.
* More accuracy in grepping of SLANG_VERSION defined constant
* avoid autoconf error 'suspicious presence of an AC_DEFINE in the second argument, where no actions should be taken'
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
The man2hlp program is build using the target compiler. The
resulting executable therefore does not work on the build host.
Since the man2hlp program is needed during compile time, the build
will fail.
Moved man2hlp into separate subdir
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
added src/diffviewer/ydiff.[ch] into project tree
added entry 'View diff files' into 'Command' menu
added 'diffviewer' color pairs
fixed Makefile and configure.am
added new binding CmdDiffView into '[main]' section
Big thanx to 'Daniel Borca <dborca@yahoo.com>' for ydiff
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Added diffviewer own library
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Fixed CFLAGS for diffviewer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
changed skins, added section
[diffviewer]
added=
changedline=
changednew=
changed=
removed=
folder=
error=
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Reimplementation of hardcoded shortcuts to keybindings.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>