[packages/wget] Set the 'user.xdg.origin.url' xattr for downloaded files

glen glen at pld-linux.org
Sat Apr 18 20:34:56 CEST 2015


commit 4e0229b5f716a3d9273a85066c5c18cf5a5d0d86
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Apr 18 21:34:34 2015 +0300

    Set the 'user.xdg.origin.url' xattr for downloaded files

 user.xdg.origin.url.patch | 93 +++++++++++++++++++++++++++++++++++++++++++++++
 wget.spec                 |  4 +-
 2 files changed, 96 insertions(+), 1 deletion(-)
---
diff --git a/wget.spec b/wget.spec
index 790177a..b7c0c9c 100644
--- a/wget.spec
+++ b/wget.spec
@@ -18,7 +18,7 @@ Summary(uk.UTF-8):	Утиліта для отримання файлів по п
 Summary(zh_CN.UTF-8):	[通讯]功能强大的下载程序,支持断点续传
 Name:		wget
 Version:	1.16.3
-Release:	1
+Release:	2
 License:	GPL v3+ with OpenSSL exception
 Group:		Networking/Utilities
 Source0:	http://ftp.gnu.org/gnu/wget/%{name}-%{version}.tar.xz
@@ -29,6 +29,7 @@ Patch0:		%{name}-info.patch
 Patch1:		%{name}-wgetrc_path.patch
 Patch2:		%{name}-home_etc.patch
 Patch3:		%{name}-ssl-certs.patch
+Patch4:		user.xdg.origin.url.patch
 URL:		http://www.gnu.org/software/wget/
 BuildRequires:	autoconf >= 2.61
 BuildRequires:	automake >= 1:1.9
@@ -131,6 +132,7 @@ Proxy серверів, настроюваність.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %{__rm} doc/wget.info doc/sample.wgetrc.munged_for_texi_inclusion po/stamp-po
 
diff --git a/user.xdg.origin.url.patch b/user.xdg.origin.url.patch
new file mode 100644
index 0000000..4d1296a
--- /dev/null
+++ b/user.xdg.origin.url.patch
@@ -0,0 +1,93 @@
+From 2c968b81d9d9c4025379242b5f560aab441e1430 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity at gmail.com>
+Date: Sat, 7 Dec 2013 20:45:00 +0200
+Subject: [PATCH] Set the 'user.xdg.origin.url' xattr for downloaded files
+
+---
+ src/ftp.c  |  2 ++
+ src/http.c |  2 ++
+ src/url.c  | 20 ++++++++++++++++++++
+ src/url.h  |  4 ++++
+ 4 files changed, 28 insertions(+)
+
+diff --git a/src/ftp.c b/src/ftp.c
+index 1902242..eeffd88 100644
+--- a/src/ftp.c
++++ b/src/ftp.c
+@@ -1299,6 +1299,8 @@ Error in server response, closing control connection.\n"));
+   else
+     fp = output_stream;
+ 
++  set_xa (u, fileno(fp));
++
+   if (passed_expected_bytes)
+     {
+       print_length (passed_expected_bytes, restval, true);
+diff --git a/src/http.c b/src/http.c
+index 53c9818..c99c417 100644
+--- a/src/http.c
++++ b/src/http.c
+@@ -3123,6 +3123,8 @@ read_header:
+       return err;
+     }
+ 
++  set_xa (u, fileno(fp));
++
+   err = read_response_body (hs, sock, fp, contlen, contrange,
+                             chunked_transfer_encoding,
+                             u->url, warc_timestamp_str,
+diff --git a/src/url.c b/src/url.c
+index df63e1c..b41d5ac 100644
+--- a/src/url.c
++++ b/src/url.c
+@@ -37,6 +37,7 @@ as that of the covered work.  */
+ #include <unistd.h>
+ #include <errno.h>
+ #include <assert.h>
++#include <attr/xattr.h>
+ 
+ #include "utils.h"
+ #include "url.h"
+@@ -2200,6 +2201,25 @@ are_urls_equal (const char *u1, const char *u2)
+   return (*p == 0 && *q == 0 ? true : false);
+ }
+ 
++int
++set_xa (const struct url *origin, int fd)
++{
++  const char *url;
++  int res;
++
++  url = url_string(origin, URL_AUTH_HIDE);
++  res = fsetxattr(fd, XA_ORIGIN, url, strlen(url), 0);
++  if (res != 0)
++    {
++      if (errno == ENOTSUP)
++        res = 0;
++      else
++        logprintf (LOG_NOTQUIET, "fsetxattr: %s\n", strerror (errno));
++    }
++
++  return res;
++}
++
+ #ifdef TESTING
+ /* Debugging and testing support for path_simplify. */
+ 
+diff --git a/src/url.h b/src/url.h
+index b1c46c1..72234e9 100644
+--- a/src/url.h
++++ b/src/url.h
+@@ -132,4 +132,8 @@ bool schemes_are_similar_p (enum url_scheme a, enum url_scheme b);
+ 
+ bool are_urls_equal (const char *u1, const char *u2);
+ 
++#define XA_ORIGIN "user.xdg.origin.url"
++
++int set_xa (const struct url *, int);
++
+ #endif /* URL_H */
+-- 
+2.3.3
+
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/wget.git/commitdiff/4e0229b5f716a3d9273a85066c5c18cf5a5d0d86



More information about the pld-cvs-commit mailing list