[Bug 2292] New: Corrupted file problem Wine20040613,20040505 with Xilinx XST 6.2i

Wine Bugs wine-bugs at winehq.org
Thu Jun 17 12:35:03 CDT 2004


http://bugs.winehq.org/show_bug.cgi?id=2292

           Summary: Corrupted file problem Wine20040613,20040505 with Xilinx
                    XST 6.2i
           Product: Wine
           Version: CVS
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: wine-files
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: Oli1417 at gmx.net


I've a strange problem with Xilinx XST (ISE) 6.2i, a 
Software for FPGA developement. A sort of silicon compiler
for Xilinx Fpgas chips.

System is: Suse 9.1, Linux cassix 2.6.4-52-default #1 Wed Apr 7 
02:08:30 UTC 2004 i686 i686 i386 GNU/Linux

The XST program while running  usually does a lot of file processing 
and creates libraries-files etc and so on.

One of those files is a simple ascii file called "hdllib.ref". It 
usually looks like more or less like this, size around some k-bytes.

[...]
AR hex2led hex2led_arch F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl09
EN hex2led NULL F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl08
AR smallcntr inside F:/Test/watchvhd_u/smallcntr.vhd sub00/vhpl01
[...]

When I'm running the XST program with wine, this file gets corrupted 
by leading zero-bytes in the beginning of the file:

[0x00 0x00 0x00 0x00 ... all bytes are zero until some time the 
text starts.]
AR hex2led hex2led_arch F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl09
EN hex2led NULL F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl08
AR smallcntr inside F:/Test/watchvhd_u/smallcntr.vhd sub00/vhpl01
[...]

I debugged a bit and found out, that this file is 'rewritten' several
times during the program run (see debugging output below).

The problem seems to be, that each time is written new, the new data
is appended to the end of the file, instead of being put in the 
beginning !? For some reason the previous data in the file is put to 0x00.

The problem does not occure under Win XP.

While debugging I grepped through the wine source, to track down
what's happening -  I don't know the wine internals at all (now more
then before) - and changed following file:

wine20040613/wine/server/file.c
[...]
static struct object *create_file( const char *nameptr, size_t len, unsigned 
int access,
                                   unsigned int sharing, int create, unsigned 
int options,
                                   unsigned int attrs )
[...]
    switch(create)
    {
    case FILE_CREATE:       flags = O_CREAT | O_EXCL; break;
    case FILE_OVERWRITE_IF: /* FIXME: the difference is whether we trash 
existing attr or not */
    case FILE_SUPERSEDE:    flags = O_CREAT | O_TRUNC; break;
    case FILE_OPEN:         flags = 0; break;

    case FILE_OPEN_IF:      flags = O_CREAT | O_TRUNC; break; 
				            ^^^^^^^^^ CHANGED here
					    
    case FILE_OVERWRITE:    flags = O_TRUNC; break;
    default:                set_error( STATUS_INVALID_PARAMETER ); goto error;
    }


=>> Now it works ;) !?!?  

Well - I know that in fact I don't know really what I did (that's life)
 ... perhaps I did break something else now.

But it might give a hint for the Wine Pros here, for a possible 
improvement. IT'S A GREAT PROJECT BTW!!!
 
Fell free to ask for more info, in case.

Cheerio,

Oliver

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list