Re: [Bug-wget] Re: Re: Re: Storing the URL in extended attributes

2010-10-19 Thread Stefan Tomanek
Dies schrieb Michelle Konzack (linux4miche...@tamay-dogan.net):

 The biggest problem was, I was not warned about this mess. Same for The
 Gimp and VLC, mean, I set the diretory permission to 000 and  does  not
 more allow to write to it.  If a program crash because it can not write
 its crap, I deinstall it and will never recommend it to anyone..
 
 Note:   Programs which disallow to disable such things are crap.

Sorry, I fail to see how your stories affect the feature described and
implemented in this patch.



Re: [Bug-wget] Re: Storing the URL in extended attributes

2010-10-18 Thread Stefan Tomanek
Dies schrieb Michelle Konzack (linux4miche...@tamay-dogan.net):

  http://github.com/wertarbyte/wget/tree/xattrurl
 
 I am right that this works only on Windos and not GNU/Linux?
 
 However, such function would be very handy.

Probably the other way around, since I do not have any windows system
in my reach. I am however refining the patch in collaboration with the
curl crowd, making it even more useful. Freedesktop.org has a list
of proposed extended attributes that might be useful:

http://freedesktop.org/wiki/CommonExtendedAttributes



Re: [Bug-wget] Re: Re: Storing the URL in extended attributes

2010-10-18 Thread Stefan Tomanek
Dies schrieb Michelle Konzack (linux4miche...@tamay-dogan.net):

 Does this mean, for each file I download it create an extra file?

No, please read about extended attributes here:
http://en.wikipedia.org/wiki/Extended_attributes#Linux

 Sorry, but such things are not welcome here.
 
 Du you realy think this kind of attr is a good idea?

Do you think SELinux, ACLs etc. are good ideas? They are based on the
same principles.



[Bug-wget] Storing the URL in extended attributes

2010-10-17 Thread Stefan Tomanek
Hello,

I created a patch to store the URL inside the user xattrs of the downloaded
file; this way, its origin can be identified afterwards.

I uploaded the change to my Github account and attached the diff, and I am
still working on portability issues, but I'd like to hear some opinions on
this:

http://github.com/wertarbyte/wget/tree/xattrurl

Sincerly,
Stefan Tomanek
diff --git a/src/Makefile.am b/src/Makefile.am
index ac9c9c9..31d0032 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,7 +50,7 @@ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c		  \
 	   http.h http-ntlm.h init.h log.h mswindows.h netrc.h\
 	   options.h progress.h ptimer.h recur.h res.h retr.h \
 	   spider.h ssl.h sysdep.h url.h utils.h wget.h iri.h 	  \
-	   exits.h gettext.h
+	   exits.h gettext.h xattr.c xattr.h
 nodist_wget_SOURCES = version.c
 EXTRA_wget_SOURCES = mswindows.c iri.c
 LDADD = $(LIBOBJS) ../lib/libgnu.a @MD5_LDADD@
diff --git a/src/Makefile.in b/src/Makefile.in
index 46e9b28..d3b451f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -120,7 +120,7 @@ am__libunittest_a_SOURCES_DIST = cmpt.c connect.c convert.c cookies.c \
 	hash.h host.h html-parse.h html-url.h http.h http-ntlm.h \
 	init.h log.h mswindows.h netrc.h options.h progress.h ptimer.h \
 	recur.h res.h retr.h spider.h ssl.h sysdep.h url.h utils.h \
-	wget.h iri.h exits.h gettext.h test.c test.h
+	wget.h iri.h exits.h gettext.h test.c test.h xattr.c xattr.h
 @iri_is_enabled_t...@am__objects_1 = libunittest_a-iri.$(OBJEXT)
 am__objects_2 = libunittest_a-cmpt.$(OBJEXT) \
 	libunittest_a-connect.$(OBJEXT) \
@@ -159,7 +159,7 @@ am__wget_SOURCES_DIST = cmpt.c connect.c convert.c cookies.c ftp.c \
 	hash.h host.h html-parse.h html-url.h http.h http-ntlm.h \
 	init.h log.h mswindows.h netrc.h options.h progress.h ptimer.h \
 	recur.h res.h retr.h spider.h ssl.h sysdep.h url.h utils.h \
