bugGNU Octave - Bugs: bug #31946, pkg: better error reporting when...

 
 

bug #31946: pkg: better error reporting when trying to remove system packages

Submitter:  Orion Poplawski <opoplawski>
Submitted:  Wed 22 Dec 2010 05:03:32 AM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Orion Poplawski Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 25 Aug 2021 01:15:26 PM UTC, comment #20: 

No complaints after a few weeks.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Sun 01 Aug 2021 10:22:24 AM UTC, comment #19: 

Thanks for testing.

I pushed the patch here:
https://hg.savannah.gnu.org/hgweb/octave/rev/79c6a29dd384

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Fri 30 Jul 2021 07:12:17 PM UTC, comment #18: 

Oh good catch. After a couple iterations, I forgot to change the author on the last one.

Applied this one and ran through things, all the checks I did below still behave the same.  Looks good from this end.

Nicholas Jankowski <nrjank>
Group Member
Fri 30 Jul 2021 04:39:03 PM UTC, comment #17: 

Thanks for poking at those elderly reports.
It looks like this was almost done when it was left up.

Let's focus on the issue that is targeted by that patch and not expand it to a larger scope than necessary.

There were some places where types were converted forth and back between cell arrays and comma-separated list. This might not be very efficient. So, I tried to change it to stay as a cell type where possible.
There were also some other minor style issues.

I also changed the patch to reference the original author who did most of the work.

As of now, completely untested. See attachment.

