diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-18 15:57:28 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-19 19:36:15 +0100 |
commit | 067e68de07f7d1cf1d406c4917e9cdd7b0b6f26a (patch) | |
tree | 31bd56c94a18744c4c4d2e3db9184e402b83ebaf /Debian | |
parent | 6b9192c43040de5e0c18d0cd4057dcfb7457d86a (diff) |
Do some quoting on debug output (needed if the server might not be trustworthy and might send us bad stuff).
Diffstat (limited to 'Debian')
-rw-r--r-- | Debian/Dgit.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 2938ae1..edb338c 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -173,8 +173,13 @@ sub cmdoutput_errok { die $! if P->error; if (!close P) { printdebug "=>!$?\n"; return undef; } chomp $d; - $d =~ m/^.*/; - printdebug "=> \`$&'",(length $' ? '...' : ''),"\n" if $debuglevel>0; #'; + if ($debuglevel > 0) { + $d =~ m/^.*/; + my $dd = $&; + my $more = (length $' ? '...' : ''); #'); + $dd =~ s{[^\n -~]|\\}{ sprintf "\\x%02x", ord $& }ge; + printdebug "=> \`$dd'",$more,"\n"; + } return $d; } |