bugGNU Octave - Bugs: bug #47102, pkg install -forge BAD_PKG...

 
 

bug #47102: pkg install -forge BAD_PKG produces unhelpful error message

Submitter:  Rik <rik5>
Submitted:  Tue 09 Feb 2016 06:47:37 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 11 Feb 2016 01:47:36 AM UTC, comment #2: 

I'm sure the HTML will only change again in the future.  I modified the code to use the fixed version of the package list at list_packages.php, which will not change.

I also added a much better, although still crude, similarity matching algorithm in case the user has made a typo.  The whole changeset is at http://hg.savannah.gnu.org/hgweb/octave/rev/101489515a70.

For bug #39479, I can change Octave quickly if someone on the Octave-Forge site can create a new fixed web page with package names and versions.  The web site shouldn't be list_packages.php because that is already fixed for a different usage.

Rik <rik5>
Group administrator
Wed 10 Feb 2016 11:03:00 PM UTC, comment #1: 

The id="pkgname" attribute got moved from <div> to <h3> during redesign of the packages page. Also the CSS class names have changed.

I didn't know that the site is parsed like that in Octave.

We could either change the HTML code to make the regexp work again, or we change the Octave code to use http://octave.sourceforge.net/list_packages.php instead.

Regarding #39479, the list_packages.php already serves as a (machine readable) list of packages and could be extended to also contain version information, which would then be used to make “pkg -forge list” faster.

https://sourceforge.net/p/octave/project-web/ci/default/tree/htdocs/list_packages.php

Oliver Heimlich <oheim>
Tue 09 Feb 2016 06:47:37 PM UTC, original submission:  

I accidentally used a package name that does not exist on Octave-Forge.  Instead of getting a message that the name simply doesn't exist I got something weird about cells.


pkg install -forge foobar
error: cellfun: C must be a cell array
error: called from
    get_forge_pkg at line 72 column 14
    get_forge_download at line 26 column 12
    pkg at line 397 column 29


The problem is in scripts/pkg/private/get_forge_pkg.m.



  else
    ## Try get the list of all packages.
    [html, succ] = urlread ("http://packages.octave.org/packages.php");
    if (! succ)
      error ("get_forge_pkg: could not read URL, please verify internet connection");
    endif

    t = regexp (html, "<div class=""package"" id=""(\\w+)"">", "tokens");
    t = horzcat (t{:});
    if (any (strcmp (t, name)))
      error ("get_forge_pkg: package NAME exists, but index page not available");
    endif
    ## Try a simplistic method to determine close names.
    dist = cellfun (@(n) length (setdiff (name, n)), t);
    [~, i] = min (dist);
    error ("get_forge_pkg: package not found: ""%s"". Maybe you meant ""%s?""", name, t{i});
  endif


The problem seems to be that the website has changed how it presents packages and the regexp no longer matches.

Maybe there needs to be a place where the list of packages is kept in a very simple machine-readable format, rather than HTML?

This would also help resolve bug #39479.

Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by oheim (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-11 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2016-02-09 rik5 Dependencies- Depends on bugs #39479

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code