Преглед изворни кода

Unify execution error strings

Guillem Jover пре 16 година
родитељ
комит
e547cbf6aa

+ 3 - 3
dpkg-deb/build.c

@@ -398,7 +398,7 @@ void do_build(const char *const *argv) {
     if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory);
     if (chdir(BUILDCONTROLDIR)) ohshite(_("failed to chdir to .../DEBIAN"));
     execlp(TAR, "tar", "-cf", "-", "--format=gnu", ".", NULL);
-    ohshite(_("failed to exec tar -cf"));
+    ohshite(_("unable to execute %s (%s)"), "tar -cf", TAR);
   }
   close(p1[1]);
   /* Create a temporary file to store the control data in. Immediately unlink
@@ -464,7 +464,7 @@ void do_build(const char *const *argv) {
     m_dup2(p2[1],1); close(p2[0]); close(p2[1]);
     if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory);
     execlp(TAR, "tar", "-cf", "-", "--format=gnu", "--null", "-T", "-", "--no-recursion", NULL);
-    ohshite(_("failed to exec tar -cf"));
+    ohshite(_("unable to execute %s (%s)"), "tar -cf", TAR);
   }
   close(p1[0]);
   close(p2[1]);
@@ -488,7 +488,7 @@ void do_build(const char *const *argv) {
     if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory);
     execlp(FIND, "find", ".", "-path", "./" BUILDCONTROLDIR, "-prune", "-o",
            "-print0", NULL);
-    ohshite(_("failed to exec find"));
+    ohshite(_("unable to execute %s (%s)"), "find", FIND);
   }
   close(p3[1]);
   /* We need to reorder the files so we can make sure that symlinks

+ 4 - 3
dpkg-deb/extract.c

@@ -55,9 +55,10 @@ static void movecontrolfiles(const char *thing) {
   c1 = subproc_fork();
   if (!c1) {
     execlp("sh", "sh", "-c", buf, NULL);
-    ohshite(_("failed to exec sh -c mv foo/* &c"));
+    ohshite(_("unable to execute %s (%s)"),
+            _("shell command to move files"), buf);
   }
-  subproc_wait_check(c1, "sh -c mv foo/* &c", 0);
+  subproc_wait_check(c1, _("shell command to move files"), 0);
 }
 
 static void DPKG_ATTR_NORET
@@ -308,7 +309,7 @@ void extracthalf(const char *debar, const char *directory,
       unsetenv("TAR_OPTIONS");
 
       execlp(TAR, "tar", buffer, "-", NULL);
-      ohshite(_("failed to exec tar"));
+      ohshite(_("unable to execute %s (%s)"), "tar", TAR);
     }
     close(p2[0]);
     subproc_wait_check(c3, "tar", 0);

+ 2 - 2
dpkg-deb/info.c

@@ -60,9 +60,9 @@ static void cu_info_prepare(int argc, void **argv) {
   c1 = subproc_fork();
   if (!c1) {
     execlp(RM, "rm", "-rf", directory, NULL);
-    ohshite(_("failed to exec rm for cleanup"));
+    ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
   }
-  subproc_wait_check(c1, "rm cleanup", 0);
+  subproc_wait_check(c1, _("rm command for cleanup"), 0);
 } 
 
 static void info_prepare(const char *const **argvp,

+ 4 - 3
dpkg-split/split.c

@@ -65,18 +65,19 @@ deb_field(const char *filename, const char *field)
 		close(p[1]);
 
 		execlp(BACKEND, BACKEND, "--field", filename, field, NULL);
-		ohshite(_("failed to exec dpkg-deb to extract field value"));
+		ohshite(_("unable to execute %s (%s)"),
+		        _("package field value extraction"), BACKEND);
 	}
 	close(p[1]);
 
 	/* Parant reads from pipe. */
 	varbufreset(&buf);
-	fd_vbuf_copy(p[0], &buf, -1, _("dpkg-deb field extraction"));
+	fd_vbuf_copy(p[0], &buf, -1, _("package field value extraction"));
 	varbufaddc(&buf, '\0');
 
 	close(p[0]);
 
-	subproc_wait_check(pid, _("dpkg-deb field extraction"), PROCPIPE);
+	subproc_wait_check(pid, _("package field value extraction"), PROCPIPE);
 
 	/* Trim down trailing junk. */
 	for (end = buf.buf + strlen(buf.buf) - 1; end - buf.buf >= 1; end--)

+ 1 - 1
scripts/Dpkg/IPC.pm

@@ -268,7 +268,7 @@ sub spawn {
 	# Close some inherited filehandles
 	close($_) foreach (@{$opts{"close_in_child"}});
 	# Execute the program
-	exec({ $prog[0] } @prog) or syserr(_g("exec %s"), "@prog");
+	exec({ $prog[0] } @prog) or syserr(_g("unable to execute %s"), "@prog");
     }
     # Close handle that we can't use any more
     close($opts{"from_handle"}) if exists $opts{"from_handle"};

+ 2 - 1
scripts/Dpkg/Shlibs/Cppfilt.pm

