[xarchiver] Add new patches

Christoph Wickert cwickert at fedoraproject.org
Thu Jun 2 17:32:45 UTC 2011


commit ecfc91abe4f8850bbaffd4ac410f6d8a9a9a38a2
Author: Christoph Wickert <cwickert at fedoraproject.org>
Date:   Thu Jun 2 19:32:28 2011 +0200

    Add new patches

 xarchiver-0.5.2-rpm2cpio.patch           |   84 ++++++++++++++++++++++++++++++
 xarchiver-0.5.2-segfault-open-with.patch |   15 +++++
 2 files changed, 99 insertions(+), 0 deletions(-)
---
diff --git a/xarchiver-0.5.2-rpm2cpio.patch b/xarchiver-0.5.2-rpm2cpio.patch
new file mode 100644
index 0000000..d962a44
--- /dev/null
+++ b/xarchiver-0.5.2-rpm2cpio.patch
@@ -0,0 +1,84 @@
+diff -up ./src/rpm.c.rpm2cpio ./src/rpm.c
+--- ./src/rpm.c.rpm2cpio	2008-10-24 13:43:04.000000000 +0200
++++ ./src/rpm.c	2011-03-27 03:14:20.225742237 +0200
+@@ -23,11 +23,8 @@ extern gboolean batch_mode;
+ 
+ void xa_open_rpm (XArchive *archive)
+ {
+-	unsigned char bytes[8];
+ 	unsigned short int i;
+-    int dl,il,sigsize,offset,response;
+-    gchar *ibs,*executable;
+-    gchar *gzip_tmp = NULL;
++    int response;
+ 	GSList *list = NULL;
+ 	FILE *stream;
+ 	gboolean result;
+@@ -56,66 +53,14 @@ void xa_open_rpm (XArchive *archive)
+ 		archive->column_types[i] = types[i];
+ 
+ 	xa_create_liststore (archive,names);
+-    if (fseek ( stream, 104 , SEEK_CUR ) )
+-    {
+-        fclose (stream);
+-        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));
+-        return;
+-    }
+-    if ( fread ( bytes, 1, 8, stream ) == 0 )
+-	{
+-		fclose ( stream );
+-		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));
+-		return;
+-    }
+-    il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
+-    dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
+-    sigsize = 8 + 16 * il + dl;
+-    offset = 104 + sigsize + ( 8 - ( sigsize % 8 ) ) % 8 + 8;
+-    if (fseek ( stream, offset  , SEEK_SET ) )
+-    {
+-        fclose (stream);
+-        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));
+-        return;
+-    }
+-    if ( fread ( bytes, 1, 8, stream ) == 0 )
+-	{
+-		fclose ( stream );
+-		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));
+-		return;
+-    }
+-    il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
+-    dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
+-	sigsize = 8 + 16 * il + dl;
+-	offset = offset + sigsize;
+-	fclose (stream);
+ 
+ 	/* Create a unique temp dir in /tmp */
+ 	result = xa_create_temp_directory (archive);
+ 	if (!result)
+ 		return;
+ 
+-	gzip_tmp = g_strconcat (archive->tmp,"/file.gz_bz",NULL);
+-	ibs = g_strdup_printf ( "%u" , offset );
+-
+ 	/* Now I run dd to have the bzip2 / gzip compressed cpio archive in /tmp */
+-	gchar *command = g_strconcat ( "dd if=",archive->escaped_path," ibs=",ibs," skip=1 of=",gzip_tmp,NULL);
+-	g_free (ibs);
+-	list = g_slist_append(list,command);
+-	batch_mode = TRUE;
+-	result = xa_run_command (archive,list);
+-	if (result == FALSE)
+-	{	
+-		g_free (gzip_tmp);
+-		return;
+-	}
+-	if (xa_detect_archive_type (gzip_tmp) == XARCHIVETYPE_GZIP)
+-		executable = "gzip -dc ";
+-	else
+-		executable = "bzip2 -dc ";
+-
+-	command = g_strconcat("sh -c \"",executable,gzip_tmp," > ",archive->tmp,"/file.cpio\"",NULL);
+-	g_free(gzip_tmp);
++	gchar *command = g_strconcat ( "sh -c \"rpm2cpio ",archive->escaped_path," > ",archive->tmp, "/file.cpio\"",NULL);
+ 	list = NULL;
+ 	list = g_slist_append(list,command);
+ 	result = xa_run_command (archive,list);
diff --git a/xarchiver-0.5.2-segfault-open-with.patch b/xarchiver-0.5.2-segfault-open-with.patch
new file mode 100644
index 0000000..e29d40c
--- /dev/null
+++ b/xarchiver-0.5.2-segfault-open-with.patch
@@ -0,0 +1,15 @@
+diff -pur xarchiver-0.5.2/src/open-with-dlg.c xarchiver-0.5.2.new/src/open-with-dlg.c
+--- xarchiver-0.5.2/src/open-with-dlg.c	2008-10-17 14:06:03.000000000 +0200
++++ xarchiver-0.5.2.new/src/open-with-dlg.c	2011-05-16 21:48:49.042839556 +0200
+@@ -289,7 +289,10 @@ static void xa_open_with_dialog_selectio
+ 	GtkTreeIter iter;
+ 	GtkTreeModel *model;
+ 
+-	gtk_tree_selection_get_selected(selection,&model,&iter);
++	if (!gtk_tree_selection_get_selected(selection,&model,&iter)) {
++		return;
++	}
++
+ 	gtk_tree_model_get(model,&iter,2,&exec,-1);
+ 	
+ 	gtk_entry_set_text(GTK_ENTRY(data->custom_command_entry),exec);


More information about the scm-commits mailing list