-	wget.h iri.h exits.h gettext.h
+	wget.h iri.h exits.h gettext.h xattr.h xattr.c
 @iri_is_enabled_t...@am__objects_3 = iri.$(OBJEXT)
 am_wget_OBJECTS = cmpt.$(OBJEXT) connect.$(OBJEXT) convert.$(OBJEXT) \
 	cookies.$(OBJEXT) ftp.$(OBJEXT) css.$(OBJEXT) \
@@ -170,6 +170,7 @@ am_wget_OBJECTS = cmpt.$(OBJEXT) connect.$(OBJEXT) convert.$(OBJEXT) \
 	ptimer.$(OBJEXT) recur.$(OBJEXT) res.$(OBJEXT) retr.$(OBJEXT) \
 	snprintf.$(OBJEXT) spider.$(OBJEXT) url.$(OBJEXT) \
 	utils.$(OBJEXT) exits.$(OBJEXT) build_info.$(OBJEXT) \
+	xattr.$(OBJEXT) \
 	$(am__objects_3)
 nodist_wget_OBJECTS = version.$(OBJEXT)
 wget_OBJECTS = $(am_wget_OBJECTS) $(nodist_wget_OBJECTS)
@@ -678,7 +679,7 @@ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c		  \
 	   http.h http-ntlm.h init.h log.h mswindows.h netrc.h\
 	   options.h progress.h ptimer.h recur.h res.h retr.h \
 	   spider.h ssl.h sysdep.h url.h utils.h wget.h iri.h 	  \
-	   exits.h gettext.h
+	   exits.h gettext.h xattr.h xattr.c
 
 nodist_wget_SOURCES = version.c
 EXTRA_wget_SOURCES = mswindows.c iri.c
diff --git a/src/ftp.c b/src/ftp.c
index dfdd83c..4a4e84a 100644
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -51,6 +51,8 @@ as that of the covered work.  */
 #include convert.h/* for downloaded_file */
 #include recur.h  /* for INFINITE_RECURSION */
 
+#include xattr.h
+
 #ifdef __VMS
 # include vms.h
 #endif /* def __VMS */
@@ -1206,6 +1208,11 @@ Error in server response, closing control connection.\n));
   else
 fp = output_stream;
 
+  if (opt.xattr_url  file_exists_p(con-target))
+{
+  set_xattr( u, con-target );
+}
+
   if (passed_expected_bytes)
 {
   print_length (passed_expected_bytes, restval, true);
diff --git a/src/http.c b/src/http.c
index 3a46764..42f7900 100644
--- a/src/http.c
+++ b/src/http.c
@@ -62,6 +62,8 @@ as that of the covered work.  */
 #include convert.h
 #include spider.h
 
+#include xattr.h
+
 #ifdef TESTING
 #include test.h
 #endif
@@ -2359,6 +2361,11 @@ File %s already there; not retrieving.\n\n), quote (hs-local_file));
   else
 fp = output_stream;
 
+  if (opt.xattr_url  file_exists_p(hs-local_file))
+{
+  set_xattr( u, hs-local_file );
+}
+
   /* Print fetch message, if opt.verbose.  */
   if (opt.verbose)
 {
diff --git a/src/init.c b/src/init.c
index 5a05d03..6565655 100644
--- a/src/init.c
+++ b/src/init.c
@@ -252,6 +252,7 @@ static const struct {
 #ifdef USE_WATT32
   { wdebug,   opt.wdebug,cmd_boolean },
 #endif
+  { xattrurl, opt.xattr_url, cmd_boolean },
 };
 
 /* Look up CMDNAME in the commands[] and return its position in the
diff --git a/src/main.c b/src/main.c
index dddc4b2..06e3504 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,6 +55,7 @@ as that of the covered work.  */
 #include convert.h
 #include spider.h
 #include http.h   /* for save_cookies */
+#include xattr.h
 
 #include getopt.h
 #include getpass.h
@@ -258,6 +259,7 @@ static struct cmdline_option option_data[] =
 { retry-connrefused, 0