[Frugalware-darcs] frugalware-current: pacman-2.9.6-19-i686

VMiklos vmiklos at frugalware.org
Sat Aug 27 21:49:06 CEST 2005


Sat Aug 27 20:59:28 CEST 2005  VMiklos <vmiklos at frugalware.org>
  * pacman-2.9.6-19-i686
  added -optcorrect.diff
  see that patch header!
  from krix (with some modifications by me)
diff -rN -u old-frugalware-current/source/base/pacman/FrugalBuild new-frugalware-current/source/base/pacman/FrugalBuild
--- old-frugalware-current/source/base/pacman/FrugalBuild	2005-08-27 21:48:30.000000000 +0200
+++ new-frugalware-current/source/base/pacman/FrugalBuild	2005-08-27 21:09:32.000000000 +0200
@@ -1,4 +1,4 @@
-# Last Modified: Sat, 27 Aug 2005 00:57:01 +0200
+# Last Modified: Sat, 27 Aug 2005 20:59:15 +0200
 # Compiling Time: 0.10 SBU
 # Maintainer: VMiklos <vmiklos at frugalware.org>
 
@@ -41,7 +41,8 @@
 	$pkgname-$pkgver-regexp.diff \
 	$pkgname-$pkgver-sha1sum-in-fdb.patch \
 	$pkgname-$pkgver-provides_search.patch \
-	$pkgname-$pkgver-dependsonly.diff)
+	$pkgname-$pkgver-dependsonly.diff \
+	$pkgname-$pkgver-optcorrect.diff)
 sha1sums=('93d9ec990ab84fb75cd8eb335c8ac17108a9db25' \
 	  '5037ed30cc765cdb8c2dbc85f344e6c299e23fff' \
 	  'caaed4d36fd8cc8789761270f5e6b372f329b83f' \
@@ -69,7 +70,8 @@
 	  'd5c4921a023e3325e3824f621ec5e7a2d4ac6a60' \
 	  '0d982a46ebe9ca49b83f71668a5e0567de00c9cd' \
 	  'b10b4f729f45cb253b33f3e0a8a825d3637e6dcb' \
-	  '1e677e3c246444f6f443274271e833c55c4298cd')
+	  '1e677e3c246444f6f443274271e833c55c4298cd' \
+	  'ce1a1897e8d0ef3d784a3ec2bf82576eb308584f')
 
 GZIP=1
 
diff -rN -u old-frugalware-current/source/base/pacman/pacman-2.9.6-optcorrect.diff new-frugalware-current/source/base/pacman/pacman-2.9.6-optcorrect.diff
--- old-frugalware-current/source/base/pacman/pacman-2.9.6-optcorrect.diff	1970-01-01 01:00:00.000000000 +0100
+++ new-frugalware-current/source/base/pacman/pacman-2.9.6-optcorrect.diff	2005-08-27 21:09:32.000000000 +0200
@@ -0,0 +1,59 @@
+Date: 2005-08-27
+Initial Package Version: 2.9.6
+Upstream Status: Not yet submitted.
+Origin: Christian Hamar alias krix <krics at linuxforum.hu> and
+        Miklos Vajna <vmiklos at frugalware.org>
+Description: Fixes three annoying bugs in pacman's option parsing.
+ 1) If the operation requires at least one target, display the operation's help.
+    (eg. pacman -R is not a valid command)
+ 2) If there is an unknown option, after printfing the error message display
+    the operation's help.
+ 3) fprintf an error message to stderr + display help if no operation specified,
+    but would have to. (eg. -h or -V not used)
+
+Examples:
+Invalid options        Original            Patched
+ -Qx                   invalid option      invalid option + Q's help
+ -A -R                 only one operation  unchanged
+ -R                    silent              -R's help
+ foo                   slient              general help
+
+Diffstat:
+ pacman.c |   12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+diff -Naur pacman-2.9.6.orig/src/pacman.c pacman-2.9.6/src/pacman.c
+--- pacman-2.9.6.orig/src/pacman.c	2005-08-27 19:48:17.000000000 +0200
++++ pacman-2.9.6/src/pacman.c	2005-08-27 20:41:24.000000000 +0200
+@@ -241,6 +241,10 @@
+ 	/* load pm_packages cache */
+ 	pm_packages = db_loadpkgs(db_local);
+ 
++	/* the operation requires at least one target */
++	if (list_count(pm_targets) == 0 && pmo_op != PM_QUERY)
++		usage(pmo_op, (char*)basename(argv[0]));
++
+ 	/* start the requested operation */
+ 	switch(pmo_op) {
+ 		case PM_ADD:     ret = pacman_add(db_local, pm_targets, NULL);     break;
+@@ -3636,7 +3640,7 @@
+ 			case 'v': pmo_verbose = 1; break;
+ 			case 'w': pmo_s_downloadonly = 1; break;
+ 			case 'y': pmo_s_sync = 1; break;
+-			case '?': return(1);
++			case '?': pmo_help = 1; break;
+ 			default:  return(1);
+ 		}
+ 	}
+@@ -3655,6 +3659,12 @@
+ 		return(2);
+ 	}
+ 
++	if (optind == 1) {
++		fprintf(stderr, "error: you should specify at least one operation\n");
++		usage(pmo_op, (char*)basename(argv[0]));
++		return(2);
++	}
++
+ 	while(optind < argc) {
+ 		/* add the target to our target array */
+ 		char *s = strdup(argv[optind]);



More information about the Frugalware-darcs mailing list