@@ -47,7 +47,8 @@ sub get_cppfilt {
 	$filt->{pid} = spawn(exec => [ 'c++filt', "--format=$type" ],
 	                     from_pipe => \$filt->{from},
 	                     to_pipe => \$filt->{to});
-	internerr(_g("unable to execute c++filt")) unless defined $filt->{from};
+	internerr(_g("unable to execute %s"), "c++filt")
+	    unless defined $filt->{from};
 	$filt->{from}->autoflush(1);
 
 	$cppfilts{$type} = $filt;

+ 1 - 1
scripts/dpkg-gencontrol.pl

@@ -301,7 +301,7 @@ if (!defined($substvars->get('Installed-Size'))) {
     if (!$c) {
         chdir("$packagebuilddir") ||
             syserr(_g("chdir for du to \`%s'"), $packagebuilddir);
-        exec("du", "-k", "-s", ".") or syserr(_g("exec %s"), "du");
+        exec("du", "-k", "-s", ".") or syserr(_g("unable to execute %s"), "du");
     }
     my $duo = '';
     while (<DU>) {

+ 1 - 1
scripts/dpkg-shlibdeps.pl

@@ -825,7 +825,7 @@ sub find_packages {
 	open STDERR, ">", "/dev/null";
 	$ENV{LC_ALL} = "C";
 	exec("dpkg", "--search", "--", @files)
-	    || syserr(_g("cannot exec dpkg"));
+	    || syserr(_g("unable to execute %s"), "dpkg");
     }
     while(defined($_ = <DPKG>)) {
 	chomp($_);

+ 6 - 4
src/configure.c

@@ -515,11 +515,12 @@ showdiff(const char *old, const char *new)
 			shell = DEFAULTSHELL;
 
 		execlp(shell, shell, "-c", cmdbuf, NULL);
-		ohshite(_("failed to run %s (%.250s)"), DIFF, cmdbuf);
+		ohshite(_("unable to execute %s (%s)"),
+		        _("conffile difference visualizer"), cmdbuf);
 	}
 
 	/* Parent process. */
-	subproc_wait(pid, "shell");
+	subproc_wait(pid, _("conffile difference visualizer"));
 }
 
 /**
@@ -553,11 +554,12 @@ spawn_shell(const char *confold, const char *confnew)
 		setenv("DPKG_CONFFILE_NEW", confnew, 1);
 
 		execlp(shell, shell, "-i", NULL);
-		ohshite(_("failed to exec shell (%.250s)"), shell);
+		ohshite(_("unable to execute %s (%s)"),
+		        _("conffile shell"), shell);
 	}
 
 	/* Parent process. */
-	subproc_wait(pid, "shell");
+	subproc_wait(pid, _("conffile shell"));
 }
 
 /**

+ 1 - 1
src/help.c

@@ -584,7 +584,7 @@ void ensure_pathname_nonexisting(const char *pathname) {
   c1 = subproc_fork();
   if (!c1) {
     execlp(RM, "rm", "-rf", "--", pathname, NULL);
-    ohshite(_("failed to exec rm for cleanup"));
+    ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
   }
   debug(dbg_eachfile,"ensure_pathname_nonexisting running rm -rf");
   subproc_wait_check(c1, "rm cleanup", 0);

+ 8 - 4
src/processarc.c

@@ -146,7 +146,8 @@ void process_archive(const char *filename) {
     c1 = subproc_fork();
     if (!c1) {
       execlp(SPLITTER, SPLITTER, "-Qao", reasmbuf, filename, NULL);
-      ohshite(_("failed to exec dpkg-split to see if it's part of a multiparter"));
+      ohshite(_("unable to execute %s (%s)"),
+              _("split package reassembly"), SPLITTER);
     }
     status = subproc_wait(c1, SPLITTER);
     switch (WIFEXITED(status) ? WEXITSTATUS(status) : -1) {
@@ -174,7 +175,8 @@ void process_archive(const char *filename) {
     c1 = subproc_fork();
     if (!c1) {
       execl(DEBSIGVERIFY, DEBSIGVERIFY, "-q", filename, NULL);
-      ohshite(_("failed to execl debsig-verify"));
+      ohshite(_("unable to execute %s (%s)"),
+              _("package signature verification"), DEBSIGVERIFY);
     } else {
       int status;
 
@@ -224,7 +226,8 @@ void process_archive(const char *filename) {
   if (!c1) {
     cidirrest[-1] = '\0';
     execlp(BACKEND, BACKEND, "--control", filename, cidir, NULL);
-    ohshite(_("failed to exec dpkg-deb to extract control information"));
+    ohshite(_("unable to execute %s (%s)"),
+            _("package control information extraction"), BACKEND);
   }
   subproc_wait_check(c1, BACKEND " --control", 0);
 
@@ -619,7 +622,8 @@ void process_archive(const char *filename) {
   if (!c1) {
     m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
     execlp(BACKEND, BACKEND, "--fsys-tarfile", filename, NULL);
-    ohshite(_("unable to exec dpkg-deb to get filesystem archive"));
+    ohshite(_("unable to execute %s (%s)"),
+            _("package filesystem archive extraction"), BACKEND);
   }
   close(p1[1]);
   p1[1] = -1;