Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMQ-9645] Fix double slash in path #1376

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hailengc
Copy link

@hailengc hailengc commented Jan 13, 2025

Problem

When ActiveMQ starts up with ./bin/activemq console, there is double slash (//) shows in the output, example:

  • ... Configurations are loaded in the following order: (omit...)/apache-activemq-6.2.0-SNAPSHOT//bin/setenv
  • .... INFO: Creating pidfile (omit...)/apache-activemq-6.2.0-SNAPSHOT//data/activemq.pid
  • ... -Dactivemq.classpath= (omit...)/apache-activemq-6.2.0-SNAPSHOT//conf

Description of Change

This fix uses Parameter Expansion which is a POSIX standard feature in shell ( reference doc) . The syntax "${ACTIVEMQ_BASE%/}/data" meaning it removes the trailing / if $ACTIVEMQ_BASE ends with a /, otherwise it does nothing.

  • Apply this to both $ACTIVEMQ_HOME and $ACTIVEMQ_BASE where they are concatenated with sub path
  • Not touching anything regarding non-linx platform ("cygwin" )

Test

  • Running it locally and seeing no double slash in the path in the output.

  • Verified Activemq starts up normally with pid file created.

  • I also made changes in below config files and they are correctly reflected

    * users.properties and login.properties 
    * acitvemq.xml and jolokia-access.xml
    * log4j2.properties
    

@kenliao94
Copy link
Contributor

@hailengc thanks for the PR! Did you test if everything still work (loading configuration correctly ... etc)? It should, just double check because it depends on where the // is.

@hailengc hailengc changed the title fix double slash in path Fix double slash in path Jan 13, 2025
@hailengc
Copy link
Author

hailengc commented Jan 13, 2025

Hey @kenliao94 ,

I verified Activemq starts up normally with pid file created. I also made changes in below config files and they are correctly reflected

  • users.properties and login.properties
  • acitvemq.xml and jolokia-access.xml
  • log4j2.properties

(original PR note updated)

Copy link
Contributor

@kenliao94 kenliao94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cshannon
Copy link
Contributor

This should have a Jira issue created so it can be tracked before it is merged

@hailengc
Copy link
Author

Hey @cshannon , yes I'll create one.

@hailengc hailengc changed the title Fix double slash in path [AMQ-9645] Fix double slash in path Jan 14, 2025
@hailengc
Copy link
Author

JIRA issue created: https://issues.apache.org/jira/browse/AMQ-9645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants