bugGNU Octave - Bugs: bug #53561, pkg install reports an error when...

 
 

bug #53561: pkg install reports an error when filename doesn't match package name

Submitter:  Mike Miller <mtmiller>
Submitted:  Wed 04 Apr 2018 07:47:06 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  mtmiller
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 05 Apr 2018 11:02:51 PM UTC, comment #6: 

Fixed on the stable branch for Octave 4.4

https://hg.savannah.gnu.org/hgweb/octave/rev/2bc071fc7f6b

Mike Miller <mtmiller>
Group Member
Thu 05 Apr 2018 03:28:04 PM UTC, comment #5: 

There is already an item for that, bug #32839.

Mike Miller <mtmiller>
Group Member
Thu 05 Apr 2018 08:22:23 AM UTC, comment #4: 

A similar and connected issue is that pkg refuses to install a package contained in an uncompressed directory.

This was initially possible and was very useful in the development ant testing stage but became forbidden at some point, I think just as a by-product of a different change.

Maybe you could also look at what check is preventing this to work?
Should I open a different item for this?

Carlo de Falco <cdf>
Group Member
Thu 05 Apr 2018 12:57:00 AM UTC, comment #3: 

Thanks for the feedback!

This check was added way back in 2006 when the pkg function was still new in the 2.9.x versions of Octave.

https://hg.savannah.gnu.org/hgweb/octave/rev/9cc8149f81b0

And from that reading, it looks like the original intent was to be just a double-check nitpick on the package file, rather than a functional test for something that might break.

So based on your feedback and that dig through history, I think it's safe to make this change on the stable branch for Octave 4.4, will do so a little later.

Mike Miller <mtmiller>
Group Member
Wed 04 Apr 2018 10:11:49 PM UTC, comment #2: 

This sounds good to me.

Juan Pablo Carbajal <juanpi>
Group Member
Wed 04 Apr 2018 09:58:25 PM UTC, comment #1: 

This is trivial to solve, by just removing the block of code that performs this test. Nothing else is affected by removing this block of code:


--- a/scripts/pkg/private/install.m
+++ b/scripts/pkg/private/install.m
@@ -112,14 +112,6 @@ function install (files, handle_deps, pr
         filename = fullfile (packdir, "DESCRIPTION");
         desc = get_description (filename);

-        ## Verify that package name corresponds with filename.
-        [dummy, nm] = fileparts (tgz);
-        if ((length (nm) >= length (desc.name))
-            && ! strcmp (desc.name, nm(1:length (desc.name))))
-          error ("package name '%s' doesn't correspond to its filename '%s'",
-                 desc.name, nm);
-        endif
-
         ## Set default installation directory.
         desc.dir = fullfile (prefix, [desc.name "-" desc.version]);


So this condition was added as an intentional nitpick on the naming of the package tar file, which seems pointless to me, but I'll give this a day or two to see if anyone can tell me that this is important to keep.

The whole point of me pursuing this is to allow users to install a package straight from a remote git or mercurial repo, where the file may be named something like 'tip.tar.gz' or 'master.zip'.

Mike Miller <mtmiller>
Group Member
Wed 04 Apr 2018 07:47:06 PM UTC, original submission:  

When a valid Octave package is extracted, the directory renamed, and packaged up into a different tar file name, pkg reports an error


>> pkg install foo.tar.gz
package name 'signal' doesn't correspond to its filename 'foo.tar'
error: called from
    install at line 119 column 11
    pkg at line 436 column 9


I don't understand the reason for this error. The 'Name' field in the package DESCRIPTION should be the only name that matters. If the names do not match, pkg should just silently overwrite the name that it guessed from the file name.

I can look at fixing this, but I would appreciate it if someone who knows more about pkg could tell me if there is a good reason for this error. As I see it the tar file is just a container, its name doesn't matter.

Mike Miller <mtmiller>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cdf (Posted a comment)
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by mtmiller (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-05 mtmiller StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2018-04-05 mtmiller StatusPatch Submitted In Progress
    2018-04-04 mtmiller StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code