bugGNU Octave - Bugs: bug #55515, pkg install has obtuse error...

 
 

bug #55515: pkg install has obtuse error messages when -forge option is forgotten

Submitted by:  Andrew Janke <apjanke>
Submitted on:  Fri 18 Jan 2019 11:31:19 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.4.1 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 22 Jan 2019 02:33:00 PM UTC, comment #4: 

Thanks!

Andrew Janke <apjanke>
Tue 22 Jan 2019 04:20:22 AM UTC, comment #3: 

I modified the patch further to get away from using "! files_found" and instead use a positive assertion "not_local_files".  I also commented out the test which relies on a unix operating system.  Cygwin, for example, reports true for isunix but might not have executables like "file" or "cut".  We need a test that is platform agnostic and can be implemented within Octave itself.  A also added the bug number to the commit message.  This allows us to quickly associate a changeset with a bug report and the reason for the code.

I checked in the code on the development branch (https://hg.savannah.gnu.org/hgweb/octave/rev/5bfbcbec6826).

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Sat 19 Jan 2019 03:01:58 AM UTC, comment #2: 

I modified the file #46018 and upload a new version of that,
to make the coding style conform with GNU Octave's convention.

(file #46022)

Anonymous
Fri 18 Jan 2019 11:32:51 PM UTC, comment #1: 

(These download attempts on bogus URLs can often take a long time, too. "pkg install some-bogus-file" can lock up the Octave UI for several seconds for me.)

Andrew Janke <apjanke>
Fri 18 Jan 2019 11:31:19 PM UTC, original submission:  

When you forget the -forge option to a "pkg install" command, or have a typo in your file name, you get some obtuse error messages.

octave:1> pkg install foobar
warning: unpack: unrecognized FILETYPE <>
dirlist(3): out of bound 2
error: called from
    install at line 102 column 19
    pkg at line 437 column 9
octave:1> pkg install http://some-bad-url/foo/bar/baz.tgz
gzip: /var/folders/_4/9mx5ryp52bb_z6drbcbrhwl40000gn/T/oct-9fNAGX/baz.tgz: not in gzip format
dirlist(3): out of bound 2
error: called from
    install at line 102 column 19
    pkg at line 437 column 9
octave:1> pkg install file-name-with-typo.tgz
gzip: /var/folders/_4/9mx5ryp52bb_z6drbcbrhwl40000gn/T/oct-WzYajp/file-name-with-typo.tgz: not in gzip format
dirlist(3): out of bound 2
error: called from
    install at line 102 column 19
    pkg at line 437 column 9
octave:1>

This is because for any input file, if it's not found on the local filesystem, pkg will unconditionally try to download it as a URL, even if it doesn't start with "http://" or "https://". And because of ISP DNS hijacking and "search page" redirection, downloading arbitrary bogus URLs will often succeed, but result in an HTML file instead of a tarball.

Here's a patch to produce some nicer error messages. It only attempts to download a file if the file argument is in URL format. And it checks the download to see if it's a tarball or HTML before trying to extract the archive.

With patch:

>> pkg install foobar
error: pkg: file not found: foobar.
This looks like an Octave Forge package name. Did you mean:
       pkg install -forge foobar
error: called from
    pkg at line 457 column 19
>> pkg install foobar.tgz
error: pkg: file not found: foobar.tgz
error: called from
    pkg at line 462 column 19
>> pkg install http://some-bogus-url/foo/bar/baz.tgz
error: pkg: Invalid package file downloaded from http://some-bogus-url/foo/bar/baz.tgz
File is HTML, not a tar archive.
error: called from
    pkg at line 445 column 23
>>

Andrew Janke <apjanke>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46022:  pkg-nicer-error-messages.patch added by None (4KiB - text/x-patch)
file #46018:  pkg-nicer-error-messages.patch added by apjanke (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-22 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed
    2019-01-19 None Attached File- => Added pkg-nicer-error-messages.patch, #46022
    2019-01-18 apjanke Attached File- => Added pkg-nicer-error-messages.patch, #46018

    Back to the top


    Powered by Savane 3.5