bugGNU Octave - Bugs: bug #54287, [octave forge] (miscellaneous)...

 
 

bug #54287: [octave forge] (miscellaneous) error occurs when running 'units' function

Submitter:  Andrei Bobrov <abobroff>
Submitted:  Wed 11 Jul 2018 05:40:50 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  lostbard
Originator Name:  Andrei Bobrov 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

Thu 12 Jul 2018 01:50:15 PM UTC, comment #11: 

closing as  fixed

John Donoghue <lostbard>
Group Member
Thu 12 Jul 2018 12:04:06 AM UTC, comment #10: 

the actual hg repo for miscellaneous has already been changed back in august, just hasnt had a release since 2014.

John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 11:58:39 PM UTC, comment #9: 

Actually was already pushed up within minutes of the other patch.


http://hg.octave.org/mxe-octave/rev/a08799ef1197


John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 08:38:01 PM UTC, comment #8: 

Good job, works fine now.

Will you close the report after the octave_config_info patch? I suppose that could be an mxe-octave patch for now as only 5.0.0 needs it.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 11 Jul 2018 05:36:46 PM UTC, comment #7: 
John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 04:51:07 PM UTC, comment #6: 

I'll add a patch for octave_config_info as well

John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 04:25:23 PM UTC, comment #5: 

The newer code appears to support lookup in windows based on location of the execuble, so I am hoping to get that working in this case.

John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 02:43:58 PM UTC, comment #4: 

Yeah, hard-coding dependency locations into an application looks unwise and fragile to me. I am curious how you're going to deal with it.

As to he units.m function, I think it is wise to replace the call to octave_config_info() into __octave_config_info__() anyway as the former was deprecated in 4.2 and will be removed after 4.4, and the latter seems to stay.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 11 Jul 2018 01:32:28 PM UTC, comment #3: 

It looks like it broke over a year ago!

I'm working on a fix to units that will get it back to working

In the mean time as per comment #2, overriding the the env vars will work

John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 12:05:54 PM UTC, comment #2: 

Confirmed with Octave-5.0.0 on Win 7.
The lack of octave_config_info is a showstopper on 5.0.0, but that can be worked around, the actual problem lies deeper and I'm unsure whether it is an octave-forge or an mxe-octave cross-build issue.

Firstly, the octave-config_info() call in subfunc check_units (L.115-122) can be replaced by _octave_config_info_().
With that out of the way, I get similar errors:

units: cannot open units data file '/home/philip/devel/octdev/mxe/mxe_64b20180621/usr/x86_64-w64-mingw32/share/units/definitions.units'.  No such file or directory
:


... where Octave-5.0.0's units files on my Windows 7 box live in
C:\Programs\Octave\Octave-5.0.0_20180711\share\units

Clearly the install directories for the cross-build on the linux side (before zipping it up into the installer) get to be hard-coded in the units.exe program, see attached pic.

Next, specifying the units files on the command line gets me this:

>> system ('units -f C:\Programs\Octave\Octave-5.0.0_20180711\share\units\definitions.units')
units: cannot find locale map--program directory not set
ans =  1


.. and asking for program info gives a few clues:

>> system ("units -I")
GNU Units version 2.16
with readline, without utf8, locale Dutch_Netherlands

units program is C:\Programs\Octave\OCTAVE~1.0_2\bin/units.exe

Environment variable UNITSFILE not set
Default units data file is '/home/philip/devel/octdev/mxe/mxe_64b20180621/usr/x86_64-w64-mingw32/s
hare/units/definitions.units'
*** Units data file not found ***

Environment variable MYUNITSFILE not set
Personal units data file is 'C:\Users\philip/unitdef.units'
  (file does not exist)

Default readline history file is 'C:\Users\philip/.units_history'

Environment variable UNITSLOCALEMAP not set
Default locale map is '/home/philip/devel/octdev/mxe/mxe_64b20180621/usr/x86_64-w64-mingw32/share/
units/locale_map.txt'
*** Locale map not found ***


Copyright (C) 2017 Free Software Foundation, Inc.
GNU Units comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Units
under the terms of the GNU General Public License.

ans = 0


Setting the environment variables UNITSFILE and UNITSLOCALEMAP makes the units program and the units function work:

>> setenv ("UNITSFILE", 'C:\Programs\Octave\Octave-5.0.0_20180711\share\units\definitions.units')
>> setenv ("UNITSLOCALEMAP", 'C:\Programs\Octave\Octave-5.0.0_20180711\share\units\locale_map.txt')
>> units ('bar', 'Pa')
ans =  100000


A workaround could be to automatically set these environment variables when the miscellaneous package gets loaded. Quite an involved operation.

I tried adding the actual location of the definitions.units file using units.exe's -f command line option to the template command in L.121 and L.130, to no avail.
Same for the locale.

Adding the setenv() calls to the start of units.m gives:

>> units ('bar','Pa')
units: cannot open units file '/c/Programs/Octave/Octave-5.0.0_20180711/share/units/definitions.units'.  No such file or directory
units: cannot open units file '/c/Programs/Octave/Octave-5.0.0_20180711/share/units/definitions.units'.  No such file or directory
ans =  100000


..so that does work to some extent.

I'm running out of time, hopefully my experiments may help someone to get further.



Philip Nienhuis <philipnienhuis>
Group Member
Wed 11 Jul 2018 11:59:40 AM UTC, comment #1: 

Confirmed

'miscellaneous' runs the units program to to do the conversions and is looking for the units definition file in the cross built path rather than the windows path.


I'll take a look at what changed

John Donoghue <lostbard>
Group Member
Wed 11 Jul 2018 05:40:50 AM UTC, original submission:  


>> units('bar','Pa')

warning: octave_config_info is obsolete and will be removed from a future
version of Octave, please use _have_feature_ or _octave_config_info_
instead.
warning: called from
    octave_config_info at line 43 column 5
    units>check_units at line 110 column 9
    units at line 50 column 3
units: cannot open units data file
'/scratch/build/mxe-octave-w64-32-stable/usr/x86_64-w64-mingw32/share/units/definitions.units'.
No such file or directory
units: cannot open units data file
'/scratch/build/mxe-octave-w64-32-stable/usr/x86_64-w64-mingw32/share/units/definitions.units'.
No such file or directory
units: cannot open units data file
'/scratch/build/mxe-octave-w64-32-stable/usr/x86_64-w64-mingw32/share/units/definitions.units'.
No such file or directory
error: units:
error: called from
    units at line 59 column 5

>>

Andrei Bobrov <abobroff>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #44539:  units_binary.PNG added by philipnienhuis (117KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by abobroff (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-07-12 lostbard StatusReady For Test Fixed
        Assigned toNone lostbard
        Open/ClosedOpen Closed
        Summaryerror when running function 'units' from 'miscellaneous' toolbox [octave forge] (miscellaneous) error occurs when running 'units' function
    2018-07-11 lostbard StatusConfirmed Ready For Test
    2018-07-11 philipnienhuis Attached File- Added units_binary.PNG, #44539
        Item GroupMissed Error or Warning Unexpected Error or Warning
        Assigned tolostbard None
        Release4.4.0 dev
    2018-07-11 lostbard StatusNone Confirmed
        Assigned toNone lostbard

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code