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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b4a1e235ebcadf31cc7653bf3de67b6a742fe62b

commit b4a1e235ebcadf31cc7653bf3de67b6a742fe62b
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Jan 13 22:38:39 2023 +0100

    dpkg-deb: Do not print trailing spaces in --info output
    
    This avoids printing unnecessary trailing spaces on output, which make
    testing that more annoying.
---
 src/at/deb-format.at | 26 ++++++++++----------------
 src/deb/info.c       | 11 +++++++----
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/src/at/deb-format.at b/src/at/deb-format.at
index c3b412f7c..5e4ab86c8 100644
--- a/src/at/deb-format.at
+++ b/src/at/deb-format.at
@@ -72,7 +72,7 @@ cat fsys.tar.gz >>pkg-old-0933.deb
 
 AT_CHECK([
 # Check old package metadata
-dpkg-deb -I pkg-old.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-old.deb
 ], [], [ old Debian package, version 0.939000.
  size 174621 bytes: control archive=274, main archive=174334.
      201 bytes,     7 lines      control
@@ -87,7 +87,7 @@ dpkg-deb -I pkg-old.deb | $SED -e 's/ *$//'
 
 AT_CHECK([
 # Check old package metadata
-dpkg-deb -I pkg-old-0931.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-old-0931.deb
 ], [], [ old Debian package, version 0.931000.
  size 175522 bytes: control archive=291, main archive=175218.
      201 bytes,     7 lines      control
@@ -102,7 +102,7 @@ dpkg-deb -I pkg-old-0931.deb | $SED -e 's/ *$//'
 
 AT_CHECK([
 # Check old package metadata
-dpkg-deb -I pkg-old-0932.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-old-0932.deb
 ], [], [ old Debian package, version 0.932000.
  size 175522 bytes: control archive=291, main archive=175218.
      201 bytes,     7 lines      control
@@ -117,7 +117,7 @@ dpkg-deb -I pkg-old-0932.deb | $SED -e 's/ *$//'
 
 AT_CHECK([
 # Check old package metadata
-dpkg-deb -I pkg-old-0933.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-old-0933.deb
 ], [], [ old Debian package, version 0.933000.
  size 175522 bytes: control archive=291, main archive=175218.
      201 bytes,     7 lines      control
@@ -216,8 +216,7 @@ echo 2.999 >debian-binary
 ar rc pkg-version-2x.deb debian-binary
 ar t pkg-version-2x.deb
 ar x pkg-templ.deb debian-binary
-# XXX: Ideally we would have no need to strip trailing spaces.
-dpkg-deb -I pkg-version-2x.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-version-2x.deb
 ], [], [debian-binary
 control.tar
 data.tar
@@ -240,8 +239,7 @@ echo "extra line" >>debian-binary
 ar rc pkg-magic-extra.deb debian-binary
 ar t pkg-magic-extra.deb
 ar x pkg-templ.deb debian-binary
-# XXX: Ideally we would have no need to strip trailing spaces.
-dpkg-deb -I pkg-magic-extra.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-magic-extra.deb
 ], [], [debian-binary
 control.tar
 data.tar
@@ -359,8 +357,7 @@ AT_CHECK([
 cp pkg-templ.deb pkg-extra-member.deb
 ar q pkg-extra-member.deb unknown
 ar t pkg-extra-member.deb
-# XXX: Ideally we would have no need to strip trailing spaces.
-dpkg-deb -I pkg-extra-member.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-extra-member.deb
 ], [], [debian-binary
 control.tar
 data.tar
@@ -382,8 +379,7 @@ AT_CHECK([
 cp pkg-templ.deb pkg-under-member.deb
 ar ra debian-binary pkg-under-member.deb _ignore
 ar t pkg-under-member.deb
-# XXX: Ideally we would have no need to strip trailing spaces.
-dpkg-deb -I pkg-under-member.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-under-member.deb
 ], [], [debian-binary
 _ignore
 control.tar
@@ -416,8 +412,7 @@ AT_CHECK([
 # Test control.tar member
 ar rc pkg-control-none.deb debian-binary control.tar data.tar
 ar t pkg-control-none.deb
-# XXX: Ideally we would have no need to strip trailing spaces.
-dpkg-deb -I pkg-control-none.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-control-none.deb
 ], [], [debian-binary
 control.tar
 data.tar
@@ -541,8 +536,7 @@ AT_CHECK([
 # Test non-uniform data.tar/control.tar member compression
 ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz
 ar t pkg-mixed-comp.deb
-# XXX: Ideally we would have no need to strip trailing spaces.
-dpkg-deb -I pkg-mixed-comp.deb | $SED -e 's/ *$//'
+dpkg-deb -I pkg-mixed-comp.deb
 dpkg-deb -c pkg-mixed-comp.deb
 ], [], [debian-binary
 control.tar.xz
diff --git a/src/deb/info.c b/src/deb/info.c
index 7881df6f7..366dbe07c 100644
--- a/src/deb/info.c
+++ b/src/deb/info.c
@@ -166,10 +166,13 @@ info_list(const char *debar, const char *dir)
       if (ferror(cc))
         ohshite(_("failed to read '%.255s' (in '%.255s')"), cdep->d_name, dir);
       fclose(cc);
-      printf(_(" %7jd bytes, %5d lines   %c  %-20.127s %.127s\n"),
-             (intmax_t)stab.st_size, lines,
-             exec_mark,
-             cdep->d_name, interpreter);
+      if (str_is_set(interpreter))
+        printf(_(" %7jd bytes, %5d lines   %c  %-20.127s %.127s\n"),
+               (intmax_t)stab.st_size, lines, exec_mark, cdep->d_name,
+               interpreter);
+      else
+        printf(_(" %7jd bytes, %5d lines   %c  %.127s\n"),
+               (intmax_t)stab.st_size, lines, exec_mark, cdep->d_name);
     } else {
       printf(_("     not a plain file          %.255s\n"), cdep->d_name);
     }

-- 
Dpkg.Org's dpkg

Reply via email to