Bug 991469 - The CLI command "module remove" fails to delete non-empty folders
The CLI command "module remove" fails to delete non-empty folders
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI (Show other bugs)
6.1.0,6.1.1
Unspecified Unspecified
unspecified Severity medium
: ER1
: EAP 6.2.0
Assigned To: Ivo Studensky
Petr Kremensky
Russell Dickenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-02 09:27 EDT by Josef Cacek
Modified: 2013-12-15 11:19 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-15 11:19:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-1896 Major Resolved The CLI command "module remove" fails to delete non-empty folders 2016-06-20 07:23 EDT
JBoss Issue Tracker WFLY-1913 Major Resolved CLI 'module add' command fail if a drive letter is specified in its resource path 2016-06-20 07:23 EDT

  None (edit)
Description Josef Cacek 2013-08-02 09:27:40 EDT
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 03:11:42 EDT
Verified on EAP 6.2.0.ER3
Comment 4 JBoss JIRA Server 2013-09-30 09:33:49 EDT
Stan Silvert <ssilvert@jboss.com> updated the status of jira WFLY-1913 to Reopened
Comment 5 JBoss JIRA Server 2013-09-30 09:33:49 EDT
Stan Silvert <ssilvert@jboss.com> 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 10:33:27 EDT
Ivo Studensky <istudens@redhat.com> 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 11:46:36 EDT
Stan Silvert <ssilvert@jboss.com> 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 09:41:38 EDT
Ivo Studensky <istudens@redhat.com> 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 09:44:14 EDT
Ivo Studensky <istudens@redhat.com> 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 10:02:16 EDT
Ivo Studensky <istudens@redhat.com> 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 11:23:49 EDT
Ivo Studensky <istudens@redhat.com> 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 04:16:51 EDT
Ivo Studensky <istudens@redhat.com> 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.