7 files changed, 17 insertions(+), 418 deletions(-)
M gnu/local.mk
D gnu/packages/patches/xsane-fix-memory-leak.patch
D gnu/packages/patches/xsane-fix-pdf-floats.patch
D gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch
D gnu/packages/patches/xsane-support-ipv6.patch
D gnu/packages/patches/xsane-tighten-default-umask.patch
M gnu/packages/scanner.scm
M gnu/local.mk => gnu/local.mk +0 -5
@@ 2483,11 2483,6 @@ dist_patch_DATA = \
%D%/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch \
%D%/packages/patches/xpra-6.0-systemd-run.patch \
%D%/packages/patches/xpra-6.1-install_libs.patch \
- %D%/packages/patches/xsane-fix-memory-leak.patch \
- %D%/packages/patches/xsane-fix-pdf-floats.patch \
- %D%/packages/patches/xsane-fix-snprintf-buffer-length.patch \
- %D%/packages/patches/xsane-support-ipv6.patch \
- %D%/packages/patches/xsane-tighten-default-umask.patch \
%D%/packages/patches/xterm-370-explicit-xcursor.patch \
%D%/packages/patches/xygrib-fix-finding-data.patch \
%D%/packages/patches/xygrib-newer-proj.patch \
D gnu/packages/patches/xsane-fix-memory-leak.patch => gnu/packages/patches/xsane-fix-memory-leak.patch +0 -34
@@ 1,34 0,0 @@
-From bbd54510f0297afa2d1a81927db060cb0b791f14 Mon Sep 17 00:00:00 2001
-From: Ralph Little <littlesincanada@yahoo.co.uk>
-Date: Sun, 1 Sep 2019 17:34:19 -0700
-Subject: [PATCH] Apply opensuse upstream patch xsane_memory_leak
-
-Removes completely redundant memory allocation.
----
- src/xsane-batch-scan.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/src/xsane-batch-scan.c b/src/xsane-batch-scan.c
-index 90cc0e0..e77caca 100644
---- a/src/xsane-batch-scan.c
-+++ b/src/xsane-batch-scan.c
-@@ -680,7 +680,6 @@ static GtkWidget *xsane_batch_scan_create_list_entry(Batch_Scan_Parameters *para
- GtkWidget *list_item;
- GtkWidget *hbox;
- int size = 120;
-- char *data;
-
- list_item = gtk_list_item_new();
-
-@@ -688,8 +687,6 @@ static GtkWidget *xsane_batch_scan_create_list_entry(Batch_Scan_Parameters *para
- gtk_container_add(GTK_CONTAINER(list_item), hbox);
- gtk_widget_show(hbox);
-
-- data = calloc(size, size);
--
- parameters->gtk_preview = gtk_preview_new(GTK_PREVIEW_COLOR);
- gtk_preview_size(GTK_PREVIEW(parameters->gtk_preview), size, size);
- gtk_box_pack_start(GTK_BOX(hbox), parameters->gtk_preview, FALSE, FALSE, 0);
---
-2.22.0
-
D gnu/packages/patches/xsane-fix-pdf-floats.patch => gnu/packages/patches/xsane-fix-pdf-floats.patch +0 -85
@@ 1,85 0,0 @@
-From c126eea11c4ee39cbe9c0c76f920626b618b6ee9 Mon Sep 17 00:00:00 2001
-From: Ralph Little <littlesincanada@yahoo.co.uk>
-Date: Sun, 1 Sep 2019 17:03:44 -0700
-Subject: [PATCH] Apply debian upstream patch 0135-fix_pdf_floats
-
-Original patch commentary:
-
-Description: Fix floats in PDF and PostScript
- Set LC_NUMERIC to POSIX before printing floats when building
- PostScript or PDF output.
-Author: Julien BLACHE <jblache@debian.org>
-Forwarded: yes
-
-------------
-Looks like float printing format is affected by the current locale.
-Ensures that we always get POSIX formatting of floats.
----
- src/xsane-save.c | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
-diff --git a/src/xsane-save.c b/src/xsane-save.c
-index f14df05..63550cc 100644
---- a/src/xsane-save.c
-+++ b/src/xsane-save.c
-@@ -26,6 +26,8 @@
- #include "xsane-back-gtk.h"
- #include "xsane-front-gtk.h"
- #include "xsane-save.h"
-+#include <locale.h>
-+#include <string.h>
- #include <time.h>
- #include <sys/wait.h>
-
-@@ -2425,6 +2427,7 @@ static void xsane_save_ps_create_image_header(FILE *outfile,
- int flatedecode)
- {
- int depth;
-+ char *save_locale;
-
- depth = image_info->depth;
-
-@@ -2442,8 +2445,15 @@ static void xsane_save_ps_create_image_header(FILE *outfile,
-
- fprintf(outfile, "%d rotate\n", degree);
- fprintf(outfile, "%d %d translate\n", position_left, position_bottom);
-+
-+ save_locale = strdup(setlocale(LC_NUMERIC, NULL));
-+ setlocale(LC_NUMERIC, "POSIX");
-+
- fprintf(outfile, "%f %f scale\n", width, height);
-
-+ setlocale(LC_NUMERIC, save_locale);
-+ free(save_locale);
-+
- fprintf(outfile, "<<\n");
- fprintf(outfile, " /ImageType 1\n");
- fprintf(outfile, " /Width %d\n", image_info->image_width);
-@@ -3921,6 +3931,7 @@ static void xsane_save_pdf_create_page_header(FILE *outfile, struct pdf_xref *xr
- int position_left, position_bottom, box_left, box_bottom, box_right, box_top, depth;
- int left, bottom;
- float rad;
-+ char *save_locale;
-
- DBG(DBG_proc, "xsane_save_pdf_create_page_header\n");
-
-@@ -4035,8 +4046,16 @@ static void xsane_save_pdf_create_page_header(FILE *outfile, struct pdf_xref *xr
-
- fprintf(outfile, "q\n");
- fprintf(outfile, "1 0 0 1 %d %d cm\n", position_left, position_bottom); /* translate */
-+
-+ save_locale = strdup(setlocale(LC_NUMERIC, NULL));
-+ setlocale(LC_NUMERIC, "POSIX");
-+
- fprintf(outfile, "%f %f -%f %f 0 0 cm\n", cos(rad), sin(rad), sin(rad), cos(rad)); /* rotate */
- fprintf(outfile, "%f 0 0 %f 0 0 cm\n", width, height); /* scale */
-+
-+ setlocale(LC_NUMERIC, save_locale);
-+ free(save_locale);
-+
- fprintf(outfile, "BI\n");
- fprintf(outfile, " /W %d\n", image_info->image_width);
- fprintf(outfile, " /H %d\n", image_info->image_height);
---
-2.22.0
-
D gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch => gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch +0 -72
@@ 1,72 0,0 @@
-From 893a5ce1f75e5eea7c8d383038ff92a150819c9c Mon Sep 17 00:00:00 2001
-From: Ralph Little <littlesincanada@yahoo.co.uk>
-Date: Thu, 19 Sep 2019 22:02:33 -0700
-Subject: [PATCH] xsane-*-project.c - reduced snprintf format pad to silence
- warning about too long constrant string for buffer.
-
----
- src/xsane-email-project.c | 4 ++--
- src/xsane-fax-project.c | 4 ++--
- src/xsane-multipage-project.c | 2 +-
- 3 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/src/xsane-email-project.c b/src/xsane-email-project.c
-index f20cb12..ac93fc2 100644
---- a/src/xsane-email-project.c
-+++ b/src/xsane-email-project.c
-@@ -896,7 +896,7 @@ static void xsane_email_project_update_project_status()
- snprintf(filename, sizeof(filename), "%s/xsane-mail-list", preferences.email_project);
- projectfile = fopen(filename, "r+b"); /* r+ = read and write, position = start of file */
-
-- snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
-+ snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
- fprintf(projectfile, "%s\n", buf); /* first line is status of email */
-
- fclose(projectfile);
-@@ -936,7 +936,7 @@ void xsane_email_project_save()
- {
- char buf[TEXTBUFSIZE];
-
-- snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
-+ snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
- fprintf(projectfile, "%s\n", buf); /* first line is status of email */
- gtk_progress_set_format_string(GTK_PROGRESS(xsane.project_progress_bar), _(xsane.email_status));
- xsane_progress_bar_set_fraction(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
-diff --git a/src/xsane-fax-project.c b/src/xsane-fax-project.c
-index f263313..0c60a97 100644
---- a/src/xsane-fax-project.c
-+++ b/src/xsane-fax-project.c
-@@ -452,7 +452,7 @@ static void xsane_fax_project_update_project_status()
- snprintf(filename, sizeof(filename), "%s/xsane-fax-list", preferences.fax_project);
- projectfile = fopen(filename, "r+b"); /* r+ = read and write, position = start of file */
-
-- snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
-+ snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
- fprintf(projectfile, "%s\n", buf); /* first line is status of mail */
-
- fclose(projectfile);
-@@ -498,7 +498,7 @@ void xsane_fax_project_save()
- {
- char buf[TEXTBUFSIZE];
-
-- snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
-+ snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
- fprintf(projectfile, "%s\n", buf); /* first line is status of mail */
- gtk_progress_set_format_string(GTK_PROGRESS(xsane.project_progress_bar), _(xsane.fax_status));
- xsane_progress_bar_set_fraction(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
-diff --git a/src/xsane-multipage-project.c b/src/xsane-multipage-project.c
-index f23e5f8..9392e00 100644
---- a/src/xsane-multipage-project.c
-+++ b/src/xsane-multipage-project.c
-@@ -522,7 +522,7 @@ void xsane_multipage_project_save()
- {
- char buf[TEXTBUFSIZE];
-
-- snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.multipage_status); /* fill 32 characters status line */
-+ snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.multipage_status); /* fill 32 characters status line */
- fprintf(projectfile, "%s\n", buf); /* first line is status of multipage */
- gtk_progress_set_format_string(GTK_PROGRESS(xsane.project_progress_bar), _(xsane.multipage_status));
- xsane_progress_bar_set_fraction(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
---
-2.23.0
-
D gnu/packages/patches/xsane-support-ipv6.patch => gnu/packages/patches/xsane-support-ipv6.patch +0 -153
@@ 1,153 0,0 @@
-From 62d9c172f258769e3a7540fe710e013bb39a704f Mon Sep 17 00:00:00 2001
-From: Ralph Little <littlesincanada@yahoo.co.uk>
-Date: Sat, 7 Sep 2019 12:39:45 -0700
-Subject: [PATCH] Apply opensuse upstream patch 004-ipv6-support
-
-Appears to be related to this:
-https://bugzilla.redhat.com/show_bug.cgi?id=198422
-
------
-Changes email socket connection code to use more IP version agnostic
-calls. It appears to only be used by the scan email option and
-originally comes from the RedHat IPv6 awareness program mentioned
-in the bug report.
-
-In practice, I'm not sure how practical the implementation for emailing
-scans in xsane is as it does not look to support encryption, pretty
-much a given in today's world.
----
- src/xsane-save.c | 96 +++++++++++++++++++++++++++++++-----------------
- 1 file changed, 62 insertions(+), 34 deletions(-)
-
-diff --git a/src/xsane-save.c b/src/xsane-save.c
-index 63550cc..ff3c459 100644
---- a/src/xsane-save.c
-+++ b/src/xsane-save.c
-@@ -31,6 +31,8 @@
- #include <time.h>
- #include <sys/wait.h>
-
-+#include <glib.h>
-+
- /* the following test is always false */
- #ifdef _native_WIN32
- # include <winsock.h>
-@@ -7540,55 +7542,81 @@ void write_email_attach_file(int fd_socket, char *boundary, FILE *infile, char *
- /* returns fd_socket if sucessfull, < 0 when error occured */
- int open_socket(char *server, int port)
- {
-- int fd_socket;
-- struct sockaddr_in sin;
-- struct hostent *he;
-+ int fd_socket, e;
-+
-+ struct addrinfo *ai_list, *ai;
-+ struct addrinfo hints;
-+ gchar *port_s;
-+ gint connected;
-+
-+ memset(&hints, '\0', sizeof(hints));
-+ hints.ai_flags = AI_ADDRCONFIG;
-+ hints.ai_socktype = SOCK_STREAM;
-+
-+ port_s = g_strdup_printf("%d", port);
-+ e = getaddrinfo(server, port_s, &hints, &ai_list);
-+ g_free(port_s);
-
-- he = gethostbyname(server);
-- if (!he)
-+ if (e != 0)
- {
-- DBG(DBG_error, "open_socket: Could not get hostname of \"%s\"\n", server);
-+ DBG(DBG_error, "open_socket: Could not lookup \"%s\"\n", server);
- return -1;
- }
-- else
-+
-+ connected = 0;
-+ for (ai = ai_list; ai != NULL && !connected; ai = ai->ai_next)
- {
-- DBG(DBG_info, "open_socket: connecting to \"%s\" = %d.%d.%d.%d\n",
-- he->h_name,
-- (unsigned char) he->h_addr_list[0][0],
-- (unsigned char) he->h_addr_list[0][1],
-- (unsigned char) he->h_addr_list[0][2],
-- (unsigned char) he->h_addr_list[0][3]);
-- }
-+ gchar hostname[NI_MAXHOST];
-+ gchar hostaddr[NI_MAXHOST];
-+
-+ /* If all else fails */
-+ strncpy(hostname, "(unknown name)", NI_MAXHOST-1);
-+ strncpy(hostaddr, "(unknown address)", NI_MAXHOST-1);
-+
-+ /* Determine canonical name and IPv4/IPv6 address */
-+ (void) getnameinfo(ai->ai_addr, ai->ai_addrlen, hostname, sizeof(hostname),
-+ NULL, 0, 0);
-+ (void) getnameinfo(ai->ai_addr, ai->ai_addrlen, hostaddr, sizeof(hostaddr),
-+ NULL, 0, NI_NUMERICHOST);
-+
-+ DBG(DBG_info, "open_socket: connecting to \"%s\" (\"%s\"): %s\n",
-+ server, hostname, hostaddr);
-
-- if (he->h_addrtype != AF_INET)
-- {
-- DBG(DBG_error, "open_socket: Unknown address family: %d\n", he->h_addrtype);
-- return -1;
-- }
-+ if ((ai->ai_family != AF_INET) && (ai->ai_family != AF_INET6))
-+ {
-+ DBG(DBG_error, "open_socket: Unknown address family: %d\n", ai->ai_family);
-+ continue;
-+ }
-
-- fd_socket = socket(AF_INET, SOCK_STREAM, 0);
-+ fd_socket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
-
-- if (fd_socket < 0)
-- {
-- DBG(DBG_error, "open_socket: Could not create socket: %s\n", strerror(errno));
-- return -1;
-- }
-+ if (fd_socket < 0)
-+ {
-+ DBG(DBG_error, "open_socket: Could not create socket: %s\n", strerror(errno));
-+ continue;
-+ }
-
--/* setsockopt (dev->ctl, level, TCP_NODELAY, &on, sizeof (on)); */
-+ /* setsockopt (dev->ctl, level, TCP_NODELAY, &on, sizeof (on)); */
-
-- sin.sin_port = htons(port);
-- sin.sin_family = AF_INET;
-- memcpy(&sin.sin_addr, he->h_addr_list[0], he->h_length);
-+ if (connect(fd_socket, ai->ai_addr, ai->ai_addrlen) != 0)
-+ {
-+ DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", port, strerror(errno));
-+ continue;
-+ }
-+
-+ /* All went well */
-+ connected = 1;
-+ }
-
-- if (connect(fd_socket, &sin, sizeof(sin)))
-+ if (!connected)
- {
-- DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", ntohs(sin.sin_port), strerror(errno));
-- return -1;
-+ DBG(DBG_info, "open_socket: Could not connect to any address");
-+ return -1;
- }
-
-- DBG(DBG_info, "open_socket: Connected with port %d\n", ntohs(sin.sin_port));
-+ DBG(DBG_info, "open_socket: Connected with port %d\n", port);
-
-- return fd_socket;
-+ return fd_socket;
- }
-
- /* ---------------------------------------------------------------------------------------------------------------------- */
---
-2.22.0
-
D gnu/packages/patches/xsane-tighten-default-umask.patch => gnu/packages/patches/xsane-tighten-default-umask.patch +0 -36
@@ 1,36 0,0 @@
-From 5dc1e301a165709c60c435f00ec9bb6d7d5f21f3 Mon Sep 17 00:00:00 2001
-From: Ralph Little <littlesincanada@yahoo.co.uk>
-Date: Tue, 27 Aug 2019 21:40:02 -0700
-Subject: [PATCH] Apply debian upstream patch 0160-fix_tighten_default_umask
-
-Original patch commentary:
-
-Description: Change default XSane umask from 0007 to 0077
- A default umask of 0007 can be mildly insecure in a multiuser environment,
- so tighten things up a bit and go with 0077 instead.
-Author: Adrien Thebo
-Bug-Debian: http://bugs.debian.org/592972
-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/611950
-
-----
-As above.
----
- src/xsane.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/xsane.h b/src/xsane.h
-index 67f06d4..fa04418 100644
---- a/src/xsane.h
-+++ b/src/xsane.h
-@@ -104,7 +104,7 @@
- #define XSANE_DEBUG_ENVIRONMENT "XSANE_DEBUG"
-
- #define XSANE_PROGRESS_BAR_MIN_DELTA_PERCENT 0.025
--#define XSANE_DEFAULT_UMASK 0007
-+#define XSANE_DEFAULT_UMASK 0077
- #define XSANE_HOLD_TIME 200
- #define XSANE_CONTINUOUS_HOLD_TIME 10
- #define XSANE_DEFAULT_DEVICE "SANE_DEFAULT_DEVICE"
---
-2.22.0
-
M gnu/packages/scanner.scm => gnu/packages/scanner.scm +17 -33
@@ 367,25 367,20 @@ provided the driver also exposes the buttons.")
(license license:gpl2+)))
(define-public xsane
+ (let ((commit "87edc38e6886ad8f31c2b7b289ddf162c88099c8")
+ (revision "0"))
(package
(name "xsane")
- (version "0.999")
+ (version (git-version "0.0.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.com/sane-project/frontend/xsane.git")
- (commit version)))
+ (commit commit)))
(file-name (git-file-name name version))
(sha256
- (base32 "08zvxj7i1s88ckrsqldmsrikc3g62a6p3s3i5b5x4krcfpi3vs50"))
- ;; Apply some important-looking fixes. There are many more unreleased
- ;; commits upstream. A 1.0 release is planned.
- (patches (search-patches "xsane-fix-memory-leak.patch"
- "xsane-fix-pdf-floats.patch"
- "xsane-fix-snprintf-buffer-length.patch"
- "xsane-support-ipv6.patch"
- "xsane-tighten-default-umask.patch"))
+ (base32 "0hgkpb5dfiwrhprsslahrkjfrkg8fgc8f8ssmqng1aywq3sqpd5l"))
(modules '((guix build utils)))
(snippet
#~(begin
@@ 394,39 389,28 @@ provided the driver also exposes the buttons.")
;; by replacing it with a newer (free) copy. We let the build fall
;; back to the system version instead, which appears to work fine.
(delete-file "lib/snprintf.c")
- (substitute* "lib/Makefile.in"
- (("snprintf\\.o ") ""))))))
+ (substitute* "lib/Makefile.am"
+ (("snprintf\\.c ") ""))
+ (substitute* "po/POTFILES.in"
+ (("lib/snprintf\\.c") ""))))))
(build-system gnu-build-system)
(arguments
(list
- #:make-flags
- #~(list (string-append "xsanedocdir=" #$output
- "/share/doc/" #$name "-" #$version))
#:tests? #f ; no test suite
#:phases
#~(modify-phases %standard-phases
- (add-after 'unpack 'patch-invalid-dereference
- ;; Fix the following compilation error with libpng:
- ;; xsane-save.c: In function ‘xsane_save_png’:
- ;; xsane-save.c:4913:21: error: dereferencing pointer to
- ;; incomplete type ‘png_struct {aka struct png_struct_def}’
- ;; if (setjmp(png_ptr->jmpbuf))
- ;; ^
- (lambda _
- (substitute* "src/xsane-save.c"
- (("png_ptr->jmpbuf") "png_jmpbuf(png_ptr)"))))
(add-after 'unpack 'use-sane-help-browser
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/xsane.h"
- (("netscape") (search-input-file inputs "bin/xdg-open")))))
- (add-after 'install 'delete-empty-/sbin
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- (rmdir (string-append out "/sbin"))))))))
+ (("netscape")
+ (search-input-file inputs "bin/xdg-open"))))))))
(native-inputs
- (list pkg-config))
+ (list autoconf-2.71
+ automake
+ gettext-minimal
+ pkg-config))
(inputs
- (list gtk+-2
+ (list gtk+
lcms
libjpeg-turbo
libtiff
@@ 443,4 427,4 @@ as a GIMP plugin to acquire images directly from a scanner.
XSane talks to scanners through the @acronym{SANE, Scanner Access Now Easy}
back-end library, which supports almost all existing scanners.")
- (license license:gpl2+)))
+ (license license:gpl2+))))