Opened 9 years ago

Closed 9 years ago

#529 closed bug (fixed)

options modified by accident 'primdec.lib'

Reported by: kroeker@… Owned by: pfister
Priority: minor Milestone: Release 4-0-0
Component: singular-libs Version: spielwiese
Keywords: options modified accidentally primdec.lib Cc:

Description

The routiles minAssPrimes, algeDeco,splitCharp, minAssPrimesold, newDecompStep in primdec.lib modify options accidently.

Here is the example for minAssPrimes():

LIB("primdec.lib");
ring rng=0,x,dp;
option(noredSB); option();
//options: redTail redThrough intStrategy redefine loadLib usage prompt

minAssPrimes(7); option();
//options: redSB redTail redThrough intStrategy redefine loadLib usage prompt
// Bug: options modified!

Hint for the bug in newDecompStep: look at "the zero-dimensional case" unrelated remark for minAssPrimesold: example is not updated (it calls minAssPrimes)

Please use def origOp = option(get); before modifying options and option(set,origOp); before returning from the routine.

This issues approves the well-known fact that in general usage of global variables is evil and should be avoided.

Suggestions how to fix the option issue once and for all by using an alternative design are welcome.

Change History (5)

comment:1 Changed 9 years ago by kroeker@…

same issue (modified options) in

elim.lib::elim()

comment:2 Changed 9 years ago by kroeker@…

issue in elim.lib::elim() fixed by Hans with commit b0ee97de86747eca45149ea482a547c25ea82c5a

comment:3 Changed 9 years ago by hannes

Owner: changed from somebody to pfister

comment:4 Changed 9 years ago by kroeker@…

issue in primdec.lib fixed in https://github.com/Singular/Sources/pull/443, commit ce70e6c75303dccbb031dc5e9e87c5a9cd45aaf8

Remark: other option issues may be detected by enabling the "warn" option:

   option("warn");

or even better by code review of the affected Singular library parts as it was done to fix issues in 'primdec.lib' (1. open new issue for that task?)

  1. Close this issue?

comment:5 Changed 9 years ago by hannes

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.