mojohaus / mojohaus/exec-maven-plugin

Argument quoting prevents expansion of glob expressions and environment variables on macOS

Open
#458 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
191
Forks
111
Avg merge
1d 21h
Merged PRs (30d)
4

Description

On macOS the following configuration results in an error.

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.5.0</version>
    <configuration>
      <skip>${skip.saving.reports}</skip>
    </configuration>
    <executions>
      <execution>
        <id>save_reports</id>
        <phase>post-integration-test</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <executable>ls</executable>
          <arguments>
            <argument>src/*</argument>
          </arguments>
          <outputFile>out.log</outputFile>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>
$ cat out.log
ls: src/*: No such file or directory

This is despite the fact that the directory exists and is non-empty on my system:

$ ls src/*
src/main:
java		resources

src/test:
resources

To further illustrate the problem, trying to echo $SHELL will output "$SHELL" rather than expanding the variable.

<goals>
  <goal>exec</goal>
</goals>
<configuration>
  <executable>echo</executable>
  <arguments>
    <argument>$SHELL</argument>
  </arguments>
  <outputFile>out.log</outputFile>
</configuration>
$ cat out.log
$SHELL

I haven't checked any of the plugin's code but my suspicion is that the arguments are quoted which prevents the shell from expanding them.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the exec goal with the shown executable, arguments, and outputFile configuration on macOS. Trace how the exec goal passes arguments to the command, then verify that the glob and environment-variable examples behave as expected without breaking other argument handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, macos, shell
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.