bugGNU Octave - Bugs: bug #39392, geometry package:...


bug #39392: geometry package: loading/unloading the package may clobber user variables

Submitted by:  Rafael Laboissiere <rlaboiss>
Submitted on:  Tue 02 Jul 2013 06:40:56 AM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  other Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

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


( Jump to the original submission)

Tue 12 Apr 2016 11:52:29 AM UTC, comment #6: 

This was fixed some weeks ago as part of bug #47503 (see http://hg.code.sf.net/p/octave/geometry/rev/5850349b8181 )

Carnë Draug <carandraug>
Project Member
Sun 28 Jul 2013 09:23:33 PM UTC, comment #5: 

It is a good idea.
I will do this asap.


Juan Pablo Carbajal <juanpi>
Project Member
Sun 28 Jul 2013 06:50:40 PM UTC, comment #4: 

Yes, this is an elegant solution.  I would just suggest to use "internal" names like _pkg_add_geometry_ and __pkg_del_geometry.

Rafael Laboissiere <rlaboiss>
Sun 28 Jul 2013 06:33:26 PM UTC, comment #3: 

The function would be in the very own PKG_ADD script. All of it could be turned into a functin which is then called at the end, i.e., the PKG_ADD file becomes

function pkg_add_geometry
  ## all of the code that is currently in PKG_ADD
pkg_add_geometry ();

Carnë Draug <carandraug>
Project Member
Wed 03 Jul 2013 05:45:56 PM UTC, comment #2: 

I have thought about this, but where would such a function be placed?

Rafael Laboissiere <rlaboiss>
Wed 03 Jul 2013 03:46:47 PM UTC, comment #1: 

Maybe an even "cleaner" alternative could be to place the whole code in PKG_ADD into a function, which is just called at the end of it?

Carnë Draug <carandraug>
Project Member
Tue 02 Jul 2013 06:40:56 AM UTC, original submission:  

When loading/unloading the geometry package, some variables defined by the users may be clobbered, like in the example below:

octave:1> pkg unload geometry
octave:2> ii = 0;
octave:3> pkg load geometry
octave:4> ii
error: 'ii' undefined near line 4 column 1

This happens because the scripts PKG_{ADD,DEL} use and clear a series of variables.  One possible solution for the problem is provided in the patch attached to this bug report. This patch is pretty minimal and just wraps the commands in both PKG_ADD and PKG_DEL inside functions with quite "unlikely" names _geometry_pkg{add,del}__, which are called afterwards. These functions are cleared at the end of the scripts.

This problem also affects other Octave-Forge packages.  I will try to track them down soon.

Rafael Laboissiere <rlaboiss>


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

Attach Files:

Attached Files
file #28475:  unintrusive-pkg-add-del.patch added by rlaboiss (1KiB - text/x-patch - Patch for PKG_ADD and PKG_DEL)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by carandraug (maintainer of geometry package)
  • -email is unavailable- added by rlaboiss (Submitted the item)

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

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-04-12 carandraug StatusNone => Fixed
        Open/ClosedOpen => Closed
        Releasedev => other
    2013-07-03 carandraug Carbon-Copy- => Added ajuanpi+dev@gmail.com
    2013-07-02 rlaboiss Attached File- => Added unintrusive-pkg-add-del.patch, #28475

    Back to the top

    Powered by Savane 3.5