octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63908] load: No error when asking for a non e


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #63908] load: No error when asking for a non existing variable
Date: Fri, 10 Mar 2023 18:23:59 -0500 (EST)

Follow-up Comment #2, bug #63908 (project octave):

WIP fix:


diff -r 16b233ccaeab libinterp/corefcn/load-save.cc
--- a/libinterp/corefcn/load-save.cc    Wed Mar 08 18:09:14 2023 -0800
+++ b/libinterp/corefcn/load-save.cc    Fri Mar 10 18:19:24 2023 -0500
@@ -440,7 +440,9 @@ load_save_system::load_vars (std::istrea
           break;
         }
 
-      if (stream.eof () || name.empty ())
+      if (name.empty ())  // FIXME: need to refine this
+        error ("load: specified variable(s) not found in file");
+      else if (stream.eof ())
         break;
       else
         {


This causes an error for the cases where non-existent variables are requested
from a file.

The error needs to be suppressed for the cases where the variable does exist
and is successfully loaded. Is there a reliable way to tell the cases apart so
that an empty name means it's not found?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63908>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]