HTTrack Website Copier
Free software offline browser - FORUM
Subject: Re: Nothing works, "Open error when decompressing"
Author: Xavier Roche
Date: 07/23/2009 19:33
 
> 18:23:23	Error: 	"Open error when decompressing"
> (-1) at link www.appletree.com/people/q (from
> primary/primary)

Ah, darn! This was a longstanding bug I probably managed to reproduce (and
fix). The issue is related to the way httrack uncompress content, using
temporary files on disk. On some situation (when the working directory is a
non-writable directory), the filenames produced by the system are not correct,
and httrack is unable to do any extracting.

This also explain why some users have sometimes files in "C:" (or in other
working directories) ; see the "alien files in C:" thread. I could never
understand what was going on -- this time the issue should be definitely fixed
(I hope)

Can you try again with the 3.43-7 and see is the problem has disappeared
please ?
Thanks for the report, BTW :)

(For the technical details, this is related to tmpnam() use - which creates
filenames relative to the current working directory. tempnam() does the same,
but with absolute path leading directly to the system-generated user's
temporary directory)


Complete diff from the -6 release:
----------------------------------

--- httrack-3.43.6/src/htsback.c        2009-07-18 17:50:42.000000000 +0200
+++ httrack-3.43.7/src/htsback.c        2009-07-23 19:14:13.000000000 +0200
@@ -479,8 +479,23 @@
                                               
back[p].compressed_size=back[p].r.size;
                                                // en mémoire -> passage sur
disque
                                                if (!back[p].r.is_write) {
+#if 1
+#ifdef _WIN32
+#undef tempnam
+#define tempnam _tempnam
+#endif
+              char *const tmp = tempnam(NULL, "httrack_temporaryGzipFile_");
+              if (tmp != NULL) {
+                                                        
strcpybuff(back[p].tmpfile_buffer, tmp);
+                free(tmp);
+                back[p].tmpfile = back[p].tmpfile_buffer;
+              } else {
+                back[p].tmpfile = NULL;
+              }
+#else
                                                       
back[p].tmpfile_buffer[0]='\0';
                                                       
back[p].tmpfile=tmpnam(back[p].tmpfile_buffer);
+#endif
                                                        if (back[p].tmpfile !=
NULL && back[p].tmpfile[0] != '\0') {
                                                               
back[p].r.out=fopen(back[p].tmpfile,"wb");
                                                                if
(back[p].r.out) {
@@ -497,7 +512,7 @@
                                                                } else {
                                                                       
back[p].tmpfile[0]='\0';
                                                                       
back[p].r.statuscode=STATUSCODE_INVALID;
-                                                                      
strcpybuff(back[p].r.msg,"Open error when decompressing");
+                                                                      
strcpybuff(back[p].r.msg,"Open error when decompressing (can not create a
temporary file)");
                                                                }
                                                        }
                                                }
@@ -2719,8 +2734,23 @@
                                 /* .gz are *NOT* depacked!! */
                                
(strfield(get_ext(catbuff,back[i].url_sav),"gz") == 0)
                                 ) {
+#if 1
+#ifdef _WIN32
+#undef tempnam
+#define tempnam _tempnam
+#endif
+                                char *const tmp = tempnam(NULL,
"httrack_temporaryGzipFile_");
+                                if (tmp != NULL) {
+                                  strcpybuff(back[i].tmpfile_buffer, tmp);
+                                  free(tmp);
+                                  back[i].tmpfile = back[i].tmpfile_buffer;
+                                } else {
+                                  back[i].tmpfile = NULL;
+                                }
+#else
                                 back[i].tmpfile_buffer[0]='\0';
-                               
back[i].tmpfile=tmpnam(back[i].tmpfile_buffer);
+                               
back[i].tmpfile=tmpnam(back[p].tmpfile_buffer);
+#endif
                                 if (back[i].tmpfile != NULL &&
back[i].tmpfile[0]) {
                                   if
((back[i].r.out=fopen(back[i].tmpfile,"wb")) == NULL) {
                                     last_errno = errno;
 
Reply Create subthread


All articles

Subject Author Date
Nothing works, "Open error when decompressing"

07/22/2009 03:33
Re: Nothing works, "Open error when decompressing"

07/22/2009 05:56
Re: Nothing works, "Open error when decompressing"

07/22/2009 16:48
Re: Nothing works, "Open error when decompressing"

07/22/2009 21:00
Re: Nothing works, "Open error when decompressing"

07/23/2009 02:32
Re: Nothing works, "Open error when decompressing"

07/23/2009 19:33
Re: Nothing works, "Open error when decompressing"

05/27/2014 11:57




d

Created with FORUM 2.0.11