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

guillem pushed a commit to branch master
in repository dpkg.

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

commit fd4d0448474d7d7dbea664660a24964db2ffadba
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Aug 15 15:49:50 2020 +0200

    dpkg-realpath: Add new -z, --zero option
    
    This makes it possible to process files with newlines within, even though
    not all of the dpkg suite is prepared to cope with those.
    
    Requested-by: Johannes Schauer <[email protected]>
---
 man/dpkg-realpath.pod    | 5 +++++
 scripts/dpkg-realpath.sh | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/man/dpkg-realpath.pod b/man/dpkg-realpath.pod
index f48ce1279..192ed0745 100644
--- a/man/dpkg-realpath.pod
+++ b/man/dpkg-realpath.pod
@@ -33,6 +33,11 @@ B<dpkg-realpath> is a tool to resolve a pathname.
 
 =over
 
+=item B<-z>, B<--zero>
+
+Use a NUL byte to end output lines instead of a new line character
+(since dpkg 1.20.6).
+
 =item B<--instdir> I<directory>
 
 Set the installation directory, which refers to the directory where
diff --git a/scripts/dpkg-realpath.sh b/scripts/dpkg-realpath.sh
index 75b451ad8..2f4396f00 100755
--- a/scripts/dpkg-realpath.sh
+++ b/scripts/dpkg-realpath.sh
@@ -20,6 +20,7 @@ set -e
 
 PROGNAME=$(basename "$0")
 version="unknown"
+EOL="\n"
 
 PKGDATADIR="${DPKG_DATADIR:-scripts}"
 
@@ -41,6 +42,7 @@ show_usage()
 Usage: $PROGNAME [<option>...] <pathname>
 
 Options:
+  -z,  --zero                   end output line with NUL, not newline.
        --instdir <directory>    set the root directory.
        --root <directory>       set the root directory.
        --version                show the version.
@@ -113,7 +115,7 @@ canonicalize() {
   done
   # We are done, print the resolved pathname, w/o $root.
   result="${result#"$root"}"
-  echo "${result:-/}"
+  printf "%s$EOL" "${result:-/}"
 }
 
 setup_colors
@@ -123,6 +125,9 @@ export DPKG_ROOT
 
 while [ $# -ne 0 ]; do
   case "$1" in
+  -z|--zero)
+    EOL="\0"
+    ;;
   --instdir|--root)
     shift
     DPKG_ROOT=$1

-- 
Dpkg.Org's dpkg

Reply via email to