octave-maintainers
[Top][All Lists]
Advanced

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

"pkg install" error messages for bad filenames or missing -forge option


From: Andrew Janke
Subject: "pkg install" error messages for bad filenames or missing -forge option
Date: Fri, 18 Jan 2019 18:46:38 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hi, Octave maintainers,

I got some wonky error messages when I forget the -forge option to "pkg install" or pass it a bad file name.

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


I think this is because when "pkg install" is passed a nonexistent filename, it unconditionally tries to download it as a URL. And because many ISPs are doing DNS hijacking these days, that download will often succeed, but produce the HTML content of an ISP search page instead of a tarball.

I think this could be fixed by having pkg be a bit more conservative in how it interpreted its inputs, and do some testing on the results of URL downloads. I've posted a patch here:
https://savannah.gnu.org/bugs/?55515. That will give you:

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

I think this is a nicer user experience, particularly for less-experienced users who might be
new to Octave and pkg.

Thoughts?

Cheers,
Andrew



reply via email to

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