[
https://issues.apache.org/jira/browse/MGPG-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884200#comment-17884200
]
ASF GitHub Bot commented on MGPG-136:
-------------------------------------
michael-o commented on code in PR #120:
URL: https://github.com/apache/maven-gpg-plugin/pull/120#discussion_r1773041660
##########
src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java:
##########
@@ -270,6 +270,20 @@ public abstract class AbstractGpgMojo extends AbstractMojo
{
@Parameter(property = "gpg.bestPractices", defaultValue = "false")
private boolean bestPractices;
+ /**
+ * Whether to append the passphrase with LF character or not, as on some
systems and some GPG executable combinations
+ * lack of this character may cause GPG to not detect passphrase on STDIN.
Since 3.2.0 it was always appended, unless
+ * passphrase itself ended with line separator. This parameter affects
ONLY the GPG signer, not the BC signer.
+ * <p>
+ * By default, this parameter is {@code true} to retain same behaviour as
before.
+ *
+ * @since 3.2.7
+ * @see <a href="https://issues.apache.org/jira/browse/MGPG-99">MGPG-99</a>
+ * @see <a
href="https://issues.apache.org/jira/browse/MGPG-136">MGPG-136</a>
+ */
+ @Parameter(property = "gpg.passphraseLf", defaultValue = "true")
+ private boolean passphraseLf;
Review Comment:
I think this parameter should just be `terminatePassphrase`
##########
src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java:
##########
@@ -270,6 +270,20 @@ public abstract class AbstractGpgMojo extends AbstractMojo
{
@Parameter(property = "gpg.bestPractices", defaultValue = "false")
private boolean bestPractices;
+ /**
+ * Whether to append the passphrase with LF character or not, as on some
systems and some GPG executable combinations
Review Comment:
Whether to to terminate the passphrase with the LF character or not, ....
> "gpg: signing failed: Bad passphrase" on GitHub Windows runners
> ---------------------------------------------------------------
>
> Key: MGPG-136
> URL: https://issues.apache.org/jira/browse/MGPG-136
> Project: Maven GPG Plugin
> Issue Type: Bug
> Affects Versions: 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5
> Environment: Apache Maven 3.9.6
> (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
> Maven home:
> C:\Users\runneradmin\.m2\wrapper\dists\apache-maven-3.9.6-bin\3311e1d4\apache-maven-3.9.6
> Java version: 1.8.0_422, vendor: Azul Systems, Inc., runtime:
> C:\hostedtoolcache\windows\Java_Zulu_jdk\8.0.422-5\x64\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows server 2022", version: "10.0", arch: "aarch64", family:
> "windows"
> Reporter: Gili
> Priority: Critical
> Fix For: 3.2.7
>
>
> Version 3.2.0 - 3.2.5 fail with "gpg: signing failed: Bad passphrase" on
> GitHub Windows Runners.
> Using Linux or downgrading to version 3.1.0 seems to work fine.
> It's not clear what changed in these newer versions but
> [https://github.com/apache/maven-gpg-plugin/blob/3a31714e9cbdde86a6b12f1ef05d5c60252fef4a/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java#L368]
> looks like a highly supicious way of reading environment variables. It's
> possible that this approach does not work properly under Powershell.
> If I echo "$env:MAVEN_GPG_PASSPHRASE" on the GitHub Windows runner, I get
> back the correct value, so it sounds like there is a bug in the way that this
> plugin is choosing to read the environment variable.
> What makes this a bit tricky, however, is that the environment variable is
> called $MAVEN_GPG_PASSPHRASE on Linux, %MAVEN_GPG_PASSPHRASE% on cmd.exe and
> $env:MAVEN_GPG_PASSPHRASE on Powershell. GitHub is using the Powershell
> variant.
> Can you guys please look into this?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)