Skip to content
Commits on Source (8)
  • Ondrej Holy's avatar
    tests: Fix various defects reported by Coverity · f735c056
    Ondrej Holy authored
    The Coverity tool found some defects in the testing suite. Although,
    those defects don't cause any really issues, let's fix them to make
    covscan happy and the code more bullet-proof.
    f735c056
  • Ondrej Holy's avatar
    compressor: Fix usage of uninitialized value · e1c58e6d
    Ondrej Holy authored
    The Coverity tool found usage of uninitialized value, which was unfortunatelly
    introduced by the recent commit c919227c. This might lead to segfaults when
    compressing remote files. Let's initialize the `sparse` variable to fix this.
    e1c58e6d
  • Ondrej Holy's avatar
    extractor: Fix extraction of one file archives · 135053d5
    Ondrej Holy authored
    Currently, an empty folder is created when extracting an archive over
    Nautilus which contains one file with the same name as the archive.
    This is because gnome-autoar always creates the top-level folder, but
    the one file archive with the same name should be extracted directly
    without creating additional folders. Otherwise the `conflict` signal
    is emitted and Nautilus by default skips conflicting files, so only
    empty folder remains after extraction. This problem have not been
    unfortunately noticed by the `test-one-file-same-name` unit test due to
    differences in the `decide-destination` signal handling. Let's do not
    create the top-level folder at all as `g_file_make_directory_with_parents`
    is used later anyway.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/28
    135053d5
  • Ondrej Holy's avatar
    extractor: Prevent redundant path name handling for equal prefixes · b9590ab7
    Ondrej Holy authored
    Currently, redundant path name handling happens when archive files have
    a common prefix and an equal destination is returned from the `decide-destination`
    signal. In this case, the old prefix is removed and the new one (the equal one)
    is added again. Let's detect this case and prevent the redundancy.
    b9590ab7
  • Ondrej Holy's avatar
    extractor: Print debug when conflict happened · 9f4edea8
    Ondrej Holy authored
    The debug output doesn't contain info when conflict happens. This makes
    hard to debug issues which are caused by them. Let's print one when
    a conflict happens to make it obvious.
    9f4edea8
  • Ondrej Holy's avatar
    tests: Skip conflicting files by default over test-extract · 47b643b2
    Ondrej Holy authored
    By default, the conflicting files are skipped and this default behavior is
    also used by Nautilus and other clients. However, the `test-extract` util
    overwrites the files instead. Let's honor the default behavior here as well
    to make debugging easier.
    47b643b2
  • Ondrej Holy's avatar
    release: Prepare for 0.3.3 · 87e278ef
    Ondrej Holy authored
    87e278ef
  • Sebastien Bacher's avatar
    New upstream version 0.3.3 · 21df7f12
    Sebastien Bacher authored
    21df7f12
