bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Wget MinGW/MSYS build issues


From: Alex
Subject: Re: [Bug-wget] Wget MinGW/MSYS build issues
Date: Tue, 12 Mar 2013 01:49:52 +0200
User-agent: Opera Mail/12.14 (Win32)

 Greetings.
Thanks for quick reply.
During searching info about FILE_FLAG_DELETE_ON_CLOSE find that flag "O_TEMPORARY" work in Windows. What if replace mkstemp() with mkostemp()? ( mkstemp(filename)==mkostemp(filename,0). Need to update bootstrap.conf) And use "mkostemp(filename, O_TEMPORARY);" or direct "mkostemp(filename,0x0040);"
unlink(filename) in warc_tempname then isn't needs any more.
It's work as should in MinGW/Win32 (temporary files exist only during usage).
Can You please check it in *nix?

Best regards, Alex

diff -u -r old/bootstrap.conf ./bootstrap.conf
--- old/bootstrap.conf  2012-07-09 13:09:06 +0200
+++ ./bootstrap.conf    2013-03-12 00:58:56 +0200
@@ -52,6 +52,7 @@
 mbtowc
 mkdir
 mkstemp
+mkostemp
 crypto/md5
 crypto/sha1
 pipe
diff -u -r old/src/warc.c ./src/warc.c
--- old/src/warc.c      2012-11-29 02:22:45 +0200
+++ ./src/warc.c        2013-03-12 01:42:14 +0200
@@ -1144,13 +1144,10 @@
   if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1)
     return NULL;

-  int fd = mkstemp (filename);
+  int fd = mkostemp (filename,0x0040);
   if (fd < 0)
     return NULL;

-  if (unlink (filename) < 0)
-    return NULL;
-
   return fdopen (fd, "wb+");
 }




On Mon, 11 Mar 2013 15:07:09 +0200, Ángel González <address@hidden> wrote:

On 10/03/13 01:30, Alex wrote:
Greetings
1. Wget builded from Git 3be7e0 (as and official 1.14),
compiled on MinGW doesn't work properly with WARC.
wget --warc-file=1 www.google.com
Return error "Could not open temporary WARC manifest file."
Problem in warc_tempfile function with strings
          if (unlink (filename) < 0)
            return NULL;
In MinGW unlink() tries to remove file immediately and cause error if it
still open ( by mkstemp()). In *nix unlink() mark file to be removed after
last handle to the file is closed.
Find function, that must work as *nix unlink() in Win32 Kernel32.dll -
"DeleteFile()", but it does not remove WARC temporary files.
It is possible to do something with it? (Now just comment unlink())

It can be opened with the FILE_FLAG_DELETE_ON_CLOSE flag.
gnulib has several functions already taking that into account, but none
of them seem to support passing a folder.

We should probably ask gnulib for a tmpfile() function which allows a
folder parameter. Otherwise I think we will end up rewriting the same code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]