~ubuntu-branches/ubuntu/utopic/xarchiver/utopic

« back to all changes in this revision

Viewing changes to src/rpm.c

  • Committer: Package Import Robot
  • Author(s): Markus Koschany
  • Date: 2014-05-20 11:30:18 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20140520113018-ybro6c5fp38x22kt
Tags: 1:0.5.3+dfsg-1
* Imported Upstream version 0.5.3+dfsg. (Closes: #748541)
  - New features:
    + RAR5 support.
    + Full Test/Verify support.
* Drop the following patches. They were merged or fixed upstream.
  - check-for-password-protected-files-on-double-click.patch
  - fix-7z-crash.patch
  - fix-multiextract.patch
  - fix-segfault-non-existent-archive-cmdl-switch-x.patch
  - new-homepage.patch
  - no-donators-menu.patch
  - xz-support.patch
* New patches:
  - open-url.patch: Add support for opening file:// URLs. Thanks to Frederick
    Guerin.
  - disable-donate.patch: Fix GLib-GObject-Warning on startup.
  - fix-rename-and-delete-segfault.patch: Fix a segmentation fault that
    occured when files in tar.xz or tar.bz2 archives were renamed or deleted.
* Add Forwarded headers to all patches.
* debian/control:
  - Remove unrar-free from Suggests. It is RC-buggy and incapable to work with
    modern RAR formats.
* debian/rules:
  - Remove override for dh_auto_clean.
* Drop xarchiver.docs. Do not install TODO anymore. It contains nothing
  noteworthy.
* Add README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
void xa_open_rpm (XArchive *archive)
25
25
{
26
 
        unsigned char bytes[8];
27
26
        unsigned short int i;
28
 
    int dl,il,sigsize,offset,response;
29
 
    gchar *ibs,*executable;
30
 
    gchar *gzip_tmp = NULL;
 
27
    int response;
31
28
        GSList *list = NULL;
32
29
        FILE *stream;
33
30
        gboolean result;
56
53
                archive->column_types[i] = types[i];
57
54
 
58
55
        xa_create_liststore (archive,names);
59
 
    if (fseek ( stream, 104 , SEEK_CUR ) )
60
 
    {
61
 
        fclose (stream);
62
 
        response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't fseek to position 104:"),g_strerror(errno));
63
 
        return;
64
 
    }
65
 
    if ( fread ( bytes, 1, 8, stream ) == 0 )
66
 
        {
67
 
                fclose ( stream );
68
 
                response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't read data from file:"),g_strerror(errno));
69
 
                return;
70
 
    }
71
 
    il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
72
 
    dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
73
 
    sigsize = 8 + 16 * il + dl;
74
 
    offset = 104 + sigsize + ( 8 - ( sigsize % 8 ) ) % 8 + 8;
75
 
    if (fseek ( stream, offset  , SEEK_SET ) )
76
 
    {
77
 
        fclose (stream);
78
 
        response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't fseek in file:"),g_strerror(errno));
79
 
        return;
80
 
    }
81
 
    if ( fread ( bytes, 1, 8, stream ) == 0 )
82
 
        {
83
 
                fclose ( stream );
84
 
                response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't read data from file:"),g_strerror(errno));
85
 
                return;
86
 
    }
87
 
    il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
88
 
    dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
89
 
        sigsize = 8 + 16 * il + dl;
90
 
        offset = offset + sigsize;
91
 
        fclose (stream);
92
56
 
93
57
        /* Create a unique temp dir in /tmp */
94
58
        result = xa_create_temp_directory (archive);
95
59
        if (!result)
96
60
                return;
97
61
 
98
 
        gzip_tmp = g_strconcat (archive->tmp,"/file.gz_bz",NULL);
99
 
        ibs = g_strdup_printf ( "%u" , offset );
100
 
 
101
62
        /* Now I run dd to have the bzip2 / gzip compressed cpio archive in /tmp */
102
 
        gchar *command = g_strconcat ( "dd if=",archive->escaped_path," ibs=",ibs," skip=1 of=",gzip_tmp,NULL);
103
 
        g_free (ibs);
104
 
        list = g_slist_append(list,command);
105
 
        batch_mode = TRUE;
106
 
        result = xa_run_command (archive,list);
107
 
        if (result == FALSE)
108
 
        {       
109
 
                g_free (gzip_tmp);
110
 
                return;
111
 
        }
112
 
        if (xa_detect_archive_type (gzip_tmp) == XARCHIVETYPE_GZIP)
113
 
                executable = "gzip -dc ";
114
 
        else
115
 
                executable = "bzip2 -dc ";
116
 
 
117
 
        command = g_strconcat("sh -c \"",executable,gzip_tmp," > ",archive->tmp,"/file.cpio\"",NULL);
118
 
        g_free(gzip_tmp);
 
63
        gchar *command = g_strconcat ( "sh -c \"rpm2cpio ",archive->escaped_path," > ",archive->tmp, "/file.cpio\"",NULL);
119
64
        list = NULL;
120
65
        list = g_slist_append(list,command);
121
66
        result = xa_run_command (archive,list);