Major changes in 0.3.3:
* extractor: Fix extraction of one file archives (Ondrej Holy)
* compressor: Fix usage of uninitialized value (Ondrej Holy)
Major changes in 0.3.2:
* compressor: Fix hardlink handling for new cpio format (Ondrej Holy)
* compressor: Fix hardlink detection for remote files (Ondrej Holy)
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for gnome-autoar 0.3.2.
# Generated by GNU Autoconf 2.69 for gnome-autoar 0.3.3.
#
# Report bugs to <https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-autoar>.
#
......@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gnome-autoar'
PACKAGE_TARNAME='gnome-autoar'
PACKAGE_VERSION='0.3.2'
PACKAGE_STRING='gnome-autoar 0.3.2'
PACKAGE_VERSION='0.3.3'
PACKAGE_STRING='gnome-autoar 0.3.3'
PACKAGE_BUGREPORT='https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-autoar'
PACKAGE_URL=''
......@@ -1411,7 +1411,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures gnome-autoar 0.3.2 to adapt to many kinds of systems.
\`configure' configures gnome-autoar 0.3.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1482,7 +1482,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of gnome-autoar 0.3.2:";;
short | recursive ) echo "Configuration of gnome-autoar 0.3.3:";;
esac
cat <<\_ACEOF
......@@ -1627,7 +1627,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
gnome-autoar configure 0.3.2
gnome-autoar configure 0.3.3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1959,7 +1959,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by gnome-autoar $as_me 0.3.2, which was
It was created by gnome-autoar $as_me 0.3.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2828,7 +2828,7 @@ fi
# Define the identity of the package.
PACKAGE='gnome-autoar'
VERSION='0.3.2'
VERSION='0.3.3'
cat >>confdefs.h <<_ACEOF
......@@ -3108,7 +3108,7 @@ AM_BACKSLASH='\'
LIBGNOME_AUTOAR_LT_VERSION=302:0:302
LIBGNOME_AUTOAR_LT_VERSION=303:0:303
LIBGNOME_AUTOAR_API_VERSION=0
......@@ -15013,7 +15013,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by gnome-autoar $as_me 0.3.2, which was
This file was extended by gnome-autoar $as_me 0.3.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -15079,7 +15079,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
gnome-autoar config.status 0.3.2
gnome-autoar config.status 0.3.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -6,7 +6,7 @@ AC_PREREQ([2.68])
m4_define([major_version], [0])
m4_define([minor_version], [3])
m4_define([micro_version], [2])
m4_define([micro_version], [3])
AC_INIT([gnome-autoar],
[major_version.minor_version.micro_version],
......
......@@ -963,7 +963,7 @@ autoar_compressor_do_add_to_archive (AutoarCompressor *self,
g_object_ref (file));
{
struct archive_entry *sparse;
struct archive_entry *sparse = NULL;
/* Hardlinks are handled in different ways by the archive formats. The
* archive_entry_linkify function is a unified interface, which handling
......
......@@ -1817,9 +1817,12 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
autoar_extractor_signal_decide_destination (self,
self->prefix,
files,
&new_destination);
&self->new_prefix);
self->new_prefix = new_destination;
if (self->new_prefix && g_file_equal (self->prefix, self->new_prefix)) {
/* This prevents redundant path name handling later. */
g_clear_object (&self->new_prefix);
}
} else {
autoar_extractor_signal_decide_destination (self,
self->destination_dir,
......@@ -1832,28 +1835,11 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
}
}
new_destination = (self->new_prefix != NULL) ? self->new_prefix : self->destination_dir;
destination_name = g_file_get_path (new_destination);
destination_name = g_file_get_path (self->new_prefix != NULL ?
self->new_prefix :
self->destination_dir);
g_debug ("autoar_extractor_step_decide_destination: destination %s", destination_name);
g_file_make_directory_with_parents (new_destination,
self->cancellable,
&(self->error));
if (g_error_matches (self->error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
GFileType file_type;
file_type = g_file_query_file_type (new_destination,
G_FILE_QUERY_INFO_NONE,
NULL);
if (file_type == G_FILE_TYPE_DIRECTORY) {
/* FIXME: Implement a way to solve directory conflicts */
g_debug ("autoar_extractor_step_decide_destination: destination directory exists");
g_clear_error (&self->error);
}
}
g_list_free_full (files, g_object_unref);
}
......@@ -1911,6 +1897,8 @@ autoar_extractor_step_extract (AutoarExtractor *self) {
while (file_conflict) {
GFile *new_extracted_filename = NULL;
g_debug ("autoar_extractor_step_extract: conflict detected");
/* Do not try to solve any conflicts in parents for now. Especially
* symlinks in parents are dangerous as it can easily happen that files
* are written outside of the destination. The tar cmd fails to extract
......
......@@ -211,16 +211,9 @@ conflict_handler (AutoarExtractor *extractor,
if (key_found) {
action = GPOINTER_TO_UINT (value);
switch (action) {
case AUTOAR_CONFLICT_OVERWRITE:
break;
case AUTOAR_CONFLICT_CHANGE_DESTINATION:
*new_file = g_object_ref (g_hash_table_lookup (data->conflict_files_destinations,
file));
break;
case AUTOAR_CONFLICT_SKIP:
break;
if (action == AUTOAR_CONFLICT_CHANGE_DESTINATION) {
*new_file = g_object_ref (g_hash_table_lookup (data->conflict_files_destinations,
file));
}
}
......@@ -718,7 +711,6 @@ test_conflict_overwrite (void)
g_autoptr (ExtractTestData) data = NULL;
g_autoptr (GFile) archive = NULL;
g_autoptr (GFile) conflict_file = NULL;
g_autoptr (GFile) reference_file = NULL;
g_autoptr (AutoarExtractor) extractor = NULL;
extract_test = extract_test_new ("test-conflict-overwrite");
......@@ -728,13 +720,13 @@ test_conflict_overwrite (void)
return;
}
reference_file = g_file_get_child (extract_test->reference,
"arextract.txt");
conflict_file = g_file_get_child (extract_test->output,
"arextract.txt");
g_file_replace_contents (conflict_file, "this file should be overwritten", 31,
NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL, NULL);
g_assert_true (g_file_replace_contents (conflict_file,
"this file should be overwritten", 31,
NULL, FALSE, G_FILE_CREATE_NONE, NULL,
NULL, NULL));
archive = g_file_get_child (extract_test->input, "arextract.zip");
......@@ -956,8 +948,8 @@ test_conflict_new_destination (void)
conflict_file = g_file_get_child (extract_test->output,
"arextract.txt");
g_file_copy (reference_file, conflict_file, G_FILE_COPY_NONE,
NULL, NULL, NULL, NULL);
g_assert_true (g_file_copy (reference_file, conflict_file, G_FILE_COPY_NONE,
NULL, NULL, NULL, NULL));
archive = g_file_get_child (extract_test->input, "arextract.zip");
......@@ -1018,8 +1010,8 @@ test_conflict_skip_file (void)
conflict_file = g_file_get_child (extract_test->output,
"arextract.txt");
g_file_copy (reference_file, conflict_file, G_FILE_COPY_NONE,
NULL, NULL, NULL, NULL);
g_assert_true (g_file_copy (reference_file, conflict_file, G_FILE_COPY_NONE,
NULL, NULL, NULL, NULL));
archive = g_file_get_child (extract_test->input, "arextract.zip");
......@@ -1076,8 +1068,8 @@ test_conflict_skip_file_default (void)
conflict_file = g_file_get_child (extract_test->output,
"arextract.txt");
g_file_copy (reference_file, conflict_file, G_FILE_COPY_NONE,
NULL, NULL, NULL, NULL);
g_assert_true (g_file_copy (reference_file, conflict_file, G_FILE_COPY_NONE,
NULL, NULL, NULL, NULL));
archive = g_file_get_child (extract_test->input, "arextract.zip");
......
......@@ -65,7 +65,7 @@ my_handler_conflict (AutoarExtractor *extractor,
g_print ("Conflict on: %s\n", path);
return AUTOAR_CONFLICT_OVERWRITE;
return AUTOAR_CONFLICT_UNHANDLED;
}
static void
......