Patch for #4502 and #4503

Laurent Fousse laurent@komite.net
Sat, 24 Jan 2004 22:31:00 +0100


--2B/JsCI69OhZNC5r
Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S"
Content-Disposition: inline


--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi Joost and Peter !

I've changed calls to 'mkdir' in calls to 'mkpath' and the issue about
cabot not being able to create directories seems to be fixed.

I tried to look at the "FIXME: this should be part of Cabot.pm" but
I'm really not at ease about how variables can be shared with a module.

And like I've said to numerous (well, two) Debian developers who asked
about the ITP, I'd be happy to let one of you maintain the package if
you want to :-)

Regards,

Laurent.

--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff-to-send
Content-Transfer-Encoding: quoted-printable

diff -ru cabot-cvs/ca-createsendout cabot-0cvs20040121/ca-createsendout
--- cabot-cvs/ca-createsendout	2004-01-24 21:17:17.000000000 +0100
+++ cabot-0cvs20040121/ca-createsendout	2004-01-24 21:36:53.000000000 +0100
@@ -23,6 +23,7 @@
 use GnuPG::Interface;
 use IO::Handle;
 use English;
+use File::Path;
=20
 our %CONFIG;
 my $config =3D $ENV{'HOME'} . '/.cabotrc';
@@ -41,16 +42,16 @@
 sub makekeydir($$;$) {
 	my ($what, $keyid, $uid) =3D @_;
 	unless ( -d $CONFIG{$what} ) {
-	    mkdir $CONFIG{$what} or
+	    mkpath($CONFIG{$what}, 0, 0711) or
 	      die "Cannot create dir ".$CONFIG{$what}."\n";
 	}
 	unless ( -d getkeydir($what, $keyid) ) {
-	    mkdir getkeydir($what, $keyid) or
+	    mkpath(getkeydir($what, $keyid), 0, 0711) or
 	      die "Cannot create dir ".getkeydir($what, $keyid)."\n";
 	}
 	return unless defined $uid;
 	unless ( -d getkeydir($what, $keyid, $uid) ) {
-	    mkdir getkeydir($what, $keyid, $uid) or
+	    mkpath(getkeydir($what, $keyid, $uid), 0, 0711) or
 	      die "Cannot create dir ".getkeydir($what, $keyid, $uid)."\n";
 	}
 }
diff -ru cabot-cvs/ca-dosign cabot-0cvs20040121/ca-dosign
--- cabot-cvs/ca-dosign	2004-01-24 21:17:17.000000000 +0100
+++ cabot-0cvs20040121/ca-dosign	2004-01-24 21:16:35.000000000 +0100
@@ -23,6 +23,7 @@
 use GnuPG::Interface;
 use IO::Handle;
 use English;
+use File::Path;
=20
 $OUTPUT_AUTOFLUSH =3D 1;=20
=20
@@ -45,16 +46,16 @@
 sub makekeydir($$;$) {
 	my ($what, $keyid, $uid) =3D @_;
 	unless ( -d $CONFIG{$what} ) {
-	    mkdir $CONFIG{$what} or
+	    mkpath($CONFIG{$what}, 0, 0711) or
 	      die "Cannot create dir ".$CONFIG{$what}."\n";
 	}
 	unless ( -d getkeydir($what, $keyid) ) {
-	    mkdir getkeydir($what, $keyid) or
+	    mkpath(getkeydir($what, $keyid), 0, 0711) or
 	      die "Cannot create dir ".getkeydir($what, $keyid)."\n";
 	}
 	return unless defined $uid;
 	unless ( -d getkeydir($what, $keyid, $uid) ) {
-	    mkdir getkeydir($what, $keyid, $uid) or
+	    mkpath(getkeydir($what, $keyid, $uid), 0, 0711) or
 	      die "Cannot create dir ".getkeydir($what, $keyid, $uid)."\n";
 	}
 }
@@ -296,7 +297,7 @@
 	print $send_mail ? "done.\n" : "not really.\n";
=20
 	unless ( -d $CONFIG{'done'} ) {
-		mkdir $CONFIG{'done'} or die("Cannot mkdir ".$CONFIG{'done'}.": $!\n");
+		mkpath($CONFIG{'done'}, 0, 0711) or die("Cannot mkdir ".$CONFIG{'done'}.=
": $!\n");
 	};
=20
 	makekeydir('done', $keyid);
diff -ru cabot-cvs/ca-recv cabot-0cvs20040121/ca-recv
--- cabot-cvs/ca-recv	2004-01-24 21:17:17.000000000 +0100
+++ cabot-0cvs20040121/ca-recv	2004-01-24 22:15:26.000000000 +0100
@@ -20,6 +20,7 @@
=20
=20
 use strict;
+use File::Path;
=20
 umask(0007);
=20
@@ -114,13 +115,13 @@
=20
 unless ( -d getkeydir('tosign', $keyid) ) {
         unless (-d $CONFIG{'tosign'}) {
-            unless (mkdir $CONFIG{'tosign'}) {
+            unless (mkpath($CONFIG{'tosign'}, 0, 0711)) {
 		    send_mail("CABOT: Cannot create dir",
 		          "Cannot create dir ".$CONFIG{'tosign'}.": $!\nOriginal message=
:\n\n$in\n");
                     exit(0);
             }
         }
-	unless (mkdir(getkeydir('tosign', $keyid)) ) {
+	unless (mkpath(getkeydir('tosign', $keyid), 0, 0771)) {
 		send_mail("CABOT: Cannot create dir in tosign",=20
 		          "Cannot create dir ".getkeydir('tosign', $keyid).": $!\nOrigin=
al message:\n\n$in\n");
 		exit(0);
diff -ru cabot-cvs/ca-sendout cabot-0cvs20040121/ca-sendout
--- cabot-cvs/ca-sendout	2004-01-24 21:17:17.000000000 +0100
+++ cabot-0cvs20040121/ca-sendout	2004-01-24 21:14:55.000000000 +0100
@@ -23,6 +23,7 @@
 use GnuPG::Interface;
 use English;
 use IO::Handle;
+use File::Path;
=20
 our %CONFIG;
 my $config =3D $ENV{'HOME'} . '/.cabotrc';
@@ -41,16 +42,16 @@
 sub makekeydir($$;$) {
 	my ($what, $keyid, $uid) =3D @_;
 	unless ( -d $CONFIG{$what} ) {
-	    mkdir $CONFIG{$what} or
+	    mkpath($CONFIG{$what}, 0, 0711) or
 	      die "Cannot create dir ".$CONFIG{$what}."\n";
 	}
 	unless ( -d getkeydir($what, $keyid) ) {
-	    mkdir getkeydir($what, $keyid) or
+	    mkpath(getkeydir($what, $keyid), 0, 0711) or
 	      die "Cannot create dir ".getkeydir($what, $keyid)."\n";
 	}
 	return unless defined $uid;
 	unless ( -d getkeydir($what, $keyid, $uid) ) {
-	    mkdir getkeydir($what, $keyid, $uid) or
+	    mkpath(getkeydir($what, $keyid, $uid), 0, 0711) or
 	      die "Cannot create dir ".getkeydir($what, $keyid, $uid)."\n";
 	}
 }

--AhhlLboLdkugWU4S--

--2B/JsCI69OhZNC5r
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAEuQURoAVF6FpbSsRAsgOAJ9zHrETn+CojtGl6z77VDFlkwheVwCbBuqg
Kp3pJbr+vlae7NkQQmH17Bc=
=n9Oj
-----END PGP SIGNATURE-----

--2B/JsCI69OhZNC5r--