bugGNU Octave - Bugs: bug #52242, [octave forge] (io) read_namelist...

 
 

bug #52242: [octave forge] (io) read_namelist fails for some positions of the ending character /

Submitter:  None
Submitted:  Tue 17 Oct 2017 03:00:45 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Brice DAVIER Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 20 Oct 2017 03:00:22 PM UTC, comment #5: 

Sure, I understand.
But as Jordi (core dev) once told me:  "Be brave..."
It's just software after all, nothing can break physically. Patches  & csets still go through a review process anyway.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 20 Oct 2017 02:01:45 PM UTC, comment #4: 

Great!
I didn't want to pull the repo since I never used mercurial before, "diff -u" is what I was looking for (but failed to find...). Will do better next time ;-)

Anonymous
Fri 20 Oct 2017 01:46:10 PM UTC, comment #3: 

Thanks,
I applied your fix here:
http://hg.code.sf.net/p/octave/io/rev/e0b7733c65c1

BTW next time please supply a "diff -u" as Mercurial swallows that more easily (or even better, provide a cset) :-)

Closing report.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 18 Oct 2017 10:41:58 AM UTC, comment #2: 

Attached is a patch including a test based on the one at the bottom of the file.

(file #42188)

Anonymous
Tue 17 Oct 2017 07:58:51 PM UTC, comment #1: 

Thanks for the bug report & patch.

read_namelist.m is not my code, I do very little or even nothing with Fortran these days.
Can you please also add a test? see bottom of read_namelist.m for an example. I think you can base such a test on your example.nml file.

I plan to release 2.4.8 soon, it would be nice to include this fix & test.

Philip Nienhuis <philipnienhuis>
Group Member
Tue 17 Oct 2017 03:00:45 PM UTC, original submission:  

On version 2.4.7 of the io package, the read_namelist function to read Fortran namelist files shows an error when the character ending the namelist (/) is not the first character on its line.

At least on version 4.8.5, gfortran puts a space before the ending / when writing a namelist to a file, causing the error when loading it in octave.
The attached file 'example.nml' was generated with this Fortran code:

    integer :: fu
    integer :: a = 1
    namelist /example/ a
    open(newunit=fu, file='example.nml', status='NEW', action='WRITE')
    write(fu, nml=example)
    close(fu)


The attached patch makes sure the / character is not included in the evaluation of the last variable of the namelist.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #42188:  patch2.diff added by None (457B - text/x-patch - Add a test)
file #42182:  example.nml added by None (28B - application/vnd.enliven)
file #42183:  patch.diff added by None (116B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-07-02 jwe Summary[octave-forge] io: read_namelist fails for some positions of the ending character / [octave forge] (io) read_namelist fails for some positions of the ending character /
    2017-10-20 philipnienhuis StatusNone Fixed
        Assigned toNone philipnienhuis
        Open/ClosedOpen Closed
        Release3.8.2 other
        Operating SystemGNU/Linux Any
        Summaryio package: read_namelist fails for some positions of the ending character / [octave-forge] io: read_namelist fails for some positions of the ending character /
    2017-10-18 None Attached File- Added patch2.diff, #42188
    2017-10-17 None Attached File- Added example.nml, #42182
        Attached File- Added patch.diff, #42183

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code