Просмотр исходного кода

Print errors while reading file list files on a new line

Closes: #552517
Guillem Jover лет назад: 14
Родитель
Сommit
07a2d8fe8b
3 измененных файлов с 8 добавлено и 4 удалено
  1. 2 0
      debian/changelog
  2. 6 3
      lib/dpkg/progress.c
  3. 0 1
      src/filesdb.c

+ 2 - 0
debian/changelog

@@ -6,6 +6,8 @@ dpkg (1.16.3) UNRELEASED; urgency=low
     Closes: #665050
   * Check all dpkg-divert filename arguments to be absolute and to not
     contain newlines. Closes: #21722
+  * Print errors while reading the file list files on a new line instead
+    of just after the progress percentage. Closes: #552517
 
   [ Updated dpkg translations ]
   * French (Christian Perrier)

+ 6 - 3
lib/dpkg/progress.c

@@ -39,7 +39,10 @@ progress_init(struct progress *progress, const char *text, int max)
 
 	progress->on_tty = isatty(1);
 
-	printf("%s", text);
+	if (progress->on_tty)
+		printf("%s\r", text);
+	else
+		printf("%s", text);
 }
 
 void
@@ -60,12 +63,12 @@ progress_step(struct progress *progress)
 
 	progress->last_percent = cur_percent;
 
-	printf("\r%s%d%%", progress->text, cur_percent);
+	printf("%s%d%%\r", progress->text, cur_percent);
 }
 
 void
 progress_done(struct progress *progress)
 {
 	if (progress->on_tty)
-		printf("\r%s", progress->text);
+		printf("%s", progress->text);
 }

+ 0 - 1
src/filesdb.c

@@ -271,7 +271,6 @@ ensure_packagefiles_available(struct pkginfo *pkg)
               pkg_name(pkg, pnaw_nonambig));
     onerr_abort--;
     if (pkg->status != stat_configfiles) {
-      if (saidread == 1) putc('\n',stderr);
       warning(_("files list file for package `%.250s' missing, assuming "
                 "package has no files currently installed."),
               pkg_name(pkg, pnaw_nonambig));