Opened 8 years ago

Closed 8 years ago

#51649 closed defect (fixed)

gnupg21 @2.1.12_0: selects +pinentry when pinentry-mac is active

Reported by: larryv (Lawrence Velázquez) Owned by: roederja
Priority: Normal Milestone:
Component: ports Version: 2.3.99
Keywords: haspatch Cc: Ionic (Mihai Moldovan)
Port: gnupg21

Description

I am running 10.11, and pinentry is not installed. I assume that the intended behavior on a modern system is to default to +pinentry_mac unless pinentry is active and pinentry-mac is not. Yet, this is what I am seeing:

% sudo port deactivate pinentry-mac
Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents.
The following ports will break: gnupg21 @2.1.13_0
Continue? [y/N]: y
Warning: Deactivate forced.  Proceeding despite dependencies.
--->  Deactivating pinentry-mac @0.9.4_0
--->  Cleaning pinentry-mac
% port variants gnupg21
gnupg21 has the variants:
   pinentry: Handle user input via pinentry.
     * conflicts with pinentry_mac
[+]pinentry_mac: Handle user input via pinentry-mac. Only compatible with OS X 10.8+.
     * conflicts with pinentry
   universal: Build for multiple architectures
% sudo port activate pinentry-mac
--->  Activating pinentry-mac @0.9.4_0
--->  Cleaning pinentry-mac
--->  Some of the ports you installed have notes:

[snip]

% port variants gnupg21
gnupg21 has the variants:
[+]pinentry: Handle user input via pinentry.
     * conflicts with pinentry_mac
   pinentry_mac: Handle user input via pinentry-mac. Only compatible with OS X 10.8+.
     * conflicts with pinentry
   universal: Build for multiple architectures

I think the portfile logic that determines the presence of pinentry and pinentry-mac is incorrect. Remember that Tcl’s catch command returns zero (Tcl “false”) on success and nonzero (“true”) on error—the opposite of what Tcl conditionals expect. I think this fixes the issue:

  • dports/mail/gnupg21/Portfile

    diff --git a/dports/mail/gnupg21/Portfile b/dports/mail/gnupg21/Portfile
    index e9aa87f..fb55e3a 100644
    a b platform darwin { 
    4242        if {${os.subplatform} ne "macosx" ||
    4343            ${xcodeversion} eq "none" ||
    4444            [vercmp ${xcodeversion} {5.0}] < 0 ||
    45             ${os.major} < 12 || ([catch {registry_active pinentry}] &&
    46                                  ![catch {registry_active pinentry-mac}])} {
     45            ${os.major} < 12 || (![catch {registry_active pinentry}] &&
     46                                 [catch {registry_active pinentry-mac}])} {
    4747            default_variants-append +pinentry
    4848        } else {
    4949            default_variants-append +pinentry_mac
% sudo port deactivate pinentry-mac
Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents.
The following ports will break: gnupg21 @2.1.13_0
Continue? [y/N]: y
Warning: Deactivate forced.  Proceeding despite dependencies.
--->  Deactivating pinentry-mac @0.9.4_0
--->  Cleaning pinentry-mac
% port variants gnupg21
gnupg21 has the variants:
   pinentry: Handle user input via pinentry.
     * conflicts with pinentry_mac
[+]pinentry_mac: Handle user input via pinentry-mac. Only compatible with OS X 10.8+.
     * conflicts with pinentry
   universal: Build for multiple architectures
% sudo port activate pinentry-mac
--->  Activating pinentry-mac @0.9.4_0
--->  Cleaning pinentry-mac
--->  Some of the ports you installed have notes:

[snip]

% port variants gnupg21
gnupg21 has the variants:
   pinentry: Handle user input via pinentry.
     * conflicts with pinentry_mac
[+]pinentry_mac: Handle user input via pinentry-mac. Only compatible with OS X 10.8+.
     * conflicts with pinentry
   universal: Build for multiple architectures

Change History (1)

comment:1 Changed 8 years ago by Ionic (Mihai Moldovan)

Resolution: fixed
Status: newclosed

I forgot to backport the fix from gpg-agent.

Backported in r149396.

Note: See TracTickets for help on using tickets.