Re: [Bug-wget] Download files and preserve their data and time
Ray Satiro raysat...@yahoo.com writes: Calling utime() works. You could also use SetFileTime(). 2489 changed utime to utimes but the CRT doesn't have utimes. thanks to have checked it. I am going to apply the patch below. Cheers, Giuseppe === modified file 'configure.ac' --- configure.ac2011-08-11 10:20:25 + +++ configure.ac2011-08-25 09:01:31 + @@ -197,7 +197,7 @@ AC_FUNC_FSEEKO AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48) AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc) -AC_CHECK_FUNCS(sleep symlink) +AC_CHECK_FUNCS(sleep symlink utime) if test x$ENABLE_OPIE = xyes; then AC_LIBOBJ([ftp-opie]) === modified file 'src/utils.c' --- src/utils.c 2011-08-11 12:23:39 + +++ src/utils.c 2011-08-25 09:22:03 + @@ -42,15 +42,23 @@ #ifdef HAVE_PROCESS_H # include process.h /* getpid() */ #endif -#ifdef HAVE_UTIME_H -# include utime.h -#endif #include errno.h #include fcntl.h #include assert.h #include stdarg.h #include locale.h +#if HAVE_UTIME +# include sys/types.h +# ifdef HAVE_UTIME_H +# include utime.h +# endif + +# ifdef HAVE_SYS_UTIME_H +# include sys/utime.h +# endif +#endif + #include sys/stat.h /* For TIOCGWINSZ and friends: */ @@ -487,6 +495,20 @@ void touch (const char *file, time_t tm) { +#if HAVE_UTIME +# ifdef HAVE_STRUCT_UTIMBUF + struct utimbuf times; +# else + struct { +time_t actime; +time_t modtime; + } times; +# endif + times.modtime = tm; + times.actime = time (NULL); + if (utime (file, times) == -1) +logprintf (LOG_NOTQUIET, utime(%s): %s\n, file, strerror (errno)); +#else struct timespec timespecs[2]; int fd; @@ -506,6 +528,7 @@ logprintf (LOG_NOTQUIET, futimens(%s): %s\n, file, strerror (errno)); close (fd); +#endif } /* Checks if FILE is a symbolic link, and removes it if it is. Does
Re: [Bug-wget] Download files and preserve their data and time
From: Ray Satiro raysat...@yahoo.com From: David H. Lipman dlip...@verizon.net Subject: Re: [Bug-wget] Download files and preserve their data and time To: bug-wget@gnu.org Date: Tuesday, August 23, 2011, 4:38 PM From: Giuseppe Scrivano gscriv...@gnu.org WinXP/Vista -- Win32 Y:\wget --version GNU Wget 1.12-2504 built on mingw32. the change introduced by the revision gscriv...@gnu.org-20110419103346-cctazi0zxt2770wt could be the reason of the problem you have reported. Calling utime() works. You could also use SetFileTime(). 2489 changed utime to utimes but the CRT doesn't have utimes. I recompiled 1.13.1 and patched for the http.c fixes from 2544 and 2541, and patched utils using the touch() prior to 2489 for WINDOWS. This is a test build and I uploaded it here: http://sourceforge.net/projects/getgnuwin32/files/getgnuwin32/test%20builds/wget-1.13.1.patched.zip/download I tried Giuseppe's example: wget -q -d http://www.gnu.org/graphics/gnu-head-mini.png 21 | grep ^Last-Mo Last-Modified: Sun, 05 Dec 2010 20:58:51 GMT dir /tw gnu-head-mini.png [...] 12/05/2010 03:58 PM 423 gnu-head-mini.png Also I notice the changes in 2533 require static openssl libs for testing checking for EVP_MD_CTX_init in -leay32... yes checking for SSL_connect in -lssl32... yes configure: Enabling support for SSL via OpenSSL (shared) checking for libssl... no configure: error: --with-ssl=openssl was given, but SSL is not available. I think regardless of whether libssl is there if eay32 and ssl32 are there then it should link to the dlls and not need to test ssl and crypto. Thanks AWESOME - Thanx ! I tried it and it worked as expected. The file had its server date and not the download date and time. -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp
Re: [Bug-wget] Download files and preserve their data and time
David H. Lipman dlip...@verizon.net writes: I don't know when it happened, probably when I upgraded WGET, but when I download files thedy inherit the date and time of the file of when they were downloaded. It used to be that when the file was downloaded, it retained the date and time of the file it had on the server. Not when it was downloaded. How can I force WGET to return to that condition ? it has to work in the same way as it used to do. It seems to work well here, using the last revision from the source repository: $ LANG=C ./wget -q -d http://www.gnu.org/graphics/gnu-head-mini.png 21 | grep ^Last-Modified Last-Modified: Sun, 05 Dec 2010 20:58:51 GMT $ LANG=C stat gnu-head-mini.png | grep ^Modify Modify: 2010-12-05 21:58:51.0 +0100 Can you please provide more information? What version of wget (wget --version)? What operating system? Do you get a different output using that two commands? This is also useful for debugging, do you see something different? $ LANG=C strace -e utimensat ./wget -q http://www.gnu.org/graphics/gnu-head-mini.png utimensat(4, NULL, {{1313833704, 0}, {1291582731, 0}}, 0) = 0 Thanks, Giuseppe
Re: [Bug-wget] Download files and preserve their data and time
From: Giuseppe Scrivano gscriv...@gnu.org David H. Lipman dlip...@verizon.net writes: I don't know when it happened, probably when I upgraded WGET, but when I download files thedy inherit the date and time of the file of when they were downloaded. It used to be that when the file was downloaded, it retained the date and time of the file it had on the server. Not when it was downloaded. How can I force WGET to return to that condition ? it has to work in the same way as it used to do. It seems to work well here, using the last revision from the source repository: $ LANG=C ./wget -q -d http://www.gnu.org/graphics/gnu-head-mini.png 21 | grep ^Last-Modified Last-Modified: Sun, 05 Dec 2010 20:58:51 GMT $ LANG=C stat gnu-head-mini.png | grep ^Modify Modify: 2010-12-05 21:58:51.0 +0100 Can you please provide more information? What version of wget (wget --version)? What operating system? Do you get a different output using that two commands? This is also useful for debugging, do you see something different? $ LANG=C strace -e utimensat ./wget -q http://www.gnu.org/graphics/gnu-head-mini.png utimensat(4, NULL, {{1313833704, 0}, {1291582731, 0}}, 0) = 0 Thanks, Giuseppe WinXP/Vista -- Win32 Y:\wget --version GNU Wget 1.12-2504 built on mingw32. +digest +https +ipv6 +iri -large-file +nls -ntlm +opie +ssl/openssl Wgetrc: C:\wgetrc.txt (env) c:/wget/root/etc/wgetrc (system) Locale: c:/wget/root/share/locale Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC=/c/wget/root/etc/wgetrc -DLOCALEDIR=/c/wget/root/share/locale -I. -I../lib -I../lib -I/c/wget/root/include -I/c/wget/root/include -O2 -Wall Link: gcc -O2 -Wall -L/c/wget/root/lib /c/wget/root/lib/libiconv.dll.a /c/wget/root/lib/libintl.dll.a -L/mingw/lib /c/wget/root/lib/libiconv.dll.a -lssl32 -leay32 -lz -lws2_32 -lidn ftp-opie.o mswindows.o openssl.o ../lib/libgnu.a Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://www.gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Originally written by Hrvoje Niksic hnik...@xemacs.org. Please send bug reports and questions to bug-wget@gnu.org. -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp
Re: [Bug-wget] Download files and preserve their data and time
David H. Lipman dlip...@verizon.net writes: WinXP/Vista -- Win32 Y:\wget --version GNU Wget 1.12-2504 built on mingw32. the change introduced by the revision gscriv...@gnu.org-20110419103346-cctazi0zxt2770wt could be the reason of the problem you have reported. If it is possible for you to compile wget, could you try to revert this patch? Does it solve the problem for you? If you have problems to re-build wget then I'll try to setup the environment here. Thanks, Giuseppe === modified file 'bootstrap.conf' --- bootstrap.conf 2011-04-19 09:31:25 + +++ bootstrap.conf 2011-04-19 10:33:46 + @@ -30,9 +30,11 @@ announce-gen bind c-ctype +clock-time close connect fcntl +futimens getaddrinfo getopt-gnu getpass-gnu === modified file 'src/Makefile.am' --- src/Makefile.am 2011-04-03 22:13:53 + +++ src/Makefile.am 2011-04-19 10:33:46 + @@ -37,7 +37,7 @@ # The following line is losing on some versions of make! DEFS = @DEFS@ -DSYSTEM_WGETRC=\$(sysconfdir)/wgetrc\ -DLOCALEDIR=\$(localedir)\ -LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ +LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME) bin_PROGRAMS = wget wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c\ === modified file 'src/utils.c' --- src/utils.c 2011-04-18 12:37:42 + +++ src/utils.c 2011-04-19 10:33:46 + @@ -51,8 +51,7 @@ #include stdarg.h #include locale.h -#include sys/time.h - +#include sys/stat.h /* For TIOCGWINSZ and friends: */ #ifdef HAVE_SYS_IOCTL_H @@ -488,15 +487,25 @@ void touch (const char *file, time_t tm) { - struct timeval timevals[2]; - - timevals[0].tv_sec = time (NULL); - timevals[0].tv_usec = 0L; - timevals[1].tv_sec = tm; - timevals[1].tv_usec = 0L; - - if (utimes (file, timevals) == -1) -logprintf (LOG_NOTQUIET, utimes(%s): %s\n, file, strerror (errno)); + struct timespec timespecs[2]; + int fd; + + fd = open (file, O_WRONLY); + if (fd 0) +{ + logprintf (LOG_NOTQUIET, open(%s): %s\n, file, strerror (errno)); + return; +} + + timespecs[0].tv_sec = time (NULL); + timespecs[0].tv_nsec = 0L; + timespecs[1].tv_sec = tm; + timespecs[1].tv_nsec = 0L; + + if (futimens (fd, timespecs) == -1) +logprintf (LOG_NOTQUIET, futimens(%s): %s\n, file, strerror (errno)); + + close (fd); } /* Checks if FILE is a symbolic link, and removes it if it is. Does === modified file 'tests/Makefile.am' --- tests/Makefile.am 2011-04-03 22:13:53 + +++ tests/Makefile.am 2011-04-19 10:33:46 + @@ -34,7 +34,7 @@ PERL = perl PERLRUN = $(PERL) -I$(srcdir) -LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ +LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME) .PHONY: test run-unit-tests run-px-tests
Re: [Bug-wget] Download files and preserve their data and time
From: Giuseppe Scrivano gscriv...@gnu.org David H. Lipman dlip...@verizon.net writes: WinXP/Vista -- Win32 Y:\wget --version GNU Wget 1.12-2504 built on mingw32. the change introduced by the revision gscriv...@gnu.org-20110419103346-cctazi0zxt2770wt could be the reason of the problem you have reported. If it is possible for you to compile wget, could you try to revert this patch? Does it solve the problem for you? If you have problems to re-build wget then I'll try to setup the environment here. Thank you but, not possible. I hung my hat on MASM and compiling loong ago. -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp
[Bug-wget] Download files and preserve their data and time
I don't know when it happened, probably when I upgraded WGET, but when I download files thedy inherit the date and time of the file of when they were downloaded. It used to be that when the file was downloaded, it retained the date and time of the file it had on the server. Not when it was downloaded. How can I force WGET to return to that condition ? -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp