diff --git a/.cvsignore b/.cvsignore index c58bc3f..44df8e9 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -cbrpager-0.9.15.tar.gz +cbrpager-0.9.16.tar.gz diff --git a/cbrpager-0.9.15-remove-critical-warning.patch b/cbrpager-0.9.15-remove-critical-warning.patch deleted file mode 100644 index 92c88a8..0000000 --- a/cbrpager-0.9.15-remove-critical-warning.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- cbrpager-0.9.15/src/global.c.debug 2005-10-10 14:12:01.000000000 +0900 -+++ cbrpager-0.9.15/src/global.c 2008-03-21 23:35:43.000000000 +0900 -@@ -28,6 +28,8 @@ - #include - #include - -+#include -+ - #include "support.h" - #include "interface.h" - #include "global.h" -@@ -138,9 +140,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); - -@@ -165,7 +167,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\n")); - g_free(bff); - return; - } -@@ -214,7 +216,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) -@@ -229,7 +233,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.15/src/global.h.debug 2005-09-06 00:42:14.000000000 +0900 -+++ cbrpager-0.9.15/src/global.h 2008-03-21 23:38:17.000000000 +0900 -@@ -42,3 +42,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-0.9.16-filen-shell-escaping.patch b/cbrpager-0.9.16-filen-shell-escaping.patch new file mode 100644 index 0000000..080fdb2 --- /dev/null +++ b/cbrpager-0.9.16-filen-shell-escaping.patch @@ -0,0 +1,193 @@ +--- 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 17:11:33.000000000 +0900 +@@ -36,6 +36,12 @@ + #include "conf.h" + #include "main.h" + ++#include ++#include /* creat */ ++#include ++#include ++#include /* wait */ ++ + GList *pagelist = NULL; + int page_nr = 0, + timer_id = 0, +@@ -144,19 +150,23 @@ + char *bff, *p = NULL, **names; + gboolean first = TRUE; + int s, t, bffbeg = 0; ++ int pfd[2]; /* pipe */ ++ int pid_i, pid_j; /* two children*/ ++ int wait_i, wait_j; /* waiting pid */ ++ char cmd[3][20]; + + 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); ++ sprintf(cmd[0], "%s", "unzip"); ++ sprintf(cmd[1], "%s", "-l"); ++ sprintf(cmd[2], "ZIP command:"); + 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); ++ sprintf(cmd[0], "%s", "unrar"); ++ sprintf(cmd[1], "%s", "v"); ++ sprintf(cmd[2], "RAR command:"); + break; + default: // Patch from Ilja Pyykkonen 2005/09/04 + p = g_strdup_printf(_("Cannot open file '%s': unknown file type"), +@@ -165,7 +175,77 @@ + 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]); ++ if (debug) fprintf(stderr, "%s %s %s %s\n", ++ cmd[2], cmd[0], cmd[1], pref.lastbook); ++ execlp(cmd[0], cmd[0], cmd[1], pref.lastbook, 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 */ ++ int new_fd; ++ ++ close(pfd[1]); ++ close(0); /* close stdin */ ++ if (dup(pfd[0]) != 0) { ++ fprintf(stderr, "Dup failure\n"); ++ return; ++ } ++ close(pfd[0]); ++ /* create tmpf */ ++ if ((new_fd = creat(tmpf, 00600)) == -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(new_fd) != 1) { ++ fprintf(stderr, "Dup failure\n"); ++ return; ++ } ++ close(new_fd); ++ execlp("grep", "grep", all_extensions, NULL); ++ return; /* should not reach here */ ++ } ++ else { /* parent */ ++ close(pfd[0]); ++ close(pfd[1]); ++ /* wait children */ ++ wait_i = wait(0); ++ wait_j = wait(0); ++ if (!((wait_i == pid_i && wait_j == pid_j) || ++ (wait_i == pid_j && wait_j == pid_i))) { ++ fprintf(stderr, "Forked children status strange\n"); ++ return; ++ } ++ ++ } ++ } ++ bff = NULL; + + if (!g_file_test(tmpf, G_FILE_TEST_EXISTS)) { + printf(_("Cannot open temporary file %s\n"), tmpf); +@@ -236,7 +316,10 @@ + { + char *p, *bff = NULL, *esc; + int len, i, idx = 0; +- ++ ++ int pid; ++ int fd; ++ + p = (char *)g_list_nth_data(pagelist, nr); + len = strlen(p); + esc = g_malloc(2*len + 1); +@@ -254,21 +337,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 ((fd = creat(tmpf, 00600)) == -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(fd) != 1) { ++ fprintf(stderr, "Dup failure\n"); ++ return; ++ } ++ close(fd); ++ switch(pref.booktype) { ++ case RAR_FILE: ++ execlp("unrar", ++ "unrar", "p", "-ierr", "-clr", "--", ++ pref.lastbook, p, NULL); ++ return; /* should not reach here */ ++ case ZIP_FILE: ++ execlp("unzip", ++ "unzip", "-p", "-C", ++ pref.lastbook, p, NULL); ++ return; /* should not return 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 new file mode 100644 index 0000000..f0ee84b --- /dev/null +++ b/cbrpager-0.9.16-remove-critical-warning.patch @@ -0,0 +1,59 @@ +--- 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 81c1146..cb6e405 100644 --- a/cbrpager.spec +++ b/cbrpager.spec @@ -1,5 +1,5 @@ Name: cbrpager -Version: 0.9.15 +Version: 0.9.16 Release: 1%{?dist} Summary: Simple comic book pager for Linux @@ -7,7 +7,8 @@ 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.15-remove-critical-warning.patch +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 @@ -23,7 +24,8 @@ gif and png images, and you can zoom in and out. %prep %setup -q -%patch0 -p1 -b .warn +%patch0 -p1 -b .debug +%patch1 -p1 -b .filen for f in \ ChangeLog \ @@ -80,6 +82,10 @@ desktop-file-install \ %changelog +* Fri May 23 2008 Mamoru Tasaka - 0.9.16-1 +- 0.9.16 +- Properly handle file name (shell escaping issue) + * Fri Mar 21 2008 Mamoru Tasaka - 0.9.15-1 - Initial packaging diff --git a/sources b/sources index e67f564..5bd8aae 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ae0ded67962f06e0511dd7d4c4777e13 cbrpager-0.9.15.tar.gz +add0a550c54f48650f11a4eadaefc540 cbrpager-0.9.16.tar.gz