Merge branch '4584_tests_weak_symbols'

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Yury V. Zaytsev 2024-10-19 09:01:19 +02:00
commit 65fee2daf7
56 changed files with 251 additions and 197 deletions

View File

@ -65,6 +65,7 @@ dnl which causes attribute checks to fail
ax_gcc_func_attribute_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS=
AX_GCC_FUNC_ATTRIBUTE([fallthrough])
AX_GCC_FUNC_ATTRIBUTE([weak])
_AC_LANG_PREFIX[]FLAGS=$ax_gcc_func_attribute_save_flags
unset ax_gcc_func_attribute_save_flags

View File

@ -8,6 +8,13 @@
#define MC_GLOBAL_H
#include <glib.h>
#if defined(HAVE_FUNC_ATTRIBUTE_WEAK) && defined(HAVE_TESTS)
#define MC_MOCKABLE __attribute__((weak))
#else
#define MC_MOCKABLE
#endif
#include "glibcompat.h"
#include "unixcompat.h"

View File

@ -53,8 +53,8 @@ gchar **mc_config_get_keys (const mc_config_t * mc_config, const gchar * group,
gchar *mc_config_get_string (mc_config_t * mc_config, const gchar * group, const gchar * param,
const gchar * def);
gchar *mc_config_get_string_raw (mc_config_t * mc_config, const gchar * group, const gchar * param,
const gchar * def);
MC_MOCKABLE gchar *mc_config_get_string_raw (mc_config_t * mc_config, const gchar * group,
const gchar * param, const gchar * def);
gboolean mc_config_get_bool (mc_config_t * mc_config, const gchar * group, const gchar * param,
gboolean def);
int mc_config_get_int (mc_config_t * mc_config, const gchar * group, const gchar * param, int def);
@ -96,7 +96,7 @@ void mc_config_deinit_config_paths (void);
const char *mc_config_get_data_path (void);
const char *mc_config_get_cache_path (void);
const char *mc_config_get_home_dir (void);
MC_MOCKABLE const char *mc_config_get_home_dir (void);
const char *mc_config_get_path (void);
char *mc_config_get_full_path (const char *config_name);
vfs_path_t *mc_config_get_full_vpath (const char *config_name);

View File

@ -41,6 +41,7 @@
#include "lib/global.h"
#include "lib/strutil.h" /* str_term_form */
#include "lib/util.h"
#ifndef WANT_TERM_H
#define WANT_TERM_H
@ -102,7 +103,7 @@ tty_setup_sigwinch (void (*handler) (int))
#ifdef SA_RESTART
act.sa_flags = SA_RESTART;
#endif /* SA_RESTART */
sigaction (SIGWINCH, &act, &oact);
my_sigaction (SIGWINCH, &act, &oact);
#endif /* SIGWINCH */
tty_create_winch_pipe ();

View File

@ -53,6 +53,7 @@
#include "lib/global.h"
#include "lib/strutil.h"
#include "lib/util.h"
#include "tty.h"
#include "tty-internal.h"
@ -146,7 +147,7 @@ tty_start_interrupt_key (void)
#ifdef SA_RESTART
act.sa_flags = SA_RESTART;
#endif /* SA_RESTART */
sigaction (SIGINT, &act, NULL);
my_sigaction (SIGINT, &act, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -159,7 +160,7 @@ tty_enable_interrupt_key (void)
memset (&act, 0, sizeof (act));
act.sa_handler = sigintr_handler;
sigemptyset (&act.sa_mask);
sigaction (SIGINT, &act, NULL);
my_sigaction (SIGINT, &act, NULL);
got_interrupt = 0;
}
@ -173,7 +174,7 @@ tty_disable_interrupt_key (void)
memset (&act, 0, sizeof (act));
act.sa_handler = SIG_IGN;
sigemptyset (&act.sa_mask);
sigaction (SIGINT, &act, NULL);
my_sigaction (SIGINT, &act, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -126,6 +126,11 @@ typedef struct
mc_pipe_stream_t err;
} mc_pipe_t;
/* sighandler_t is GNU extension */
#ifndef HAVE_SIGHANDLER_T
typedef void (*sighandler_t) (int);
#endif
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
@ -200,6 +205,13 @@ const char *get_owner (uid_t uid);
/* Returns a copy of *s until a \n is found and is below top */
const char *extract_line (const char *s, const char *top, size_t *len);
/* System call wrappers */
MC_MOCKABLE sighandler_t my_signal (int signum, sighandler_t handler);
MC_MOCKABLE int my_sigaction (int signum, const struct sigaction *act, struct sigaction *oldact);
MC_MOCKABLE pid_t my_fork (void);
MC_MOCKABLE int my_execvp (const char *file, char *const argv[]);
MC_MOCKABLE char *my_get_current_dir (void);
/* Process spawning */
int my_system (int flags, const char *shell, const char *command);
int my_systeml (int flags, const char *shell, ...);
@ -212,7 +224,7 @@ void mc_pclose (mc_pipe_t * p, GError ** error);
GString *mc_pstream_get_string (mc_pipe_stream_t * ps);
void my_exit (int status);
MC_MOCKABLE void my_exit (int status);
void save_stop_handler (void);
/* Tilde expansion */
@ -249,7 +261,7 @@ gboolean mc_util_make_backup_if_possible (const char *file_name, const char *bac
gboolean mc_util_restore_from_backup_if_possible (const char *file_name, const char *backup_suffix);
gboolean mc_util_unlink_backup_if_possible (const char *file_name, const char *backup_suffix);
char *guess_message_value (void);
MC_MOCKABLE char *guess_message_value (void);
char *mc_build_filename (const char *first_element, ...);
char *mc_build_filenamev (const char *first_element, va_list args);

View File

@ -137,11 +137,11 @@ i_cache_add (int id, int_cache *cache, int size, char *text, int *last)
/* --------------------------------------------------------------------------------------------- */
static my_fork_state_t
my_fork (void)
my_fork_state (void)
{
pid_t pid;
pid = fork ();
pid = my_fork ();
if (pid < 0)
{
@ -175,12 +175,12 @@ my_system__save_sigaction_handlers (my_system_sigactions_t *sigactions)
ignore.sa_handler = SIG_IGN;
sigemptyset (&ignore.sa_mask);
sigaction (SIGINT, &ignore, &sigactions->intr);
sigaction (SIGQUIT, &ignore, &sigactions->quit);
my_sigaction (SIGINT, &ignore, &sigactions->intr);
my_sigaction (SIGQUIT, &ignore, &sigactions->quit);
/* Restore the original SIGTSTP handler, we don't want ncurses' */
/* handler messing the screen after the SIGCONT */
sigaction (SIGTSTP, &startup_handler, &sigactions->stop);
my_sigaction (SIGTSTP, &startup_handler, &sigactions->stop);
}
/* --------------------------------------------------------------------------------------------- */
@ -188,9 +188,9 @@ my_system__save_sigaction_handlers (my_system_sigactions_t *sigactions)
static void
my_system__restore_sigaction_handlers (my_system_sigactions_t *sigactions)
{
sigaction (SIGINT, &sigactions->intr, NULL);
sigaction (SIGQUIT, &sigactions->quit, NULL);
sigaction (SIGTSTP, &sigactions->stop, NULL);
my_sigaction (SIGINT, &sigactions->intr, NULL);
my_sigaction (SIGQUIT, &sigactions->quit, NULL);
my_sigaction (SIGTSTP, &sigactions->stop, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -329,7 +329,7 @@ get_group (gid_t gid)
void
save_stop_handler (void)
{
sigaction (SIGTSTP, NULL, &startup_handler);
my_sigaction (SIGTSTP, NULL, &startup_handler);
}
/* --------------------------------------------------------------------------------------------- */
@ -348,6 +348,61 @@ my_exit (int status)
_exit (status);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Wrapper for signal() system call.
*/
sighandler_t
my_signal (int signum, sighandler_t handler)
{
return signal (signum, handler);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Wrapper for sigaction() system call.
*/
int
my_sigaction (int signum, const struct sigaction *act, struct sigaction *oldact)
{
return sigaction (signum, act, oldact);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Wrapper for fork() system call.
*/
pid_t
my_fork (void)
{
return fork ();
}
/* --------------------------------------------------------------------------------------------- */
/**
* Wrapper for execvp() system call.
*/
int
my_execvp (const char *file, char *const argv[])
{
return execvp (file, argv);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Wrapper for g_get_current_dir() library function.
*/
char *
my_get_current_dir (void)
{
return g_get_current_dir ();
}
/* --------------------------------------------------------------------------------------------- */
/**
* Call external programs.
@ -422,7 +477,7 @@ my_systemv (const char *command, char *const argv[])
my_system__save_sigaction_handlers (&sigactions);
fork_state = my_fork ();
fork_state = my_fork_state ();
switch (fork_state)
{
case FORK_ERROR:
@ -430,12 +485,12 @@ my_systemv (const char *command, char *const argv[])
break;
case FORK_CHILD:
{
signal (SIGINT, SIG_DFL);
signal (SIGQUIT, SIG_DFL);
signal (SIGTSTP, SIG_DFL);
signal (SIGCHLD, SIG_DFL);
my_signal (SIGINT, SIG_DFL);
my_signal (SIGQUIT, SIG_DFL);
my_signal (SIGTSTP, SIG_DFL);
my_signal (SIGCHLD, SIG_DFL);
execvp (command, argv);
my_execvp (command, argv);
my_exit (127); /* Exec error */
}
MC_FALLTHROUGH;
@ -1056,7 +1111,7 @@ mc_realpath (const char *path, char *resolved_path)
/* If it's a relative pathname use getwd for starters. */
if (!IS_PATH_SEP (*path))
{
new_path = g_get_current_dir ();
new_path = my_get_current_dir ();
if (new_path == NULL)
strcpy (got_path, "");
else

View File

@ -32,6 +32,7 @@
#include <string.h> /* memset() */
#include "lib/global.h"
#include "lib/util.h"
#include "netutil.h"
@ -75,7 +76,7 @@ tcp_init (void)
memset (&sa, 0, sizeof (sa));
sa.sa_handler = sig_pipe;
sigemptyset (&sa.sa_mask);
sigaction (SIGPIPE, &sa, NULL);
my_sigaction (SIGPIPE, &sa, NULL);
initialized = TRUE;
}

View File

@ -43,7 +43,7 @@ vfs_path_element_t *vfs_url_split (const char *path, int default_port, vfs_url_f
int vfs_split_text (char *p);
int vfs_mkstemps (vfs_path_t ** pname_vpath, const char *prefix, const char *basename);
void vfs_die (const char *msg);
MC_MOCKABLE void vfs_die (const char *msg);
char *vfs_get_password (const char *msg);
char *vfs_get_local_username (void);

View File

@ -77,10 +77,10 @@ extern vfs_class *current_vfs;
/*** global variables ****************************************************************************/
struct vfs_dirent *mc_readdir_result = NULL;
GPtrArray *vfs__classes_list = NULL;
GString *vfs_str_buffer = NULL;
vfs_class *current_vfs = NULL;
MC_MOCKABLE struct vfs_dirent *mc_readdir_result = NULL;
MC_MOCKABLE GPtrArray *vfs__classes_list = NULL;
MC_MOCKABLE GString *vfs_str_buffer = NULL;
MC_MOCKABLE vfs_class *current_vfs = NULL;
/*** file scope macro definitions ****************************************************************/
@ -638,7 +638,7 @@ vfs_setup_cwd (void)
if (vfs_get_raw_current_dir () == NULL)
{
current_dir = g_get_current_dir ();
current_dir = my_get_current_dir ();
vfs_set_raw_current_dir (vfs_path_from_str (current_dir));
g_free (current_dir);
@ -657,7 +657,7 @@ vfs_setup_cwd (void)
me = vfs_path_get_last_path_vfs (vfs_get_raw_current_dir ());
if ((me->flags & VFSF_LOCAL) != 0)
{
current_dir = g_get_current_dir ();
current_dir = my_get_current_dir ();
tmp_vpath = vfs_path_from_str (current_dir);
g_free (current_dir);

View File

@ -264,7 +264,7 @@ const vfs_path_t *vfs_get_raw_current_dir (void);
void vfs_set_raw_current_dir (const vfs_path_t * vpath);
gboolean vfs_current_is_local (void);
gboolean vfs_file_is_local (const vfs_path_t * vpath);
MC_MOCKABLE gboolean vfs_file_is_local (const vfs_path_t * vpath);
char *vfs_strip_suffix_from_filename (const char *filename);
@ -318,13 +318,13 @@ off_t mc_lseek (int fd, off_t offset, int whence);
DIR *mc_opendir (const vfs_path_t * vpath);
struct vfs_dirent *mc_readdir (DIR * dirp);
int mc_closedir (DIR * dir);
int mc_stat (const vfs_path_t * vpath, struct stat *buf);
MC_MOCKABLE int mc_stat (const vfs_path_t * vpath, struct stat *buf);
int mc_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev);
int mc_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
int mc_mkdir (const vfs_path_t * vpath, mode_t mode);
int mc_rmdir (const vfs_path_t * vpath);
int mc_fstat (int fd, struct stat *buf);
int mc_lstat (const vfs_path_t * vpath, struct stat *buf);
MC_MOCKABLE int mc_lstat (const vfs_path_t * vpath, struct stat *buf);
int mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
int mc_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
int mc_chmod (const vfs_path_t * vpath, mode_t mode);
@ -336,9 +336,9 @@ int mc_unlink (const vfs_path_t * vpath);
int mc_ctl (int fd, int ctlop, void *arg);
int mc_setctl (const vfs_path_t * vpath, int ctlop, void *arg);
int mc_open (const vfs_path_t * vpath, int flags, ...);
vfs_path_t *mc_getlocalcopy (const vfs_path_t * pathname_vpath);
int mc_ungetlocalcopy (const vfs_path_t * pathname_vpath, const vfs_path_t * local_vpath,
gboolean has_changed);
MC_MOCKABLE vfs_path_t *mc_getlocalcopy (const vfs_path_t * pathname_vpath);
MC_MOCKABLE int mc_ungetlocalcopy (const vfs_path_t * pathname_vpath,
const vfs_path_t * local_vpath, gboolean has_changed);
int mc_mkstemps (vfs_path_t ** pname_vpath, const char *prefix, const char *suffix);
/* Creating temporary files safely */

View File

@ -36,7 +36,7 @@ void dialog_switch_shutdown (void);
void do_refresh (void);
void repaint_screen (void);
void mc_refresh (void);
MC_MOCKABLE void mc_refresh (void);
void dialog_change_screen_size (void);
/*** inline functions ****************************************************************************/

View File

@ -87,7 +87,8 @@ typedef struct
/*** forward declarations (file scope functions) *************************************************/
GPtrArray *try_complete (char *text, int *lc_start, int *lc_end, input_complete_t flags);
MC_MOCKABLE GPtrArray *try_complete (char *text, int *lc_start, int *lc_end,
input_complete_t flags);
void complete_engine_fill_completions (WInput * in);
/*** file scope variables ************************************************************************/

View File

@ -80,7 +80,7 @@ WDialog *create_message (int flags, const char *title, const char *text, ...)
G_GNUC_PRINTF (3, 4);
/* Show message box, background safe */
void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4);
MC_MOCKABLE void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4);
/* *INDENT-ON* */
gboolean mc_error_message (GError ** mcerror, int *code);

View File

@ -41,22 +41,11 @@ AC_DEFUN([mc_UNIT_TESTS],[
AC_SUBST(CHECK_LIBS)
fi
AM_CONDITIONAL(HAVE_TESTS, test x"$have_check" = "xyes")
AS_IF([test x"$have_check" = "xyes"], [AC_DEFINE([HAVE_TESTS], [1], [Build with unit tests.])])
dnl sighandler_t is GNU extension
dnl AC_USE_SYSTEM_EXTENSIONS is required
AC_CHECK_TYPES([sighandler_t], [], [], [
#include <signal.h>
])
# on cygwin, the linker does not accept the "-z" option
case $host_os in
cygwin*)
TESTS_LDFLAGS="-Wl,--allow-multiple-definition"
;;
*)
TESTS_LDFLAGS="-Wl,-z,muldefs"
;;
esac
AC_SUBST(TESTS_LDFLAGS)
])

View File

@ -49,6 +49,7 @@
#include "lib/tty/key.h" /* add_select_channel(), delete_select_channel() */
#include "lib/widget.h" /* message() */
#include "lib/event-types.h"
#include "lib/util.h" /* my_fork() */
#include "filemanager/fileopctx.h" /* file_op_context_t */
@ -535,7 +536,7 @@ do_background (file_op_context_t *ctx, char *info)
return (-1);
}
pid = fork ();
pid = my_fork ();
if (pid == -1)
{
int saved_errno = errno;

View File

@ -154,7 +154,7 @@ handle_console_linux (console_action_t action)
break;
}
/* Get the console saver running */
cons_saver_pid = fork ();
cons_saver_pid = my_fork ();
if (cons_saver_pid < 0)
{
/* Cannot fork */

View File

@ -228,9 +228,9 @@ void edit_paste_from_history (WEdit * edit);
void edit_set_filename (WEdit * edit, const vfs_path_t * name_vpath);
void edit_load_syntax (WEdit * edit, GPtrArray * pnames, const char *type);
MC_MOCKABLE void edit_load_syntax (WEdit * edit, GPtrArray * pnames, const char *type);
void edit_free_syntax_rules (WEdit * edit);
int edit_get_syntax_color (WEdit * edit, off_t byte_index);
MC_MOCKABLE int edit_get_syntax_color (WEdit * edit, off_t byte_index);
void edit_syntax_dialog (WEdit * edit);
void book_mark_insert (WEdit * edit, long line, int c);

View File

@ -12,7 +12,7 @@
/*** declarations of public functions ************************************************************/
/* Public function for unit tests */
char *edit_completion_dialog_show (const WEdit * edit, GQueue * compl, int max_width);
MC_MOCKABLE char *edit_completion_dialog_show (const WEdit * edit, GQueue * compl, int max_width);
void edit_complete_word_cmd (WEdit * edit);

View File

@ -12,7 +12,7 @@
/*** declarations of public functions ************************************************************/
int edit_store_macro_cmd (WEdit * edit);
gboolean edit_load_macro_cmd (WEdit * edit);
MC_MOCKABLE gboolean edit_load_macro_cmd (WEdit * edit);
void edit_delete_macro_cmd (WEdit * edit);
gboolean edit_repeat_macro_cmd (WEdit * edit);
gboolean edit_execute_macro (WEdit * edit, int hotkey);

View File

@ -426,7 +426,7 @@ edit_get_match_keyword_cmd (WEdit *edit)
for (i = 0; i < word_len; i++)
g_string_append_c (match_expr, edit_buffer_get_byte (&edit->buffer, word_start + i));
ptr = g_get_current_dir ();
ptr = my_get_current_dir ();
path = g_strconcat (ptr, PATH_SEP_STR, (char *) NULL);
g_free (ptr);

View File

@ -65,11 +65,11 @@ int pause_after_run = pause_on_dumb_terminals;
/*** forward declarations (file scope functions) *************************************************/
void do_execute (const char *shell, const char *command, int flags);
void do_executev (const char *shell, int flags, char *const argv[]);
char *execute_get_external_cmd_opts_from_config (const char *command,
const vfs_path_t * filename_vpath,
long start_line);
MC_MOCKABLE void do_execute (const char *shell, const char *command, int flags);
MC_MOCKABLE void do_executev (const char *shell, int flags, char *const argv[]);
MC_MOCKABLE char *execute_get_external_cmd_opts_from_config (const char *command,
const vfs_path_t * filename_vpath,
long start_line);
/*** file scope variables ************************************************************************/
@ -160,12 +160,12 @@ do_suspend_cmd (void)
/* Make sure that the SIGTSTP below will suspend us directly,
without calling ncurses' SIGTSTP handler; we *don't* want
ncurses to redraw the screen immediately after the SIGCONT */
sigaction (SIGTSTP, &startup_handler, &sigtstp_action);
my_sigaction (SIGTSTP, &startup_handler, &sigtstp_action);
kill (getpid (), SIGTSTP);
/* Restore previous SIGTSTP action */
sigaction (SIGTSTP, &sigtstp_action, NULL);
my_sigaction (SIGTSTP, &sigtstp_action, NULL);
}
#endif /* SIGTSTP */

View File

@ -65,7 +65,7 @@ void setup_cmdline (void);
void create_panel (int num, panel_view_mode_t type);
void swap_panels (void);
panel_view_mode_t get_panel_type (int idx);
panel_view_mode_t get_current_type (void);
MC_MOCKABLE panel_view_mode_t get_current_type (void);
panel_view_mode_t get_other_type (void);
int get_current_index (void);
int get_other_index (void);

View File

@ -181,7 +181,8 @@ void file_mark (WPanel * panel, int idx, int val);
void do_file_mark (WPanel * panel, int idx, int val);
gboolean panel_do_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type);
gboolean panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type);
MC_MOCKABLE gboolean panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath,
enum cd_enum cd_type);
gsize panel_get_num_of_sortable_fields (void);
char **panel_get_sortable_fields (gsize * array_size);

View File

@ -208,7 +208,7 @@ init_sigchld (void)
sigchld_action.sa_flags = SA_RESTART;
#endif /* !SA_RESTART */
if (sigaction (SIGCHLD, &sigchld_action, NULL) == -1)
if (my_sigaction (SIGCHLD, &sigchld_action, NULL) == -1)
{
#ifdef ENABLE_SUBSHELL
/*
@ -499,7 +499,7 @@ main (int argc, char *argv[])
if (mc_global.tty.alternate_plus_minus)
numeric_keypad_mode ();
(void) signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
(void) my_signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
if (mc_global.tty.console_flag != '\0')
handle_console (CONSOLE_DONE);

View File

@ -1403,7 +1403,7 @@ init_subshell (void)
subshell_alive = TRUE;
subshell_stopped = FALSE;
subshell_pid = fork ();
subshell_pid = my_fork ();
if (subshell_pid == -1)
{

View File

@ -120,23 +120,23 @@ sub list
chop($stats = `apt-cache stats 2>/dev/null`);
chop($config = `apt-config dump 2>&1`);
$sz = length($check);
print "-r--r--r-- 1 root root $sz $DATE CHECK\n";
print "-r--r--r-- 1 0 0 $sz $DATE CHECK\n";
$sz = length($available);
print "-r--r--r-- 1 root root $sz $DATE AVAILABLE\n";
print "-r--r--r-- 1 0 0 $sz $DATE AVAILABLE\n";
$sz = length($stats);
print "-r--r--r-- 1 root root $sz $DATE STATS\n";
print "-r--r--r-- 1 0 0 $sz $DATE STATS\n";
$sz = length($config);
print "-r--r--r-- 1 root root $sz $DATE CONFIG\n";
print "-r--r--r-- 1 0 0 $sz $DATE CONFIG\n";
$sz = length($pressupdate);
print "-r-xr--r-- 1 root root $sz $DATE UPDATE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE UPDATE\n";
$sz = length($pressupgrade);
print "-r-xr--r-- 1 root root $sz $DATE UPGRADE\n";
print "-r-xr--r-- 1 root root $sz $DATE DIST-UPGRADE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE UPGRADE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE DIST-UPGRADE\n";
ls("/etc/apt/sources.list","sources.list");
ls('/etc/apt/apt.conf','apt.conf') if (-f '/etc/apt/apt.conf');
print "drwxr-xr-x 1 root root 0 $DATE all\n";
print "drwxr-xr-x 1 0 0 0 $DATE all\n";
if ( open(PIPEIN, "find /var/cache/apt/archives -type f |") ) {
while(<PIPEIN>) {
@ -179,18 +179,18 @@ sub list
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $debd{$pkg}{'status'} =~ /config-files/ ? 0 : $debd{$pkg}{'installed-size'} * 1024;
@stat = stat("/var/lib/dpkg/info/".$debd{$pkg}{package}.".list");
$bt = bt($stat[9]);
print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
print "-rw-r--r-- 1 0 0 $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 0 0 $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
}
open STAT, "apt-cache dumpavail |"
@ -219,16 +219,16 @@ sub list
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $deba{$pkg}{'status'} =~ /config-files/ ? 0 : $deba{$pkg}{'installed-size'} * 1024;
print "-rw-r--r-- 1 root root $sz $DATE $dn/$fn.deba\n";
print "lrwxrwxrwx 1 root root $sz $DATE all/$fn.deba -> ../$dn/$fn.deba\n";
print "-rw-r--r-- 1 0 0 $sz $DATE $dn/$fn.deba\n";
print "lrwxrwxrwx 1 0 0 $sz $DATE all/$fn.deba -> ../$dn/$fn.deba\n";
}
}

View File

@ -14,8 +14,8 @@ export LC_TIME
mcbppfs_list ()
{
FILEPREF="-r--r--r-- 1 root root "
FIEXPREF="-r-xr-xr-x 1 root root "
FILEPREF="-r--r--r-- 1 0 0 "
FIEXPREF="-r-xr-xr-x 1 0 0 "
DATE=`date +"%b %d %H:%M"`
set x `ls -l "$1"`
size=$6

View File

@ -37,10 +37,10 @@ sub mcdebfs_list
chop($info_size=`dpkg -I $qarchivename | wc -c`);
$install_size=length($pressinstall);
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
print "dr-xr-xr-x 1 0 0 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 0 0 0 $date DEBIAN\n";
print "-r--r--r-- 1 0 0 $info_size $date INFO\n";
print "-r-xr--r-- 1 0 0 $install_size $date INSTALL\n";
if ( open(PIPEIN, "LC_ALL=C dpkg-deb -c $qarchivename |") )
{
@ -117,7 +117,7 @@ sub mcdebfs_list
$perm='-r--r--r--';
$name=$_[4];
}
print "$perm 1 root root $size $date DEBIAN/$name\n";
print "$perm 1 0 0 $size $date DEBIAN/$name\n";
}
}
}

View File

@ -21,14 +21,14 @@ sub list
$install_size=length($pressinstall);
$upgrade_size=length($pressupgrade);
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r--r--r-- 1 0 0 $info_size $date INFO\n";
chop($debd = `dpkg -s $qarchive | grep -i ^Version | sed 's/^version: //i'`);
chop($deba = `apt-cache show $qarchive | grep -i ^Version | sed 's/^version: //i'`);
if( ! $debd ) {
print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
print "-r-xr--r-- 1 0 0 $install_size $date INSTALL\n";
} elsif( $debd ne $deba ) {
print "-r-xr--r-- 1 root root $upgrade_size $date UPGRADE\n";
print "-r-xr--r-- 1 0 0 $upgrade_size $date UPGRADE\n";
}
}

View File

@ -120,30 +120,30 @@ sub list
$select_size=length($pressselect);
$unselect_size=length($pressunselect);
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n";
print "dr-xr-xr-x 1 0 0 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 0 0 0 $date DEBIAN\n";
print "-r--r--r-- 1 0 0 $info_size $date INFO\n";
print "-r-xr--r-- 1 0 0 $purge_size $date DPKG-PURGE\n";
chop($status = `dpkg -s $qarchive | grep ^Status`);
if( $status =~ /deinstall/ ) {
print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n";
print "-r-xr--r-- 1 0 0 $select_size $date DPKG-SELECT\n";
} elsif( $status =~ /install/ ) {
print "-r-xr--r-- 1 root root $unselect_size $date DPKG-UNSELECT\n";
print "-r-xr--r-- 1 0 0 $unselect_size $date DPKG-UNSELECT\n";
}
if( $status !~ /config-files/ ) {
if ( -x "/usr/bin/dpkg-repack" ) {
print "-r-xr--r-- 1 root root $repack_size $date DPKG-REPACK\n";
print "-r-xr--r-- 1 0 0 $repack_size $date DPKG-REPACK\n";
}
print "-r-xr--r-- 1 root root $remove_size $date DPKG-REMOVE\n";
print "-r-xr--r-- 1 0 0 $remove_size $date DPKG-REMOVE\n";
if ( -x "/usr/bin/apt-get" ) {
print "-r-xr--r-- 1 root root $remove_size $date APT-REMOVE\n";
print "-r-xr--r-- 1 root root $reinstall_size $date APT-REINSTALL\n";
print "-r-xr--r-- 1 root root $purge_size $date APT-PURGE\n";
print "-r-xr--r-- 1 0 0 $remove_size $date APT-REMOVE\n";
print "-r-xr--r-- 1 0 0 $reinstall_size $date APT-REINSTALL\n";
print "-r-xr--r-- 1 0 0 $purge_size $date APT-PURGE\n";
}
}
if( -x "/usr/bin/dpkg-reconfigure" && -x "/var/lib/dpkg/info/$archive.config" ) {
print "-r-xr--r-- 1 root root $reconfigure_size $date DPKG-RECONFIGURE\n";
print "-r-xr--r-- 1 0 0 $reconfigure_size $date DPKG-RECONFIGURE\n";
}

View File

@ -123,27 +123,27 @@ sub list
chop($getselections = `dpkg --get-selections 2>/dev/null`);
chop($audit = `dpkg --audit 2>/dev/null`);
$sz = length($diversions);
print "-r--r--r-- 1 root root $sz $DATE DIVERSIONS\n";
print "-r--r--r-- 1 0 0 $sz $DATE DIVERSIONS\n";
$sz = length($architecture);
print "-r--r--r-- 1 root root $sz $DATE ARCHITECTURE\n";
print "-r--r--r-- 1 0 0 $sz $DATE ARCHITECTURE\n";
$sz = length($list);
print "-r--r--r-- 1 root root $sz $DATE LIST\n";
print "-r--r--r-- 1 0 0 $sz $DATE LIST\n";
$sz = length($getselections);
print "-r--r--r-- 1 root root $sz $DATE GET-SELECTIONS\n";
print "-r--r--r-- 1 0 0 $sz $DATE GET-SELECTIONS\n";
$sz = length($audit);
print "-r--r--r-- 1 root root $sz $DATE AUDIT\n";
print "-r--r--r-- 1 0 0 $sz $DATE AUDIT\n";
$sz = length($pressconfigure);
print "-r-xr--r-- 1 root root $sz $DATE CONFIGURE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE CONFIGURE\n";
$sz = length($pressremove);
print "-r-xr--r-- 1 root root $sz $DATE REMOVE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE REMOVE\n";
$sz = length($pressclearavail);
print "-r-xr--r-- 1 root root $sz $DATE CLEAR-AVAIL\n";
print "-r-xr--r-- 1 0 0 $sz $DATE CLEAR-AVAIL\n";
$sz = length($pressforgetoldunavail);
print "-r-xr--r-- 1 root root $sz $DATE FORGET-OLD-UNAVAIL\n";
print "-r-xr--r-- 1 0 0 $sz $DATE FORGET-OLD-UNAVAIL\n";
ls("/var/lib/dpkg/status","STATUS","-r--r--r--");
# ls("/var/lib/dpkg/available","AVAILABLE","-r--r--r--");
print "drwxr-xr-x 1 root root 0 $DATE all\n";
print "drwxr-xr-x 1 0 0 0 $DATE all\n";
open STAT, "/var/lib/dpkg/status"
or exit 1;
@ -171,18 +171,18 @@ sub list
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $debs{$pkg}{'status'} =~ /config-files/ ? 0 : $debs{$pkg}{'installed-size'} * 1024;
@stat = stat("/var/lib/dpkg/info/".$debs{$pkg}{package}.".list");
$bt = bt($stat[9]);
print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
print "-rw-r--r-- 1 0 0 $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 0 0 $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
}
}

View File

@ -214,7 +214,7 @@ BEGIN {
attr=substr($0, 1, length($0)-length(name))
# strip inodes and extra dir entries; fix perms
sub(irx, "", name)
sub("^---------- 0 0 0", "-r--r--r-- 1 root root", attr)
sub("^---------- 0 0 0", "-r--r--r-- 1 0 0 ", attr)
sub(" $", "", name)
# for Joliet UCS level 3
if (SEMICOLON == "YES") sub(";1$", "", name);

View File

@ -74,7 +74,7 @@ SED="sed"
param=$1; shift
rpm_filename=$1; shift
FILEPREF="-r--r--r-- 1 root root "
FILEPREF="-r--r--r-- 1 0 0 "
mcrpmfs_getDesription()
{
@ -135,7 +135,7 @@ mcrpmfs_list_fastRPM ()
echo "$FILEPREF 0 $DATE INFO/VENDOR"
echo "$FILEPREF 0 $DATE INFO/DESCRIPTION"
echo "$FILEPREF 0 $DATE INFO/SUMMARY"
echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
echo "dr-xr-xr-x 1 0 0 0 $DATE INFO/SCRIPTS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PRETRANS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTTRANS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
@ -220,17 +220,17 @@ mcrpmfs_list ()
HEADERSIZE=`printf '%s\n' "$DESC" | wc -c` # 'echo' can't be used for arbitrary data (see commit message).
printf '%s %s %s HEADER\n' "${FILEPREF}" "${HEADERSIZE}" "${DATE}"
echo "-r-xr-xr-x 1 root root 0 $DATE INSTALL"
echo "-r-xr-xr-x 1 0 0 0 $DATE INSTALL"
case "${rpm_filename}" in
*.src.rpm)
echo "-r-xr-xr-x 1 root root 0 $DATE REBUILD"
echo "-r-xr-xr-x 1 0 0 0 $DATE REBUILD"
;;
*)
echo "-r-xr-xr-x 1 root root 0 $DATE UPGRADE"
echo "-r-xr-xr-x 1 0 0 0 $DATE UPGRADE"
;;
esac
echo "dr-xr-xr-x 3 root root 0 $DATE INFO"
echo "dr-xr-xr-x 3 0 0 0 $DATE INFO"
if [ `mcrpmfs_getRawOneTag "%{EPOCH}"` = "(none)" ]; then
echo "$FILEPREF 0 $DATE INFO/NAME-VERSION-RELEASE"
else

View File

@ -46,9 +46,9 @@ sub list
}
}
for $i (sort keys %files) {
print "dr-xr-xr-x 1 root root 0 $DATE $i/\n";
print "dr-xr-xr-x 1 0 0 0 $DATE $i/\n";
for $fn (sort @{$files{$i}}) {
print "-r--r--r-- 1 root root $sizes{$fn} $dates{$fn} $i/$fn.trpm\n";
print "-r--r--r-- 1 0 0 $sizes{$fn} $dates{$fn} $i/$fn.trpm\n";
}
}
}

View File

@ -33,13 +33,13 @@ mcrpmfs_list ()
if test -z "$MCFASTRPM"; then
MCFASTRPM=$MCFASTRPM_DFLT
fi
FILEPREF="-r--r--r-- 1 root root "
FILEPREF="-r--r--r-- 1 0 0 "
DESC=`$RPM -qi -- "$1"`
DATE=`$RPM -q --qf "%{BUILDTIME:date}" -- "$1" | cut -c 5-11,21-24`
HEADERSIZE=`echo "$DESC" | wc -c`
echo "-r--r--r-- 1 root root $HEADERSIZE $DATE HEADER"
echo "-r-xr-xr-x 1 root root 40 $DATE UNINSTALL"
echo "dr-xr-xr-x 3 root root 0 $DATE INFO"
echo "-r--r--r-- 1 0 0 $HEADERSIZE $DATE HEADER"
echo "-r-xr-xr-x 1 0 0 40 $DATE UNINSTALL"
echo "dr-xr-xr-x 3 0 0 0 $DATE INFO"
echo "$FILEPREF 0 $DATE INFO/NAME-VERSION-RELEASE"
echo "$FILEPREF 0 $DATE INFO/GROUP"
echo "$FILEPREF 0 $DATE INFO/BUILDHOST"
@ -54,7 +54,7 @@ mcrpmfs_list ()
test "`$RPM -q --qf \"%{SUMMARY}\" -- "$1"`" = "(none)" ||
echo "$FILEPREF 0 $DATE INFO/SUMMARY"
if test "`$RPM -q --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" -- "$1"`" != "(none)(none)(none)(none)(none)"; then
echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
echo "dr-xr-xr-x 1 0 0 0 $DATE INFO/SCRIPTS"
test "`$RPM -q --qf \"%{RPMTAG_PREIN}\" -- "$1"`" = '(none)' ||
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
test "`$RPM -q --qf \"%{RPMTAG_POSTIN}\" -- "$1"`" = '(none)' ||
@ -72,7 +72,7 @@ mcrpmfs_list ()
echo "$FILEPREF 0 $DATE INFO/VENDOR"
echo "$FILEPREF 0 $DATE INFO/DESCRIPTION"
echo "$FILEPREF 0 $DATE INFO/SUMMARY"
echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
echo "dr-xr-xr-x 1 0 0 0 $DATE INFO/SCRIPTS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTIN"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREUN"

View File

@ -426,7 +426,7 @@ shell_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
if ((pipe (fileset1) < 0) || (pipe (fileset2) < 0))
vfs_die ("Cannot pipe(): %m.");
res = fork ();
res = my_fork ();
if (res != 0)
{
@ -449,7 +449,7 @@ shell_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
res = open ("/dev/null", O_WRONLY);
close (fileset2[0]);
close (fileset2[1]);
execvp (path, (char **) argv);
my_execvp (path, (char **) argv);
my_exit (3);
}
}

View File

@ -4,8 +4,6 @@ SUBDIRS = . mcconfig search strutil vfs widget
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) @CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/lib/libmc.la

View File

@ -125,7 +125,7 @@ main (void)
tc_core = tcase_create ("Core");
/* writable directory where check creates temporary files */
cwd = g_get_current_dir ();
cwd = my_get_current_dir ();
g_setenv ("TEMP", cwd, TRUE);
g_free (cwd);

View File

@ -6,8 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/lib/libmc.la

View File

@ -56,7 +56,6 @@ config_object__reopen (void)
if (!mc_config_save_file (mc_config, &error))
{
ck_abort_msg ("Unable to save config file: %s", error->message);
g_error_free (error);
}
mc_config_deinit (mc_config);
@ -128,8 +127,10 @@ static const struct test_create_ini_file_ds
"test-group1",
"test-param2",
"not-exists",
" \tkoi8-r: ôÅÓÔÏ×ÏÅ ÚÎÁÞÅÎÉÅ ",
" \tkoi8-r: \320\242\320\265\321\201\321\202\320\276\320\262\320\276\320\265 \320\267\320\275\320\260\321\207\320\265\320\275\320\270\320\265 "
/* Should be represented as KOI8-R */
" \t \xF4\xC5\xD3\xD4\xCF\xD7\xCF\xC5 \xDA\xCE\xC1\xDE\xC5\xCE\xC9\xC5 ",
/* Should be stored as UTF-8 */
" \t Тестовое значение "
},
{ /* 3. */
"test-group1",
@ -172,11 +173,12 @@ START_PARAMETRIZED_TEST (test_create_ini_file_paths, test_create_ini_file_ds)
char *actual_value, *actual_raw_value;
mc_config_set_string (mc_config, "test-group1", "test-param1", " some value ");
mc_config_set_string (mc_config, "test-group1", "test-param2", " \tkoi8-r: ôÅÓÔÏ×ÏÅ ÚÎÁÞÅÎÉÅ ");
mc_config_set_string (mc_config, "test-group1", "test-param2",
" \t \xF4\xC5\xD3\xD4\xCF\xD7\xCF\xC5 \xDA\xCE\xC1\xDE\xC5\xCE\xC9\xC5 ");
mc_config_set_string (mc_config, "test-group1", "test-param3", " \tsome value2\n\nf\b\005fff ");
mc_config_set_string_raw (mc_config, "test-group2", "test-param1", " some value ");
mc_config_set_string_raw (mc_config, "test-group2", "test-param2",
" koi8-r: ôÅÓÔÏ×ÏÅ ÚÎÁÞÅÎÉÅ");
" \xF4\xC5\xD3\xD4\xCF\xD7\xCF\xC5 \xDA\xCE\xC1\xDE\xC5\xCE\xC9\xC5");
mc_config_set_string_raw (mc_config, "test-group2", "test-param3",
" \tsome value2\n\nf\b\005fff ");

View File

@ -210,7 +210,7 @@ static const char *filevercmp_test_ds2[] = {
"#.b#"
};
const size_t filevercmp_test_ds2_len = G_N_ELEMENTS (filevercmp_test_ds2);
static const size_t filevercmp_test_ds2_len = G_N_ELEMENTS (filevercmp_test_ds2);
/* @Test(dataSource = "filevercmp_test_ds2") */
/* *INDENT-OFF* */
@ -247,7 +247,7 @@ static const char *filevercmp_test_ds3[] = {
"application-1.10.1.tar.gz"
};
const size_t filevercmp_test_ds3_len = G_N_ELEMENTS (filevercmp_test_ds3);
static const size_t filevercmp_test_ds3_len = G_N_ELEMENTS (filevercmp_test_ds3);
/* @Test(dataSource = "filevercmp_test_ds3") */
/* *INDENT-OFF* */
@ -285,7 +285,7 @@ static const char *filevercmp_test_ds4[] = {
"firefox-59.0.1+build1.tar.gz"
};
const size_t filevercmp_test_ds4_len = G_N_ELEMENTS (filevercmp_test_ds4);
static const size_t filevercmp_test_ds4_len = G_N_ELEMENTS (filevercmp_test_ds4);
/* @Test(dataSource = "filevercmp_test_ds4") */
/* *INDENT-OFF* */
@ -346,7 +346,7 @@ static const char *filevercmp_test_ds5[] = {
NULL
};
const size_t filevercmp_test_ds5_len = G_N_ELEMENTS (filevercmp_test_ds5);
static const size_t filevercmp_test_ds5_len = G_N_ELEMENTS (filevercmp_test_ds5);
/* @Test(dataSource = "filevercmp_test_ds5") */
/* *INDENT-OFF* */

View File

@ -28,11 +28,6 @@
#include "lib/vfs/vfs.h"
/* sighandler_t is GNU extension */
#ifndef HAVE_SIGHANDLER_T
typedef void (*sighandler_t) (int);
#endif
/* --------------------------------------------------------------------------------------------- */
/* @CapturedValue */
@ -40,6 +35,10 @@ static sigset_t *sigemptyset_set__captured;
/* @ThenReturnValue */
static int sigemptyset__return_value = 0;
#ifdef sigemptyset
#undef sigemptyset
#endif
/* @Mock */
int
sigemptyset (sigset_t *set)
@ -61,7 +60,7 @@ static int sigaction__return_value = 0;
/* @Mock */
int
sigaction (int signum, const struct sigaction *act, struct sigaction *oldact)
my_sigaction (int signum, const struct sigaction *act, struct sigaction *oldact)
{
int *tmp_signum;
struct sigaction *tmp_act;
@ -129,7 +128,7 @@ static sighandler_t signal__return_value = NULL;
/* @Mock */
sighandler_t
signal (int signum, sighandler_t handler)
my_signal (int signum, sighandler_t handler)
{
int *tmp_signum;
sighandler_t *tmp_handler;
@ -176,7 +175,7 @@ static pid_t fork__return_value;
/* @Mock */
pid_t
fork (void)
my_fork (void)
{
return fork__return_value;
}
@ -203,7 +202,7 @@ static int execvp__return_value = 0;
/* @Mock */
int
execvp (const char *file, char *const argv[])
my_execvp (const char *file, char *const argv[])
{
char **one_arg;
execvp__file__captured = g_strdup (file);

View File

@ -7,8 +7,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/lib/vfs \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
EXTRA_DIST = mc.charsets.in
if CHARSET

View File

@ -32,6 +32,7 @@
#include "lib/global.h"
#include "lib/strutil.h"
#include "lib/vfs/xdirentry.h"
#include "lib/util.h"
#include "src/vfs/local/local.c"
@ -191,7 +192,7 @@ main (void)
tc_core = tcase_create ("Core");
/* writable directory where check creates temporary files */
cwd = g_get_current_dir ();
cwd = my_get_current_dir ();
g_setenv ("TEMP", cwd, TRUE);
g_free (cwd);

View File

@ -99,14 +99,14 @@ static const struct test_path_recode_ds
{
{ /* 0. */
"UTF-8",
"/тестовый/путь",
"/тестовый/путь",
"/тестовый/путь"
"/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8",
"/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8",
"/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8"
},
{ /* 1. */
"UTF-8",
"/#enc:KOI8-R/тестовый/путь",
"/тестовый/путь",
"/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8",
"/#enc:KOI8-R/тестовый/путь"
},
{ /* 2. */
@ -117,9 +117,9 @@ static const struct test_path_recode_ds
},
{ /* 3. */
"KOI8-R",
"/#enc:UTF-8/тестовый/путь",
"/#enc:UTF-8/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8",
"/тестовый/путь",
"/#enc:UTF-8/тестовый/путь"
"/#enc:UTF-8/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8"
},
{ /* 4. Test encode info at start */
"UTF-8",
@ -190,13 +190,13 @@ static const struct test_path_to_str_flags_ds
"/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь",
VPF_NONE,
VPF_RECODE,
"/test1://user:passwd@host.name/тестовый/путь"
"/test1://user:passwd@host.name/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8"
},
{ /* 3. */
"/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь",
VPF_NONE,
VPF_RECODE | VPF_STRIP_PASSWORD,
"/test1://user@host.name/тестовый/путь"
"/test1://user@host.name/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8"
},
{ /* 4. */
"/mock/home/test/dir",
@ -220,13 +220,13 @@ static const struct test_path_to_str_flags_ds
"/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь",
VPF_NONE,
VPF_STRIP_HOME | VPF_RECODE,
"~/test1://user:passwd@host.name/тестовый/путь"
"~/test1://user:passwd@host.name/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8"
},
{ /* 8. */
"/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь",
VPF_NONE,
VPF_STRIP_HOME | VPF_RECODE | VPF_STRIP_PASSWORD,
"~/test1://user@host.name/тестовый/путь"
"~/test1://user@host.name/\xD4\xC5\xD3\xD4\xCF\xD7\xD9\xCA/\xD0\xD5\xD4\xD8"
},
};
/* *INDENT-ON* */

View File

@ -31,6 +31,7 @@
#include "lib/strutil.h"
#include "lib/vfs/xdirentry.h"
#include "lib/vfs/path.h"
#include "lib/util.h"
#include "src/vfs/local/local.c"
@ -201,7 +202,7 @@ main (void)
tc_core = tcase_create ("Core");
/* writable directory where check creates temporary files */
cwd = g_get_current_dir ();
cwd = my_get_current_dir ();
g_setenv ("TEMP", cwd, TRUE);
g_free (cwd);

View File

@ -36,10 +36,10 @@
#include "src/vfs/local/local.c"
struct vfs_s_subclass test_subclass1;
static struct vfs_s_subclass test_subclass1;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
struct vfs_s_entry *vfs_root_entry;
static struct vfs_s_entry *vfs_root_entry;
static struct vfs_s_inode *vfs_root_inode;
static struct vfs_s_super *vfs_test_super;

View File

@ -37,7 +37,7 @@
#define ETALON_VFS_NAME "#test2:user:pass@host.net"
#define ETALON_VFS_URL_NAME "test2://user:pass@host.net"
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);

View File

@ -30,6 +30,7 @@
#include <stdlib.h>
#include "lib/strutil.h"
#include "lib/util.h"
#include "lib/vfs/xdirentry.h"
#include "src/vfs/local/local.c"
@ -37,7 +38,7 @@
/* @Mock */
char *
g_get_current_dir (void)
my_get_current_dir (void)
{
return g_strdup ("/some/path");
}

View File

@ -6,8 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/lib/vfs \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/lib/libmc.la

View File

@ -12,8 +12,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/lib/vfs \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/src/libinternal.la \
$(top_builddir)/lib/libmc.la

View File

@ -6,8 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/src/libinternal.la \
$(top_builddir)/lib/libmc.la

View File

@ -7,8 +7,6 @@ AM_CPPFLAGS = \
-DTEST_SHARE_DIR=\"$(abs_srcdir)\" \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/src/libinternal.la \
$(top_builddir)/lib/libmc.la

View File

@ -4,10 +4,6 @@ SUBDIRS = misc
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
# This lets mc_parse_ls_l.c override MC's message() without the linker
# complaining about multiple definitions.
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = $(top_builddir)/lib/libmc.la
if ENABLE_MCLIB

View File

@ -7,8 +7,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/lib/vfs \
@CHECK_CFLAGS@
AM_LDFLAGS = @TESTS_LDFLAGS@
LIBS = @CHECK_LIBS@ \
$(top_builddir)/src/libinternal.la \
$(top_builddir)/lib/libmc.la