From 78f4bcb90d3c6a20bc969f64ff7c1e52f10a79e8 Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: May 24 2008 00:52:09 +0000 Subject: - 0.9.17 - 2 patches dropped, upstream applied --- diff --git a/.cvsignore b/.cvsignore index 44df8e9..c3c7e63 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -cbrpager-0.9.16.tar.gz +cbrpager-0.9.17.tar.gz diff --git a/cbrpager-0.9.16-filen-shell-escaping.patch b/cbrpager-0.9.16-filen-shell-escaping.patch deleted file mode 100644 index 7168d01..0000000 --- a/cbrpager-0.9.16-filen-shell-escaping.patch +++ /dev/null @@ -1,191 +0,0 @@ ---- cbrpager-0.9.16/src/global.c.filen 2008-05-23 14:53:51.000000000 +0900 -+++ cbrpager-0.9.16/src/global.c 2008-05-23 23:03:45.000000000 +0900 -@@ -36,6 +36,12 @@ - #include "conf.h" - #include "main.h" - -+#include -+#include /* open */ -+#include -+#include -+#include /* wait */ -+ - GList *pagelist = NULL; - int page_nr = 0, - timer_id = 0, -@@ -136,7 +142,6 @@ - return -1; - } - -- - void - start_show(void) - { -@@ -144,19 +149,15 @@ - char *bff, *p = NULL, **names; - gboolean first = TRUE; - int s, t, bffbeg = 0; -+ int pfd[2]; /* pipe */ -+ int pid_i, pid_j; /* two children*/ - - if (debug) printf("%s\n", pref.lastbook); - - switch (pref.booktype = file_type_of(pref.lastbook)) { - case ZIP_FILE: -- bff = g_strdup_printf("unzip -l \"%s\" | grep \"%s\" > %s", -- pref.lastbook, all_extensions, tmpf); -- if (debug) printf("ZIP command: %s\n", bff); - break; - case RAR_FILE: -- bff = g_strdup_printf("unrar v \"%s\" | grep \"%s\" > %s", -- pref.lastbook, all_extensions, tmpf); -- if (debug) printf("RAR command: %s\n", bff); - break; - default: // Patch from Ilja Pyykkonen 2005/09/04 - p = g_strdup_printf(_("Cannot open file '%s': unknown file type"), -@@ -165,7 +166,76 @@ - g_free(p); - return; - } -- system(bff); -+ -+ if(pipe(pfd) == -1) { -+ fprintf(stderr, "Creating pipe failed\n"); -+ return; -+ } -+ -+ pid_i = fork(); -+ if (pid_i == -1) { -+ fprintf(stderr, "Forking failed\n"); -+ return; -+ } -+ else if (pid_i == 0) { /* child 1: do unzip or unrar */ -+ close(pfd[0]); -+ close(1); /* close stdout*/ -+ if (dup(pfd[1]) != 1 ) { -+ fprintf(stderr, "Dup failure\n"); -+ return; -+ } -+ close(pfd[1]); -+ switch(pref.booktype) { -+ case ZIP_FILE: -+ if (debug) fprintf(stderr, "ZIP command: unzip -l %s\n", -+ pref.lastbook); -+ execlp("unzip", "unzip", "-l", pref.lastbook, (char *)NULL); -+ return; /* should not reach here */ -+ case RAR_FILE: -+ if (debug) fprintf(stderr, "RAR command: unrar -v %s\n", -+ pref.lastbook); -+ execlp("unrar", "unrar", "v", pref.lastbook, (char *)NULL); -+ return; /* should not reach here */ -+ } -+ } -+ else { -+ pid_j = fork() ; -+ if (pid_j == -1) { -+ fprintf(stderr, "Forking failed\n"); -+ return; -+ } -+ else if (pid_j == 0) { /* child 2; do grep */ -+ close(pfd[1]); -+ close(0); /* close stdin */ -+ if (dup(pfd[0]) != 0) { -+ fprintf(stderr, "Dup failure\n"); -+ return; -+ } -+ close(pfd[0]); -+ if ((tmpf_fd = open(tmpf, O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR)) == -1) { -+ p = g_strdup_printf(_("Cannot open file '%s'"), tmpf); -+ ok_dialog(_("File error"), p); -+ g_free(p); -+ return; -+ } -+ close(1); /* close stdout */ -+ if (dup(tmpf_fd) != 1) { -+ fprintf(stderr, "Dup failure\n"); -+ return; -+ } -+ close(tmpf_fd); -+ execlp("grep", "grep", all_extensions, (char *)NULL); -+ return; /* should not reach here */ -+ } -+ else { /* parent */ -+ close(pfd[0]); -+ close(pfd[1]); -+ /* wait children */ -+ waitpid(pid_i, 0, 0); -+ waitpid(pid_j, 0, 0); -+ } -+ } -+ bff = NULL; - - if (!g_file_test(tmpf, G_FILE_TEST_EXISTS)) { - printf(_("Cannot open temporary file %s\n"), tmpf); -@@ -236,7 +306,9 @@ - { - char *p, *bff = NULL, *esc; - int len, i, idx = 0; -- -+ -+ int pid; -+ - p = (char *)g_list_nth_data(pagelist, nr); - len = strlen(p); - esc = g_malloc(2*len + 1); -@@ -254,21 +326,42 @@ - - printf(_("Requesting page %d/%d (%s)\n"), nr+1, g_list_length(pagelist), esc); - -- switch (pref.booktype) { -- case RAR_FILE: -- bff = g_strdup_printf("unrar p -ierr -clr -- \"%s\" \"%s\" > %s", -- pref.lastbook, -- p, -- tmpf); -- break; -- case ZIP_FILE: -- bff = g_strdup_printf("unzip -p -C \"%s\" \"%s\" > %s", -- pref.lastbook, -- p, -- tmpf); -- break; -+ pid = fork(); -+ switch (pid) { -+ case -1: -+ fprintf(stderr, "Forking failed\n"); -+ return; -+ case 0: /* child */ -+ if ((tmpf_fd = open(tmpf, O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR)) == -1) { -+ p = g_strdup_printf(_("Cannot open file '%s'"), tmpf); -+ ok_dialog(_("File error"), p); -+ g_free(p); -+ return; -+ } -+ close(1); /* close stdout */ -+ if (dup(tmpf_fd) != 1) { -+ fprintf(stderr, "Dup failure\n"); -+ return; -+ } -+ close(tmpf_fd); -+ switch(pref.booktype) { -+ case RAR_FILE: -+ execlp("unrar", -+ "unrar", "p", "-ierr", "-clr", "--", -+ pref.lastbook, p, (char *)NULL); -+ return; /* should not reach here */ -+ case ZIP_FILE: -+ execlp("unzip", -+ "unzip", "-p", "-C", -+ pref.lastbook, p, (char *)NULL); -+ return; /* should not reach here */ -+ } -+ return; /* should not reach here */ -+ default: /* parent */ -+ waitpid(pid, 0, 0); - } -- system(bff); -+ -+ bff = NULL; - g_free(bff); - g_free(esc); - diff --git a/cbrpager-0.9.16-remove-critical-warning.patch b/cbrpager-0.9.16-remove-critical-warning.patch deleted file mode 100644 index f0ee84b..0000000 --- a/cbrpager-0.9.16-remove-critical-warning.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- cbrpager-0.9.16/src/global.c.debug 2008-05-22 23:10:32.000000000 +0900 -+++ cbrpager-0.9.16/src/global.c 2008-05-23 14:53:51.000000000 +0900 -@@ -28,6 +28,8 @@ - #include - #include - -+#include -+ - #include "support.h" - #include "interface.h" - #include "global.h" -@@ -139,9 +141,9 @@ - start_show(void) - { - GtkWidget *w; -- char *bff, *p, **names; -+ char *bff, *p = NULL, **names; - gboolean first = TRUE; -- int s, t, bffbeg; -+ int s, t, bffbeg = 0; - - if (debug) printf("%s\n", pref.lastbook); - -@@ -166,7 +168,7 @@ - system(bff); - - if (!g_file_test(tmpf, G_FILE_TEST_EXISTS)) { -- printf(_("Cannot open temporary file %s\n"), tmpfile); -+ printf(_("Cannot open temporary file %s\n"), tmpf); - g_free(bff); - return; - } -@@ -215,7 +217,9 @@ - GtkWidget *wdg; - GtkAdjustment *adj; - -+#if 0 - if (debug) printf("[scroll] to %.2f\n"); -+#endif - wdg = lookup_widget(MainWindow, "main_scroller"); - adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(wdg)); - if (debug) -@@ -230,7 +234,7 @@ - void - request_page(int nr, GdkPixbuf **pxm, double *w, double *h) - { -- char *p, *bff, *esc; -+ char *p, *bff = NULL, *esc; - int len, i, idx = 0; - - p = (char *)g_list_nth_data(pagelist, nr); ---- cbrpager-0.9.16/src/global.h.debug 2007-06-13 13:44:11.000000000 +0900 -+++ cbrpager-0.9.16/src/global.h 2008-05-23 03:14:28.000000000 +0900 -@@ -43,3 +43,5 @@ - void set_zoom_fit(void); - void fit_page(int w, int h); - void fit_width(int w); -+ -+void set_zoom_width(void); diff --git a/cbrpager.spec b/cbrpager.spec index 8feeba4..b6f32b4 100644 --- a/cbrpager.spec +++ b/cbrpager.spec @@ -1,14 +1,12 @@ Name: cbrpager -Version: 0.9.16 -Release: 2%{?dist} +Version: 0.9.17 +Release: 1%{?dist} Summary: Simple comic book pager for Linux Group: Amusements/Graphics License: GPLv2+ URL: http://www.jcoppens.com/soft/cbrpager/index.en.php Source0: http://downloads.sourceforge.net/cbrpager/%{name}-%{version}.tar.gz -Patch0: cbrpager-0.9.16-remove-critical-warning.patch -Patch1: cbrpager-0.9.16-filen-shell-escaping.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libgnomeui-devel @@ -24,8 +22,6 @@ gif and png images, and you can zoom in and out. %prep %setup -q -%patch0 -p1 -b .debug -%patch1 -p1 -b .filen for f in \ ChangeLog \ @@ -82,6 +78,10 @@ desktop-file-install \ %changelog +* Sat May 24 2008 Mamoru Tasaka - 0.9.17-1 +- 0.9.17 +- 2 patches dropped, upstream applied + * Fri May 23 2008 Mamoru Tasaka - 0.9.16-2 - 0.9.16 - Properly handle file name (shell escaping issue) diff --git a/sources b/sources index 5bd8aae..9015fc3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -add0a550c54f48650f11a4eadaefc540 cbrpager-0.9.16.tar.gz +64c055144297b7162708ce3f0353c3e1 cbrpager-0.9.17.tar.gz