-1

For expanding, collecting, factorization and simplification of equations, I'm trying to install the package: symbolic1, in Octave 4.2.1 (running on Windows 10).

When I execute pkg install symbolic-2.6.0.tar.gz from the command line I get:

dirlist(3): out of bound 2
error: called from
install at line 102 column 19
pkg at line 394 column 9

enter image description here

What is this error? How to install the package?


1. Which is manually downloaded and located in the current working directory: bottom right corner of the first picture.

2.I have the required dependencies: Python and Sympy installed:

3. I've read this post.

enter image description here


Update: Following @Alex338207 suggestions

Just extracted it with 7-Zip (twice: symbolic-2.6.0.tar.gz -> symbolic-2.6.0.tar -> symbolic-2.6.0).

Then ran: pkg install symbolic-2.6.0 and got the following error:

unpack: FILETYPE must be "gunzip" for a directory
error: called from
unpack at line 122 column 7
untar at line 47 column 5
install at line 81 column 9
pkg at line 394 column 9


Update 2: Following @carandraug suggestions. After modifying the function install (dirlist right after [dirlist, err, msg] = readdir (tmpdir); ), I get:

filelist =
{
  [1,1] = symbolic-2.6.0/
  [2,1] = symbolic-2.6.0/CONTRIBUTORS
  [3,1] = symbolic-2.6.0/COPYING
  [4,1] = symbolic-2.6.0/DESCRIPTION
  [5,1] = symbolic-2.6.0/INDEX
  [6,1] = symbolic-2.6.0/Makefile
  [7,1] = symbolic-2.6.0/NEWS
  [8,1] = symbolic-2.6.0/README.md
  [9,1] = symbolic-2.6.0/bin/
  [10,1] = symbolic-2.6.0/bin/winwrapy.bat
  [11,1] = symbolic-2.6.0/inst/
  [12,1] = symbolic-2.6.0/inst/@double/
  ....
  [396,1] = symbolic-2.6.0/misc/
  [397,1] = symbolic-2.6.0/misc/extract_tests_for_matlab.m
  [398,1] = symbolic-2.6.0/misc/my_print_usage.m
  [399,1] = symbolic-2.6.0/misc/octassert.m
  [400,1] = symbolic-2.6.0/misc/octsympy_tests_matlab.m
  [401,1] = symbolic-2.6.0/octave-symbolic.metainfo.xml
}

and:

dirlist =
{
  [1,1] = .
  [2,1] = ..
}
Ziezi
  • 6,375
  • 3
  • 39
  • 49
  • 1
    Can you please run `debug_on_error (1)` before calling `pkg install ...` and examine `tgz` and `dirlist`. Btw, since pkg and install all are .m file and you also want to write .m files it's a good idea to learn basic debugging techniques for .m files. – Andy Feb 28 '18 at 09:34
  • I've run `debug_on_error (1)` and then `pkg install symbolic-2.6.0.tar.gz`, again. I get the same error message. Regarding debugging - Fair enough. What exactly are you suggesting? – Ziezi Mar 01 '18 at 19:52
  • 1
    you should start debugging from this as I've written above – Andy Mar 01 '18 at 20:49
  • 1
    So you've decided to not debug this issue? – Andy Mar 02 '18 at 12:15
  • @Andy Apologies but I couldn't understand what exactly are you suggesting. If you want to expand your comment into an answer, I would appreciate it. – Ziezi Mar 02 '18 at 12:22
  • @Andy debugging the files of Octave itself would have been the last thing that I would have done. :) – Ziezi Mar 02 '18 at 17:30

2 Answers2

1

It seems that the error comes from the installation of the package (before any code from the package is actually run).

Octave seems to have trouble reading the file in the compressed directory. Can you check the size of the file symbolic-2.6.0.tar.gz ? It should have 239429 bytes. Maybe you should re-download the file. You can also verify its MD5 sum (c24c07222c7bb6770cf2a6dbee653bff) using the tool described here https://superuser.com/a/245776/338207. Check also that your system has enough disk space.

If the file has the right size and the error persists, you can also decompress the file symbolic-2.6.0.tar.gz (using for example 7-zip). It should contain a single folder also called symbolic-2.6.0. Avoid to decompress the files as symbolic-2.6.0\symbolic-2.6.0\....

In octave, you can install the package from the uncompressed folder with these commands:

 cd('c:\go\to\the\directory')

Where c:\go\to\the\directory is the directory containing symbolic-2.6.0. Or use the "current directory" drop-drown menu from the GUI. Then:

 ls('symbolic-2.6.0')

Verify that you see inst, bin and Makefile among others. Finally:

 pkg install symbolic-2.6.0

