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

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

[Octave-bug-tracker] [bug #55515] pkg install has obtuse error messages


From: Andrew Janke
Subject: [Octave-bug-tracker] [bug #55515] pkg install has obtuse error messages when -forge option is forgotten
Date: Fri, 18 Jan 2019 18:31:21 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?55515>

                 Summary: pkg install has obtuse error messages when -forge
option is forgotten
                 Project: GNU Octave
            Submitted by: 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: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: Any

    _______________________________________________________

Details:

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
>>





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 18 Jan 2019 11:31:19 PM UTC  Name: pkg-nicer-error-messages.patch 
Size: 4KiB   By: apjanke

<http://savannah.gnu.org/bugs/download.php?file_id=46018>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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