Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 461410 - app-admin/webapp-config: webapp-config -C ignores package version
Summary: app-admin/webapp-config: webapp-config -C ignores package version
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-11 15:48 UTC by Devan Franchini (RETIRED)
Modified: 2013-08-03 14:12 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Adds check for package name and version prior to uninstalling a webapp (Webapp-config-config.py-Adds-check-for-pn-and-pvr.patch,2.47 KB, patch)
2013-06-21 06:24 UTC, Devan Franchini (RETIRED)
Details | Diff
Adds check for package name and version prior to uninstalling a webapp (Webappconfig-config.py-Adds-check-for-pn-and-pvr.patch,2.50 KB, patch)
2013-06-21 20:52 UTC, Devan Franchini (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devan Franchini (RETIRED) gentoo-dev 2013-03-11 15:48:36 UTC
When running the command:
 
 "webapp-config -C <webapp> <webapp version> -d <webapp directory>"

webapp-config shows no discrimination when uninstalling the webapp and the version.

I tested this on multiple webapps using these commands:

 "webapp-config -C drupal 7.21 -d drupal" (I had 7.20 installed)

result:

It doesn't check for the version number of drupal and just uninstalls whatever is in that directory.

 "webapp-config -C drupal 7.20 -d phpBB"

result:

webapp-config will not check what webapp is installed in that directory and will remove whatever is in there, even if the webapp and version don't match up with the actual webapp installed in that directory.
Comment 1 Anthony Basile gentoo-dev 2013-03-12 22:25:08 UTC
(In reply to comment #0)
> When running the command:
>  
>  "webapp-config -C <webapp> <webapp version> -d <webapp directory>"
> 
> webapp-config shows no discrimination when uninstalling the webapp and the
> version.
> 
> I tested this on multiple webapps using these commands:
> 
>  "webapp-config -C drupal 7.21 -d drupal" (I had 7.20 installed)
> 
> result:
> 
> It doesn't check for the version number of drupal and just uninstalls
> whatever is in that directory.
> 
>  "webapp-config -C drupal 7.20 -d phpBB"
> 
> result:
> 
> webapp-config will not check what webapp is installed in that directory and
> will remove whatever is in there, even if the webapp and version don't match
> up with the actual webapp installed in that directory.

Devan, did you look through the code and verify it at that level.  It seems to me that by just adding another check compairing the command line version and the version stated in the .webapp file you can easily catch this and throw an error message saying "drupal 7.21 is not installed at $vhost_root, do you really want to proceed?"  where $vhost_root is defined in /etc/vhost/webapp-config.
Comment 2 Devan Franchini (RETIRED) gentoo-dev 2013-03-12 22:48:30 UTC
(In reply to comment #1)
> Devan, did you look through the code and verify it at that level.  It seems
> to me that by just adding another check compairing the command line version
> and the version stated in the .webapp file you can easily catch this and
> throw an error message saying "drupal 7.21 is not installed at $vhost_root,
> do you really want to proceed?"  where $vhost_root is defined in
> /etc/vhost/webapp-config.

I haven't looked through any code yet, I did plan on it but I figured it'd be best to submit a bug lest I forget about doing it later :)
Comment 3 Devan Franchini (RETIRED) gentoo-dev 2013-06-21 04:33:27 UTC
(In reply to Devan Franchini from comment #2)
> (In reply to comment #1)
> > Devan, did you look through the code and verify it at that level.  It seems
> > to me that by just adding another check compairing the command line version
> > and the version stated in the .webapp file you can easily catch this and
> > throw an error message saying "drupal 7.21 is not installed at $vhost_root,
> > do you really want to proceed?"  where $vhost_root is defined in
> > /etc/vhost/webapp-config.
> 
> I haven't looked through any code yet, I did plan on it but I figured it'd
> be best to submit a bug lest I forget about doing it later :)

Okay, I've looked through the code and I can see what it's doing. In config.py when you try and clean webapp from a directory it doesn't check to see if the package you're trying to uninstall is the package in the directory. However, it does check to see if the package and the version you're trying to list are installed on your system.

So if you installed a drupal 7.22 webapp under the directory "drupal" and tried to do this:

webapp-config -C foobar 7.20 -d drupal 

it would tell you it's unable to determine the master copy. HOWEVER, if you have another webapp installed on your system, for instance phpBB 3.0.11 and tried to execute the command:

webapp-config -C phpBB 3.0.11 -d drupal

it would uninstall the webapp in the drupal directory. It's verified in practice and I've checked the code for logic checks to see if the package and version being listed are the same as the one in the .webapp and I didn't find anything. I will try and hack something up to do it.
Comment 4 Devan Franchini (RETIRED) gentoo-dev 2013-06-21 06:24:28 UTC
Created attachment 351506 [details, diff]
Adds check for package name and version prior to uninstalling a webapp

This patch adds a check to config.py when the -C flag is called by the user. It will check the package name and version being called by the user against the package name and version in the .webapp file located in the directory declared by the user. If the package name and version declared by the user, and the package name and version in the .webapp file don't match then the program will abort and it won't uninstall the webapp.
Comment 5 Devan Franchini (RETIRED) gentoo-dev 2013-06-21 20:52:19 UTC
Created attachment 351606 [details, diff]
Adds check for package name and version prior to uninstalling a webapp

Commit message cleanup.
Comment 6 Anthony Basile gentoo-dev 2013-08-03 13:25:40 UTC
(In reply to Devan Franchini from comment #5)
> Created attachment 351606 [details, diff] [details, diff]
> Adds check for package name and version prior to uninstalling a webapp
> 
> Commit message cleanup.

committed

http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=81058b615b023de50244c200d420cbbf3f7a49d4
Comment 7 Anthony Basile gentoo-dev 2013-08-03 14:12:33 UTC
(In reply to Anthony Basile from comment #6)
> (In reply to Devan Franchini from comment #5)
> > Created attachment 351606 [details, diff] [details, diff] [details, diff]
> > Adds check for package name and version prior to uninstalling a webapp
> > 
> > Commit message cleanup.
> 
> committed
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;
> h=81058b615b023de50244c200d420cbbf3f7a49d4


please test webapp-config-1.51 which includes this commit