To load the package use:

pkg load symbolic

If you want to avoid to load the package, you can also install it with:

 pkg install -auto symbolic-2.6.0
Alex338207
  • 1,825
  • 12
  • 16
  • Thanks for the response! Regarding the file: I ran 7-Zip->Test Archive, and the result is: Archives: 1, Packed size: 239429, Files: 1, Size: 1505280 bytes (1MB), There are no errors. Now, I'm going to follow the next suggestions. – Ziezi Mar 02 '18 at 09:31
  • Just extracted it with 7-Zip (twice: symbolic-2.6.0.tar.gz -> symbolic-2.6.0.tar -> symbolic-2.6.0). Then ran: `pkg install symbolic-2.6.0` and got the following error: unpack: FILETYPE must be "gunzip" for a directory; error: called from; unpack at line 122 column 7; untar at line 47 column 5; install at line 81 column 9; pkg at line 394 column 9; – Ziezi Mar 02 '18 at 09:35
1

The pkg function expects a tar.gz file, that is, an archive of a directory tree (a .tar file) which is then gunzipped (compressed, the '.gz'). So you shouldn't have tried to uncompress it yourself.

The error you get comes from pkg/private/install.m#102 which is right after uncompressing the package file.

    ## The two first entries of dirlist are "." and "..".
    if (exist (tgz, "file"))
      packdir = fullfile (tmpdir, dirlist{3});
    else

The inside of the package should have a single directory, with the package contents, and nothing else. At this point, dirlist should be:

{".", "..", the_only_directory_inside_tgz}

However, your error says that dirlist{3} is out of bounds, so there is no directory after uncompressing the package. You can see a bit earlier that dirlist comes from:

    untar (tgz, tmpdir);

    ## Get the name of the directories produced by tar.
    [dirlist, err, msg] = readdir (tmpdir);
    if (err)
      error ("couldn't read directory produced by tar: %s", msg);
    endif

    if (length (dirlist) > 3)
      error ("bundles of packages are not allowed");
    endif

So, it's not clear at this point what the issue is. We can deduce that readdir did not fail, so dirlist will at least have . and ... This suggests me that untar found nothing during the uncompressing.

Try replacing that line with:

filelist = untar (tgz, tmpdir) # no ; at the end

To see what was unpacked. Also, a few lines below, print out the values of dirlist should give you hints about what is going on.

EDIT: see answer comments for a kind of solution. Basically, it seems that the untar function was failing to uncompressing the package to the specified directory (C:\...Temp\oct-...) and was instead uncompressing them to C:\.

carandraug
  • 12,938
  • 1
  • 26
  • 38
  • Thank you for the response! `filelist` contains 401 elements, so `untar` has found and uncompressed something, however, `dirlist` has only 2 elements: `'.', '..'`. This is strange... – Ziezi Mar 02 '18 at 17:36
  • `dir` is not assigned a third element if it's not already uncompressed, i.e. if `if (tgz, 'file')`, there is not `dirlist = {".", "..", tgz};` ? – Ziezi Mar 02 '18 at 18:06
  • 1
    @Ziezi `dir` should have been assigned by `readdir` but seems like `readdir` found an empty directory. My guess is something weird on your paths, and that `unpack` did not uncompress the files into `tmpdir`. Try to install with `pkg install -verbose ...` which will tell you where things are. – carandraug Mar 02 '18 at 18:22
  • Here it's the message after `pkg install -verbose symbolic-2.6.0.tar.gz`: `mkdir (C:\Users\bla\AppData\Local\Temp\oct-cMFS8z) untar (symbolic-2.6.0.tar.gz, C:\Users\bla\AppData\Local\Temp\oct-cMFS8z)` What I've done wrong? – Ziezi Mar 02 '18 at 18:30
  • @Ziezi I'm guessing you are hiding the real value of `bla`. Does it have spaces or any non-ascii characters? – carandraug Mar 02 '18 at 18:32
  • No. Just a name, consisted of Latin characters. Other strange thing that I just observed is that the uncompressed folder (of the package) is placed in the same directory as Octave (C:\\). – Ziezi Mar 02 '18 at 18:34
  • Try it yourself, and see if it works `untar (path-to-symbolic-targz, some-dir); dirlist = readdir (some-dir);`. I'm guessing that if you can make those work, then you will have your problem solved. – carandraug Mar 02 '18 at 18:38
  • 1
    @Ziezi if you found that the uncompressed files are showing up at `C:\ ` instead of `C:\...Temp\oct-...` then you found the issue. Octave's `unpack` is failing to do it on the specified directory. Consider reporting a bug and adjust `install.m` so it works for you. – carandraug Mar 02 '18 at 20:06