[Pkg-gnupg-commit] [gnupg2] 02/05: resolve ambiguity in aliased options and commands (Closes: #850475)

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jan 11 00:21:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 57a3951f9d42267388149b9760345394783bc71d
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Tue Jan 10 16:27:10 2017 -0500

    resolve ambiguity in aliased options and commands (Closes: #850475)
---
 ...n-Avoid-unnecessary-ambiguity-in-argparse.patch | 32 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 33 insertions(+)

diff --git a/debian/patches/resolve-ambiguity/0036-common-Avoid-unnecessary-ambiguity-in-argparse.patch b/debian/patches/resolve-ambiguity/0036-common-Avoid-unnecessary-ambiguity-in-argparse.patch
new file mode 100644
index 0000000..5faf432
--- /dev/null
+++ b/debian/patches/resolve-ambiguity/0036-common-Avoid-unnecessary-ambiguity-in-argparse.patch
@@ -0,0 +1,32 @@
+From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Date: Tue, 10 Jan 2017 15:59:36 -0500
+Subject: common: Avoid unnecessary ambiguity in argparse.
+
+* common/argparse.c (find_long_option): Avoid unnecessary ambiguity.
+
+If two struct ARGPARSE_OPTS share a prefix in their long_opt name, but
+have the exact same short_opt and flags, they are aliases and not
+distinct options.  Avoid reporting this as an ambiguity, so that (for
+example) both --clearsign and --clear-sign can be invoked as --clear.
+
+Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Debian-Bug-Id: 850475
+---
+ common/argparse.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/common/argparse.c b/common/argparse.c
+index dce725af9..d395229ad 100644
+--- a/common/argparse.c
++++ b/common/argparse.c
+@@ -898,7 +898,9 @@ find_long_option( ARGPARSE_ARGS *arg,
+ 	    int j;
+ 	    for(j=i+1; opts[j].short_opt; j++ ) {
+ 		if( opts[j].long_opt
+-		    && !strncmp( opts[j].long_opt, keyword, n ) )
++		    && !strncmp( opts[j].long_opt, keyword, n )
++                    && !(opts[j].short_opt == opts[i].short_opt
++                         && opts[j].flags == opts[i].flags ) )
+ 		    return -2;	/* abbreviation is ambiguous */
+ 	    }
+ 	    return i;
diff --git a/debian/patches/series b/debian/patches/series
index 66d03bc..ef62927 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -33,3 +33,4 @@ gpg-agent-idling/0004-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
 0033-common-Fix-fallback-code.patch
 0034-tools-Fix-memory-leaks-and-improve-error-handling.patch
 0035-doc-Mention-dirmngr.conf.patch
+resolve-ambiguity/0036-common-Avoid-unnecessary-ambiguity-in-argparse.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list