(file #51708)

Markus Mützel <mmuetzel>
Group administrator
Fri 30 Jul 2021 02:46:20 PM UTC, comment #16: 

there have been a number of pkg bugs recently, and I've stumbled into other oddities on windows.  I don't use the installer, I use the zip archives, so I have full admin rights to the space.

running a pkg uninstall -global on a local package gives an error message but still seems to removes the package, but doesn't seem to consistently delete the pkg folder or provide error reporting.  and inconsistently trying to do an uninstall after a local install gives a permissions / file in use error.  restarting frees that up.  rebuild will sometimes not see a local package, i think as you said.

i thought bug #60472 would solve most of these issues but apparently not.

note that Kai has been working on a rebuilt pkg that would maybe remove a lot of these accumulated oddities. not sure if he has any thoughts on this.

Nicholas Jankowski <nrjank>
Group Member
Fri 30 Jul 2021 10:00:53 AM UTC, comment #15: 

What happened to me when I tried to remove a global package with dev Octave on Windows also looks interesting: I noted that on my box even the global octave-packages file was completely gone. I suppose pkg.m was in the middle of processing it but was then interrupted by some error elsewhere in its logic.

Anyway I figured "no stress, let's just easily recreate that file by a 'pkg rebuild'". And then landed in an interesting situation:

  • I did install Octave as ordinary user - that means I do have all rights to fiddle around in the global packages store.
  • In my .octaverc file I set 'user_prefix' to octave<version>/ in my home directory and point the local_list file (.octave_packages) to be there as well (using 'pkg prefix ...' and 'pkg local_list ...'), to separate local packages installed in various (also quite old) Octave versions.
  • That way 'user_prefix' is set before Octave is even fully started.
  • Further down in the pkg.m logic the direct way to have 'pkg rebuild' recreate the global_list (global octave_packages file) is consistently avoided as long as a user_prefix is set.
  • Now, because pkg.m AFAIK offers no way to "unset" a prefix (and the associated variable 'user_prefix' is a persistent variable), I got stuck a little bit.


Yeah I know, it's all because I've set 'prefix' (in .octaverc), but the consequences described above are unintended, undocumented, and actually illogical - if 'pkg.m' can wipe the global_list, 'pkg rebuild' should also be able to recreate it, regardless of 'user_prefix' settings. It could well be that this issue applies only to Windows plus local Octave installation.

I've patched it for myself so that the '-global' flag works also with 'pkg rebuild' (and for that matter, with 'pkg uninstall').

Some time ago I've dived deep in the pkg.m logic to fix other bugs. Unfortunately my perception of pkg.m's inner workings has faded a bit; but if I get more time I might review and fix this & other glitches (I know from memory there are several more).

Philip Nienhuis <philipnienhuis>
Group Member
Fri 30 Jul 2021 03:42:16 AM UTC, comment #14: 

attached patch (file bug_31946_pkg_uninst_msgs.patch) should apply successfully to default.  It trims out the section mentioned in comment #13, and all uninstall tests seem to apply correctly (if anyone can find a test case that breaks it without that block, let me know), and it provides the improved messaging that initiated this old bug. if all is good should satisfy this bug report

tests:
when attempting to uninstall one or more not-installed pkg:

>> pkg uninstall abc
warning: package abc is not installed
warning: no packages will be uninstalled
warning: called from
    uninstall at line 99 column 5
    pkg at line 582 column 7

>> pkg uninstall abc def
warning: package abc is not installed
warning: package def is not installed
warning: no packages will be uninstalled
warning: called from
    uninstall at line 99 column 5
    pkg at line 582 column 7


when trying to uninstall one or more global pkg as local:

>> pkg uninstall audio
warning: audio is a global package and cannot be removed locally
warning: no packages will be uninstalled
warning: called from
    uninstall at line 99 column 5
    pkg at line 582 column 7

>> pkg uninstall audio video
warning: video is a global package and cannot be removed locally
warning: audio is a global package and cannot be removed locally
warning: no packages will be uninstalled
warning: called from
    uninstall at line 99 column 5
    pkg at line 582 column 7


mixing the two:

>> pkg uninstall abc audio video def
warning: package abc is not installed
warning: package def is not installed
warning: video is a global package and cannot be removed locally
warning: audio is a global package and cannot be removed locally
warning: no packages will be uninstalled
warning: called from
    uninstall at line 99 column 5
    pkg at line 582 column 7


as global:

>> pkg uninstall -global abc def
warning: package abc is not installed
warning: package def is not installed
warning: no packages will be uninstalled
warning: called from
    uninstall at line 99 column 5
    pkg at line 582 column 7

>> pkg list audio
Package Name  | Version | Installation directory
--------------+---------+-----------------------
       audio  |   2.0.2 | ...\mingw64\share\octave\packages\audio-2.0.2

>> pkg uninstall -global audio
>> pkg list audio
package audio is not installed.

>> pkg install -global audio-2.0.2.tar.gz
For information about changes from previous versions of the audio package, run 'n
ews audio'.

>> pkg uninstall -global abc audio
warning: package abc is not installed

>> pkg list audio
package audio is not installed.


local package:


>> pkg install -local audio-2.0.2.tar.gz
For information about changes from previous versions of the audio package, run 'news audio'.

>> pkg list audio video
Package Name  | Version | Installation directory
--------------+---------+-----------------------
       audio  |   2.0.2 | C:\Users\nicholas.jankowski\octave\audio-2.0.2
       video  |   2.0.0 | C:\Programs\Octave\octave-6.3.0-w64\mingw64\share\octave\packages\video-2.0.0

>> pkg uninstall abc def video audio
warning: package abc is not installed
warning: package def is not installed
warning: video is a global package and cannot be removed locally

>> pkg list audio video
Package Name  | Version | Installation directory
--------------+---------+-----------------------
       video  |   2.0.0 | C:\Programs\Octave\octave-6.3.0-w64\mingw64\share\octave\packages\video-2.0.0


(file #51706)

Nicholas Jankowski <nrjank>
Group Member
Fri 30 Jul 2021 01:31:42 AM UTC, comment #13: 

I'm convinced that entire "Try again for a locally installed package." block at lines 62 is unnecessary and I'm stripping it out. it again checks just the local package list for matches, and resets the list with just those items, but the initial list already included both local and global packages, and would have any of those matches. so it's unnecessary, and the reset loses the previous check for matched global packages.

will rerun all of the uninstall tests and see if anything breaks.

Nicholas Jankowski <nrjank>
Group Member
Fri 30 Jul 2021 01:06:30 AM UTC, comment #12: 

hmmm, thought I had this finished, running a bunch of option checks and realized the current version (6.3.0) fails to uninstall any files with -global if any of them are not installed. the check for 'some aren't installed' blanks out the delete_idx, so none get uninstalled. will tweak that then should have a patch ready.

Nicholas Jankowski <nrjank>
Group Member
Thu 29 Jul 2021 08:20:34 PM UTC, comment #11: 

bug still present in octave 6.3.0

on a clean windows install, doing attempting a 'local' uninstall of a  bundled 'global' package:


>> pkg list video
Package Name  | Version | Installation directory
--------------+---------+-----------------------
       video  |   2.0.0 | ...\mingw64\share\octave\packages\video-2.0.0

>> pkg uninstall video
warning: some of the packages you want to uninstall are not installed
warning: called from
    uninstall at line 72 column 7
    pkg at line 582 column 7

warning: no packages will be uninstalled
warning: called from
    uninstall at line 77 column 5
    pkg at line 582 column 7


the 'fourth.patch' patch no longer applies cleanly to default, but only because i think the 4th blob doesn't do anything.

looking at this, there are a few things still hanging - 'no package of that name installed' doesn't work when multiple packages are called. it should echo the named package(s) that aren't there.

and some of the language should be updated - referring to system packages as global and user packages as local.  i'll try to work up a modified patch to address these.

Nicholas Jankowski <nrjank>
Group Member
Thu 17 Mar 2016 12:20:17 PM UTC, comment #10: 

I removed the for loop and implemented the comparison of two lists available packages and the list of packages which we want to uninstall using vectors and this is working fine.

neerajbattan <neerajbattan>
Wed 16 Mar 2016 07:50:55 PM UTC, comment #9: 

The only other comment I have is why the for loop? This seems very simple to vectorize.

Carnë Draug <carandraug>
Group Member
Wed 16 Mar 2016 07:45:44 PM UTC, comment #8: 


> I guess this is similar to the current case of uninstalling one installed package and one wrong package name.


Another way to see it, is that if there's no error uninstalling a package, pkg says nothing. So if you ask to uninstall two packages and only errors, it complains about that one and says nothing about the other. Sounds like good behaviour to me.

> [...] what the purpose of "delete_idx" versus "delete_idx1" is.


Yeah, what's the deal with that?

Carnë Draug <carandraug>
Group Member
Mon 14 Mar 2016 12:13:26 AM UTC, comment #7: 

This is an improvement in the right direction. I now see


>> pkg uninstall control
warning: control is a system installed package and cannot be removed by a user
warning: no packages will be uninstalled
warning: called from
    uninstall at line 88 column 5
    pkg at line 420 column 7


If I try to uninstall two packages at once, one system-installed and one user-installed, I see


>> pkg uninstall control optim
warning: control is a system installed package and cannot be removed by a user


and the optim package is uninstalled. I guess this is similar to the current case of uninstalling one installed package and one wrong package name.

The coding style is mostly right, except for a missing space in "length(", and you inadvertently deleted an extra newline at the end of the file. The naming of the new variables is not at all clear, looking at the code I don't have a hint as to what the purpose of "delete_idx" versus "delete_idx1" is.

Any other reviewers more familiar with pkg.m?

Mike Miller <mtmiller>
Group Member
Sat 12 Mar 2016 11:00:16 PM UTC, comment #6: 

I have changed the old message to new message and now I am also checking whether the package is global or not and if it is not global then it doesn't show the message "no package of that name installed" and if it is global then it gives the message that
"<pkg_name> is a system installed package and cannot be removed by a user" only. Refer to the file:
(file #36591)

neerajbattan <neerajbattan>
Wed 09 Mar 2016 05:21:46 PM UTC, comment #5: 

Thanks for attempting to fix this. The patch applies, but still needs some logic work to clean up the error reporting.

I now get the following, not much clearer, error listing:


octave:1> pkg uninstall control
warning: no package of that name installed.
warning: called from
    uninstall at line 65 column 7
    pkg at line 420 column 7
warning: control is a system installed package and cannot be removed by a user
warning: no packages will be uninstalled
warning: called from
    uninstall at line 77 column 5
    pkg at line 420 column 7


Mike Miller <mtmiller>
Group Member
Sun 06 Mar 2016 09:13:20 AM UTC, comment #4: 

In the file "octave/scripts/pkg/private/uninstall.m" and line number 26 what is the use of the paramater "global_install"?

neerajbattan <neerajbattan>
Sat 05 Mar 2016 01:51:53 AM UTC, comment #3: 

Packages installed by a system level package manager like rpm, which are essentially global packages, but should not be updated/removed by the octave pkg commands.

Orion Poplawski <opoplawski>
Sat 05 Mar 2016 01:18:14 AM UTC, comment #2: 

Does it mean global packages?

neerajbattan <neerajbattan>
Sat 05 Mar 2016 01:13:22 AM UTC, comment #1: 

What is the meaning of system packages here?

neerajbattan <neerajbattan>
Wed 22 Dec 2010 05:03:32 AM UTC, original submission:  

When a user tries to remove a system installed octave package, they get:

octave:3> pkg uninstall octcdf
warning: some of the packages you want to uninstall are not installed

which is not very helpful.  If no package of that name is installed, I would suggest:

warning: no package of that name installed.

If it was a system package:

warning: <package name> is a system installed package and cannot be removed by a user

Orion Poplawski <opoplawski>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51708:  bug31946-pkg_uninst_msgs-v6.patch added by mmuetzel (4KiB - application/octet-stream)
file #51706:  bug_31946_pkg_uninst_msgs.patch added by nrjank (3KiB - application/octet-stream - improved messages for one or multiple pkgs, fixed global uninst error. )
file #36665:  fourth.patch added by neerajbattan (2KiB - text/x-patch - carandraug: I removed the for loop and implemented this using vectoring and everthing else is working fine.)
file #36591:  third.patch added by neerajbattan (2KiB - text/x-patch)
file #36582:  second.patch added by neerajbattan (1KiB - text/x-patch)
file #36548:  first.patch added by neerajbattan (713B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by nrjank
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by neerajbattan (Updated the item)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by opoplawski (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 17 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-25 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2021-08-01 mmuetzel StatusConfirmed Ready For Test
    2021-07-30 mmuetzel Attached File- Added bug31946-pkg_uninst_msgs-v6.patch, #51708
    2021-07-30 nrjank Carbon-Copy- Added siko1056
    2021-07-30 nrjank Attached File- Added bug_31946_pkg_uninst_msgs.patch, #51706
    2016-03-16 neerajbattan Attached File- Added fourth.patch, #36665
    2016-03-09 neerajbattan Attached File- Added third.patch, #36591
    2016-03-09 neerajbattan Attached File- Added second.patch, #36582
    2016-03-04 neerajbattan Attached File- Added first.patch, #36548
    2013-10-28 mtmiller CategoryInterpreter Octave Function
        Severity3 - Normal 1 - Wish
        Item GroupPerformance Incorrect Result
        StatusNone Confirmed
        Release3.3.54 dev
        Operating SystemGNU/Linux Any
        SummaryNeed better message when trying to remove system packages pkg: better error reporting when trying to remove system packages

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code