bugGNU Octave - Bugs: bug #41330, fopen (<fname>,...

 
 

bug #41330: fopen (<fname>, "w") creates temp file with different file name

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Fri 24 Jan 2014 09:26:24 AM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Philip NienhuisOpen/Closed: Closed
Release: devOperating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 24 Jan 2014 10:09:15 PM UTC, comment #4:

Thanks, that trick will help simplifying the code (no more need to track temp file names)

Philip Nienhuis <philipnienhuis>
Project Member
Fri 24 Jan 2014 10:13:36 AM UTC, comment #3:

Try

John W. Eaton <jwe>
Project Administrator
Fri 24 Jan 2014 10:06:54 AM UTC, comment #2:

Turns out the whole bug is invalid, sorry.
(Maybe I shouldn't work too long evenings on Octave).

The question below still stands - how to get the file name associated with a file handle)

Philip Nienhuis <philipnienhuis>
Project Member
Fri 24 Jan 2014 09:31:55 AM UTC, comment #1:

Oops - the second example obviously works correct as fopen should have been called with tmpfil

Philip Nienhuis <philipnienhuis>
Project Member
Fri 24 Jan 2014 09:26:24 AM UTC, original submission:

(Also present in 3.8.0 mingw mxe-cross-built)

Steps to reproduce:

- Put attached script tmpf.m & file template.ods into same subdir.
(tmpf.m reproduced below for clarity:

- Run tmpf.m, note name of temp file <tmpfil> (e.g., /path/to/temp/dir/oct-3)

- Watch contents of temp directory: I get a file called oct-4 instead of oct-3.

It turns out I can very reliably reproduce this on my XP and Win 7 boxes at home.

Furthermore,

...gets me a temp file called 'oct-24" rather than "oct-21".

The effect is that unlinking temp files gets a bit hard, so over time the temp dir gets cluttered with tens or hundreds of temp files.

As to reproducability:
Sometimes this works OK. But once some unknown condition ("nasal demon"? thanks Jordi for that term!) has been triggered, the above behavior is consistent, also over restarts of Octave.
(Sorry for guessing) I can't put a finger on it, but maybe it is due to the unpack statement of the .ods file (effectively a plain .zip file with .ods suffix). Or maybe it is related to a timing issue in the OS.

Is there a way to find out the file name associated with a particular file handle, or to delete a file by its file handle? That would make it easier to delete temp files and could be a good workaround for this bug.

Philip Nienhuis <philipnienhuis>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #30360:  tmpf.m added by philipnienhuis (194B - text/x-matlab)
file #30361:  template.ods added by philipnienhuis (7KiB - application/vnd.oasis.opendocument.spreadsheet)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 24 Jan 2014 10:06:54 AM UTCphilipnienhuisStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Fri 24 Jan 2014 09:26:24 AM UTCphilipnienhuisAttached File-=>Added tmpf.m, #30360
      Attached File-=>Added template.ods, #30361

    Back to the top


    Powered by Savane 3.1-cleanup1