Bug 991469 - The CLI command "module remove" fails to delete non-empty folders
Summary: The CLI command "module remove" fails to delete non-empty folders
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI
Version: 6.1.0,6.1.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ER1
: EAP 6.2.0
Assignee: Ivo Studensky
QA Contact: Petr Kremensky
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-02 13:27 UTC by Josef Cacek
Modified: 2013-12-15 16:19 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-15 16:19:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WFLY-1896 0 Major Closed The CLI command "module remove" fails to delete non-empty folders 2018-10-19 04:15:25 UTC
Red Hat Issue Tracker WFLY-1913 0 Major Closed CLI 'module add' command fail if a drive letter is specified in its resource path 2018-10-19 04:15:25 UTC

Description Josef Cacek 2013-08-02 13:27:40 UTC
The "module remove" command fails when it deletes non-empty folder.

For instance a resource adapter module contains META-INF/ra.xml file in the module. When I choose to delete the module, it fails:

[standalone@localhost:9999 /] module remove --name=org.jboss.ironjacamar.ra16out 
Failed to delete /home/jcacek/Testing/jboss-eap-6.1.1.ER4/modules/org/jboss/ironjacamar/ra16out/main/META-INF

Comment 3 Ondrej Lukas 2013-09-26 07:11:42 UTC
Verified on EAP 6.2.0.ER3

Comment 4 JBoss JIRA Server 2013-09-30 13:33:49 UTC
Stan Silvert <ssilvert> updated the status of jira WFLY-1913 to Reopened

Comment 5 JBoss JIRA Server 2013-09-30 13:33:49 UTC
Stan Silvert <ssilvert> made a comment on jira WFLY-1913

Reopening.

This fix breaks module commands that are part of a deployment archive.  See erroneous fix here: https://github.com/wildfly/wildfly/commit/e4c831dfe87668dd3a1c308ae43378e015e416b4#diff-f8a04572ea92d965c2b95278f93cdd90

You can't just get rid of the call to ctx.getCurrentDir().  It's there for a reason.  A module command can be included in a deploy.scr script, which is inside a *.cli archive.  See https://community.jboss.org/wiki/CLIDeploymentArchive

The call to ctx.getCurrenDir() ensures that the resources are found in the archive rather than on the file system.

Comment 6 JBoss JIRA Server 2013-09-30 14:33:27 UTC
Ivo Studensky <istudens> made a comment on jira WFLY-1913

I've got rid of it since the ctx.getCurrentDir() is called before that line, within translatePath() call at line 151 unless the path starts with root, see [1]. Thanks for the counter example I will take a look at it.

[1] https://github.com/wildfly/wildfly/blob/master/cli/src/main/java/org/jboss/as/cli/handlers/module/ASModuleHandler.java#L151

Comment 7 JBoss JIRA Server 2013-09-30 15:46:36 UTC
Stan Silvert <ssilvert> made a comment on jira WFLY-1913

I've attached a *.cli archive that demonstrates the problem.

Comment 8 JBoss JIRA Server 2013-10-01 13:41:38 UTC
Ivo Studensky <istudens> made a comment on jira WFLY-1913

I've hacked up a simple test case for the CLI deployment archive involving a simple war which works as expected.
I will continue on this and test it with the archive you attached.

https://github.com/istudens/wildfly/commit/411d60fa299484db688ccde747a04bc19107b70a

Comment 9 JBoss JIRA Server 2013-10-01 13:44:14 UTC
Ivo Studensky <istudens> made a comment on jira WFLY-1913

Ah, nevermind. It needs a module add command included in the deploy.scr script. I will enhance the test case accordingly and fix the issue.

Comment 10 JBoss JIRA Server 2013-10-01 14:02:16 UTC
Ivo Studensky <istudens> made a comment on jira WFLY-1913

Ah, nevermind, too many context switches on my side. It needs a module add command included in the deploy.scr script. I will enhance the test case accordingly and fix the issue.

Comment 11 JBoss JIRA Server 2013-10-02 15:23:49 UTC
Ivo Studensky <istudens> made a comment on jira WFLY-1913

Created a new PR which fixes the regression and adds a test-case for it.

Comment 13 JBoss JIRA Server 2013-10-07 08:16:51 UTC
Ivo Studensky <istudens> made a comment on jira WFLY-1913

Merged.


Note You need to log in before you can comment on or make changes to this bug.