Ticket #47 (new Defect)

Opened 1 year ago

Last modified 4 months ago

Dependency install not rolled back

Reported by: UnFleshed One Assigned to: isak
Priority: High Milestone: None
Component: main Version: 1.2.4
Severity: Normal Keywords:
Cc: knighcl@gmail.com

Description

If package A depends on package B and installs it via require(), package B will be locked on A even if A failed immidiately after installing B.

In this case B will be installed, and attempt of uninstall it will produce cryptic message: "Error: Removing this package would break: Package B".

One way to fix this will be to check if packages listed in supports file are installed, and ignore them for the purpose of uninstall if not. Another way is to make the meta package to uninstall dependencies on rollback. (I wonder if one logCommand of uninstallPackage will magicaly work...)

Yet another way, if successfully installed dependencies are supposed to be left on the system (are they?), will be to unforge dependency on rollback.

Attachments

ticket_47_test.tar.gz (52.6 kB) - added by UnFleshed One on 04/30/08 13:56:58.

Change History

09/03/07 13:21:23 changed by isak

  • milestone set to None.

I don't think we should leave dependencies if we fail to install the requested package. After all, dependencies are just an implementation detail of the actual package (that the user *really* wanted after all)

Rolling back everything seems like the sanest solution IMO.

04/29/08 16:44:43 changed by UnFleshed One

  • priority changed from Medium to High.

(Bumping up the bug)

I currently use this as a workaround. At least it will not result in locked up packages:

[Install]
(
	trap 'Rollback' EXIT
	function Rollback()
	{(
		local exitCode=$?
		set +e
		if((exitCode != 0))
		then
			echo "Exit code is: $exitCode. Rolling back dependencies for $ROOTNAME"
			_unforgeDependencies "$ROOTNAME"
		fi
		return 0
	)}

	# Do all install stuff here
)
if(($? != 0)); then false; fi

04/29/08 16:50:13 changed by isak

  • owner changed from taj to isak.

The least we should do is allow 'A' to be uninstalled. I wonder what's causing that cryptic message.

Do you think you could create a simple test suite (package A and package B) and attach to this bug? It will make it easier to debug.

04/29/08 17:15:26 changed by UnFleshed One

I guess minimal fix would be a call to _unforgeDependencies in the right place.

Cryptic error message is because package A is not in the DB yet (has only "depends" file in its folder) and variable that was supposed to hold its name isn't updated. (And it just happens to hold the name of package in question). Or something like that. Just an amusing side effect.

I'll make the test package sometime soon.

04/30/08 13:56:58 changed by UnFleshed One

  • attachment ticket_47_test.tar.gz added.

04/30/08 13:58:19 changed by UnFleshed One

Ok, added test package. Install package A, it will install B, but break in [Install] section.

Then try uninstalling B.

05/08/08 19:09:36 changed by UnFleshed One

Actually it seems that _sessionRollback() isn't called at all, as it is commented out on line 2216 of apkg-funclib.

Uncommenting it seems to delete everything... I wonder why it was commented out? Maybe it deletes too much?

05/08/08 19:43:35 changed by UnFleshed One

I tried failing the package I'm currently working on, with rollback uncommented. I have two meta packages, that both depend on few common sub packages (libraries and such). I installed one of them and forced second one to fail. Rollback took out what was installed already (leaving few directories behind, but that looks like my own bug), and unforged dependencies, so later I could uninstall first package.

So it seemed to work as expected. Unless there was specific reason to comment it out (or unless we can't fix that reason) I suggest rollback to be uncommented in 1.2.5.

05/11/08 05:45:25 changed by isak

  • cc set to knighcl@gmail.com.

Hmm, I don't know why it is commented out. I found in changeset:756 that it was commented out for stability reasons.

Curtis, do you know more about this?