comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL 5.3 serious problem: save files sneakily restored
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL 5.3 serious problem: save files sneakily restored [message #21391] Thu, 24 August 2000 00:00 Go to next message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
IDL 5.3 appears to have a major hull breach.

If there is an idl save file named "<whatever>.sav" in the current
directory,
the contents of that file get restored whenever <whatever> is referenced as
a function within IDL.

<whatever> does not have to be a string.
It must have the ".sav" extension, and must be a valid IDL save file.

This is very dangerous, because there is no telling when local variables
will suddenly get overwritten.

I checked the online help documentation and didn't see anything about
this immediately. Even if it is a documented feature, it's a mistake.

This was discovered because we have a function called fitlines.pro
which wasn't being run because there was a goddammed savefile called
fitlines.sav in the current directory.

The log of a demonstration is appended below.

Comments?

Vinay
____________________________________________________________ __________

suppose, in the current directory, there are some IDL savefiles:
(which were made say, as follows:
idl
IDL> x=findgen(100)
IDL> save,file='whatever.sav'
IDL> y=x^2
IDL> save,file='kursk.sav'
IDL> exit
)

Then, when you start IDL and say

idl
IDL> print,!version
{ sparc sunos unix 5.3 Nov 11 1999}
IDL> help
% At $MAIN$
Compiled Procedures:
$MAIN$

Compiled Functions:

IDL> help,whatever()
% Restored file: WHATEVER.
% Attempt to call undefined procedure/function: 'WHATEVER'.
% Execution halted at: $MAIN$
IDL> help
% At $MAIN$
X FLOAT = Array[100]
Compiled Procedures:
$MAIN$
Compiled Functions:


IDL> tmp=kursk()
% Restored file: KURSK.
% Attempt to call undefined procedure/function: 'KURSK'.
% Execution halted at: $MAIN$
IDL> help
% At $MAIN$
TMP UNDEFINED = <Undefined>
X FLOAT = Array[100]
Y FLOAT = Array[100]
Compiled Procedures:
$MAIN$

Compiled Functions:


IDL>

--
____________________________________________________________ __________________
kashyap@head-cfa.harvard.edu 617 495 7173 [CfA/P-146] 617 496 7173 [F]
Re: IDL 5.3 serious problem: save files sneakily restored [message #21427 is a reply to message #21391] Mon, 28 August 2000 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:

> Well, for foreigner me articles unnecessary seem often times. Besides,
> matter does it or not whether placing adjectives nouns after or verbs
> before? And not it is problem indeed a.

Pavel, I was concerned about your recent absence on
the newsgroup, but I see you were just off attending
language school. Wonderful! I missed you a lot. :-)

Cheers,

David

P.S. Speaking of language schools, my oldest is attending
one in Germany, prior to heading off to his host family.
I hear through the grapevine (he is far too busy to
contact us directly) that he has learned the German
word for "beer". Great. :-(

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: IDL 5.3 serious problem: save files sneakily restored [message #21429 is a reply to message #21391] Mon, 28 August 2000 00:00 Go to previous messageGo to next message
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
David Fanning wrote:
>
> David Fanning (davidf@dfanning.com) writes:
>
>> And it is not problem *testing* changed routines.
>
> Whoops. Sorry. I've been reading too many of Pavel's posts
> lately. :-(

Well, for foreigner me articles unnecessary seem often times. Besides,
matter does it or not whether placing adjectives nouns after or verbs
before? And not it is problem indeed a.

Sorry,
Pavel

P.S. I just thought if I try to write in Russian I'd be of even less
help than now :-(
Re: IDL 5.3 serious problem: save files sneakily restored [message #21452 is a reply to message #21391] Fri, 25 August 2000 18:36 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Martin Schultz" <martin.schultz@dkrz.de> wrote in message
news:39A639C7.3D01A75C@dkrz.de...
> When a file is specified by typing only the filename at the IDL
> prompt, IDL searches the current directory for filename.pro
> (where filename is the file specified) and then for filename.sav.
> If no file is found in the current directory, IDL searches in the
> same way in each directory specified by !PATH. If a file is
> found, IDL automatically compiles the contents and executes any
> functions or procedures that have the same name as the file
> specified (excluding the suffix).
>
> So, at least theoretically, pro should get executed before sav.
> And this makes all the sense in the world, because otherwise it
> would be hard for authors of compiled files to develop them -
> they would have to delete the sav file each time they modify the
> pro file and want to test changes.

In Python (which is many ways similar to IDL) the corresponding extensions
are .py (source code) and .pyc (compiled). When a .py file is compiled, a
.pyc file is created in the same directory. Thereafter Python loads the .pyc
unless the .py has a more recent modification date. This is one of those
ideas that is so clever it seems obvious once someone else has thought of
it. Why can't IDL do that?

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: IDL 5.3 serious problem: save files sneakily restored [message #21454 is a reply to message #21391] Fri, 25 August 2000 00:00 Go to previous messageGo to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
"Vinay L. Kashyap" wrote:
>
> In article <MPG.140f7e12fd8ffd61989bf0@news.frii.com>,
> David Fanning <davidf@dfanning.com> wrote:
>
>> It's not an unknown problem in IDL, but a relatively
>> rare one, given the huge number of functions and variables
>> people create.
>
> That's what makes this feature dangerous. There's such a
> tremendous number of functions floating around that it's
> practically impossible not to have *some* .sav files around
> that inadvertantly match a function name.

I never use .sav files for code since they're not portable across IDL
versions. Besides, recompilation of .pro files doesn't take *that* much
extra time (at least not for my penny ante code :o).

This seems like one of those times when a slight change in one's
"perception anchor" of how things *should* work will allow one to
embrace how things actually *do* work.

paulv

--
Paul van Delst Ph: (301) 763-8000 x7274
CIMSS @ NOAA/NCEP Fax: (301) 763-8545
Rm.202, 5200 Auth Rd. Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746
Re: IDL 5.3 serious problem: save files sneakily restored [message #21512 is a reply to message #21391] Mon, 28 August 2000 16:48 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
> P.S. I just thought if I try to write in Russian I'd be of even less
> help than now :-(

But more help than I would be if I tried to write in Russian!

As a more-or-less monolingusitic Kiwi I am continually impressed by the
fluency most Europeans have in several languages.
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: IDL 5.3 serious problem: save files sneakily restored [message #21798 is a reply to message #21452] Thu, 21 September 2000 00:00 Go to previous message
Theo Brauers is currently offline  Theo Brauers
Messages: 58
Registered: November 1997
Member
Mark Hadfield wrote:
>
> In Python (which is many ways similar to IDL) the corresponding extensions
> are .py (source code) and .pyc (compiled). When a .py file is compiled, a
> .pyc file is created in the same directory. Thereafter Python loads the .pyc
> unless the .py has a more recent modification date. This is one of those
> ideas that is so clever it seems obvious once someone else has thought of
> it. Why can't IDL do that?
>
Because RSI wants you to write more IDL code :-) ! We had a similar problem with
reading large ASCII data files: you read the once ( file1.dat ) and save the data
using SAVE ( file1.dat.sav ). When we re-read the file we check the modification
date of both files and read the newer one. It works fine now but it was written
partly in C to get the modification date of each file also in windows. Anyway,
I read that IDL5.4 will have a full function FSTAT with it.

Theo


--
----------------------------------------------
Dr. Theo Brauers
Institut fuer Atmosphaerische Chemie (ICG-3)
Forschungszentrum Juelich
52425 JUELICH, Germany
Tel. +49-2461-61-6646 Fax. +49-2461-61-5346
http://www.kfa-juelich.de/icg/icg3/MITARBEITER/th.brauers.ht ml
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: LINKLOAD, aix, pv-wave?
Next Topic: Re: TWO DIFFERENT COLOR TABLES IN SAME WINDOW

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:41:44 PDT 2025

Total time taken to generate the page: 0.00646 seconds