From: Ian Jackson Date: Sat, 18 Jul 2015 14:57:28 +0000 (+0100) Subject: Do some quoting on debug output (needed if the server might not be trustworthy and... X-Git-Tag: debian/1.0~18 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=067e68de07f7d1cf1d406c4917e9cdd7b0b6f26a Do some quoting on debug output (needed if the server might not be trustworthy and might send us bad stuff). --- diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 2938ae11..edb338ca 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; } diff --git a/debian/changelog b/debian/changelog index fd664d3e..c6b28b57 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ dgit (0.31~~) unstable; urgency=low Access machinery: * Provide for different access mechanisms when pushing. * Provide for configurable git url suffix. + * Do some quoting on debug output (needed if the server might not + be trustworthy and might send us bad stuff). Infrastructure: * Provide for mirroring git updates to a different server.