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

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

[Octave-bug-tracker] [bug #55448] dir() command sometimes returns filena


From: Rik
Subject: [Octave-bug-tracker] [bug #55448] dir() command sometimes returns filenames in the .folder field
Date: Fri, 11 Jan 2019 17:33:39 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #55448 (project octave):

                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up Comment #1:

Confirmed.  The issue is with a caching mechanism in dir.m designed to speed
it up.


if (! strcmp (last_dir, tmpdir))
  ## Caching mechanism to speed up function
  last_dir = tmpdir;
  last_absdir = canonicalize_file_name (last_dir);
endif


The function canonicalize_file_name is returning the full absolute path.  Here
is a clumsy fix


diff -r 7da6136d3ecd scripts/miscellaneous/dir.m
--- a/scripts/miscellaneous/dir.m       Tue Jan 08 21:35:53 2019 -0800
+++ b/scripts/miscellaneous/dir.m       Fri Jan 11 14:32:17 2019 -0800
@@ -141,6 +141,9 @@ function retval = dir (directory)
           ## Caching mechanism to speed up function
           last_dir = tmpdir;
           last_absdir = canonicalize_file_name (last_dir);
+          if (! isdir (last_absdir))
+            last_absdir = fileparts (last_absdir);
+          endif
         endif
         info(i).folder = last_absdir;
         lt = localtime (st.mtime);


Really, the entire caching mechanism needs to be reviewed.  I think the
regular expression used may be returning the wrong thing.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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