bugGNU Octave - Bugs: bug #33652, tmpfile () does not work on MinGW

 
 

bug #33652: tmpfile () does not work on MinGW

Submitter:  Tatsuro MATSUOKA <tmacchant>
Submitted:  Sun 26 Jun 2011 10:10:16 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 29 Jun 2011 08:37:29 AM UTC, comment #8: 


>copy the gnulib directory from the development sources to your 3.4.2 directory tree.
>Run autogen.sh --force


Worked! Thanks!

Tatsuro MATSUOKA <tmacchant>
Wed 29 Jun 2011 03:47:33 AM UTC, comment #7: 

I checked in the changeset on the stable branch.

If you want to get the fix with a 3.4.x tarfile distribution, you can try the following:

copy the gnulib directory from the development sources to your 3.4.2 directory tree.

Run autogen.sh --force

Then you can run configure and make as you normally do.

I'm not sure this procedure will always work properly, but I think it will in this case.


John W. Eaton <jwe>
Group administrator
Wed 29 Jun 2011 12:27:35 AM UTC, comment #6: 

Hello John
I have attached your patch to the development source.

The result is

octave.exe:1> tmpfile()
ans =  3

and test for 'pr-output.cc' was successful.

Please push the patch to the development source.

BTW, if possible, please tell me the way to this for 3.2.4  source.
Change in src/file-io.cc is easy but I cannot find out how to change gnulib related tmpfile.

1. copy libgnu/tmpfile from created in dev-source tree to
 octave-3.4 2 libgnu directory.

2. modify bootstrap.conf (add 'tmpfile')
3. execute autogen.sh at 3.4.2 source root directory.

Am I right?

Tatsuro MATSUOKA <tmacchant>
Tue 28 Jun 2011 02:31:46 AM UTC, comment #5: 

Oops, I think my first attempt at a patch was incomplete.  Try the changeset in diffs-2.txt instead.

(file #23578)

John W. Eaton <jwe>
Group administrator
Tue 28 Jun 2011 02:12:07 AM UTC, comment #4: 

Looking here:

http://msdn.microsoft.com/en-us/library/x8x7sakw%28v=vs.80%29.aspx

I see


The tmpfile function creates a temporary file and returns a pointer to that stream. The temporary file is created in the root directory. To create a temporary file in a directory other than the root, use tmpnam or tempnam in conjunction with fopen.


Do you have permission to write in the "root directory"?

Also, why isn't the tmpfile function from gnulib being used?  There seems to be a version there for Windows, so I'm surprised that it is not used.

Hmm, maybe it is because we aren't asking for it.  Can you please try the attached changeset and see if it helps?  You'll need to run autogen and configure again after applying it

(file #23577)

John W. Eaton <jwe>
Group administrator
Tue 28 Jun 2011 01:28:25 AM UTC, comment #3: 


>>Can you run Octave with gdb and set a breakpoint in the gnulib tmpfile function and find out why it is failing for you?



Results are

$ ./run-octave -g

<snip>

(gdb) break tmpfile
Function "tmpfile" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (tmpfile) pending.

<snip>

(gdb) run

<snip>


<snip>

octave.exe:1> tmpfile()

octave.exe:1> tmpfile()

Breakpoint 1, 0x662ac2b8 in tmpfile () from e:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-3.4.2\src\.libs\liboctinterp-0.dll
(gdb) step
Single stepping until exit from function tmpfile,
which has no line number information.
0x77339581 in tmpfile () from C:\Windows\syswow64\msvcrt.dll
(gdb) step
Single stepping until exit from function tmpfile,
which has no line number information.
0x77339340 in tmpnam () from C:\Windows\syswow64\msvcrt.dll
(gdb) step
Single stepping until exit from function tmpnam,
which has no line number information.
ans = -1

*********************

This error might be win64 specific. (While gcc-4.5.2 is 32bit compiler).

I will work another machine. (Win XP 32 bit)


I will

Tatsuro MATSUOKA <tmacchant>
Mon 27 Jun 2011 05:36:19 PM UTC, comment #2: 

Looking at the tmpfile function in file-io.cc, it just calls


FILE *fid = tmpfile ();


to do the real work, and that is a function that on Windows systems you should be getting from gnulib.  Can you run Octave with gdb and set a breakpoint in the gnulib tmpfile function and find out why it is failing for you?

John W. Eaton <jwe>
Group administrator
Sun 26 Jun 2011 10:17:31 PM UTC, comment #1: 

I have tested further.

*******************************
octave:3> [FID, MSG] = tmpfile ()
FID = -1
MSG = Permission denied
*******************************

My environments is windows 7 Home Premium 64 bit.

Tatsuro MATSUOKA <tmacchant>
Sun 26 Jun 2011 10:10:16 PM UTC, original submission:  

Hello

In the 'make check' test, the below occurred.
 pr-output.cc  PASS    0/1 FAIL 1
********************************

>>>>> pr-output.cc

  *** test
format short
fd = tmpfile ();
for r = [0, Inf -Inf, NaN]
   for i = [0, Inf -Inf, NaN]
     fdisp (fd, complex (r, i));
   endfor
endfor
fclose (fd);
!!!!! test failed
fdisp: invalid stream number = -1
***********************************

I have execute
*******************************
octave.exe:1> fd = tmpfile ()
fd = -1
octave.exe:2> fdisp(fd,1)
error: fdisp: invalid stream number = -1
********************************

This happens octave-dev source on 201-06-24 and 3.2.4rc2.

Tatsuro MATSUOKA <tmacchant>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #23578:  diffs-2.txt added by jwe (797B - text/plain)
file #23577:  diffs.txt added by jwe (525B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by tmacchant (Submitted the item)
  • -email is unavailable- added by tmacchant
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-06-29 jwe StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2011-06-28 jwe Attached File- Added diffs-2.txt, #23578
    2011-06-28 jwe Attached File- Added diffs.txt, #23577
    2011-06-27 jwe StatusNone Need Info
    2011-06-26 tmacchant Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code