Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl debugger outputs ctrl-\ wrongly #3824

Closed
p5pRT opened this issue Apr 6, 2001 · 5 comments
Closed

Perl debugger outputs ctrl-\ wrongly #3824

p5pRT opened this issue Apr 6, 2001 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 6, 2001

Migrated from rt.perl.org#6749 (status was 'resolved')

Searchable as RT6749$

@p5pRT
Copy link
Author

p5pRT commented Apr 6, 2001

From newton@ficus.frogspace.net

The Perl debugger outputs strings containing the character
ctrl-\ wrongly when using the "x" command. For example,
x chr(28) results in "\c\" and x "\c\\" results in "\c\\\".
The results, however, are not valid Perl and will result in
"string terminator not found before end of line".

(Pesky character, that.)

Perl Info


Site configuration information for perl 5.00503:

Configured by frogleg at Sun Aug  8 13:32:51 EDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=5.2, archname=i686-linux
    uname='linux ficus.frogspace.net 2.2.6-ac3 #2 thu aug 5 09:35:04 edt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O2', gccversion=2.7.2.3
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl 5.00503:
    /usr/local/lib/perl5/5.00503/i686-linux
    /usr/local/lib/perl5/5.00503
    /usr/local/lib/perl5/site_perl/5.005/i686-linux
    /usr/local/lib/perl5/site_perl/5.005
    .


Environment for perl 5.00503:
    HOME=/home/newton
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/sbin:/home/newton:.
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 12, 2005

From @schwern

[newton@​ficus.frogspace.net - Thu Apr 05 19​:58​:47 2001]​:
The Perl debugger outputs strings containing the character
ctrl-\ wrongly when using the "x" command. For example,
x chr(28) results in "\c\" and x "\c\\" results in "\c\\\".
The results, however, are not valid Perl and will result in
"string terminator not found before end of line".

The problem is in dumpvar.pl which x uses. The attached patch fixes this.

@p5pRT
Copy link
Author

p5pRT commented Jul 12, 2005

From @schwern

dv.patch
--- lib/dumpvar.pl	2005/07/12 22:27:33	1.1
+++ lib/dumpvar.pl	2005/07/12 22:34:03
@@ -80,13 +80,21 @@
 	} elsif ($unctrl eq 'quote') {
 	  s/([\"\\\$\@])/\\$1/g if $tick eq '"';
 	  s/\033/\\e/g;
-	  s/([\000-\037\177])/'\\c'.chr(ord($1)^64)/eg;
+	  s/([\000-\037\177])/'\\c'._escaped_ord($1)/eg;
 	}
 	$_ = uniescape($_);
 	s/([\200-\377])/'\\'.sprintf('%3o',ord($1))/eg if $quoteHighBit;
 	($noticks || /^\d+(\.\d*)?\Z/) 
 	  ? $_ 
 	  : $tick . $_ . $tick;
+}
+
+# Ensure a resulting \ is escaped to be \\
+sub _escaped_ord {
+    my $chr = shift;
+    $chr = chr(ord($chr)^64);
+    $chr =~ s{\\}{\\\\}g;
+    return $chr;
 }
 
 sub ShortArray {

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2005

From @Tux

On Tue, 12 Jul 2005 15​:36​:54 -0700, "Michael G Schwern via RT"
<perlbug-followup@​perl.org> wrote​:

[newton@​ficus.frogspace.net - Thu Apr 05 19​:58​:47 2001]​:
The Perl debugger outputs strings containing the character
ctrl-\ wrongly when using the "x" command. For example,
x chr(28) results in "\c\" and x "\c\\" results in "\c\\\".
The results, however, are not valid Perl and will result in
"string terminator not found before end of line".

The problem is in dumpvar.pl which x uses. The attached patch fixes this.

Thanks, applied as change #25130

--
H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2 on HP-UX 10.20, 11.00 & 11.11,
AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http​://www.cmve.net/~merijn
Smoking perl​: http​://www.test-smoke.org, perl QA​: http​://qa.perl.org
reports to​: smokers-reports@​perl.org, perl-qa@​perl.org

@p5pRT p5pRT closed this as completed Jul 15, 2005
@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2005

@schwern - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant