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

why it segfaults? #162

Closed
p5pRT opened this issue Jul 6, 1999 · 1 comment
Closed

why it segfaults? #162

p5pRT opened this issue Jul 6, 1999 · 1 comment

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Jul 6, 1999

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

Searchable as RT967$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jul 6, 1999

From frank@orion.ideare.com

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=linux, osvers=2.2.1-ac1, archname=i386-linux
  uname='linux porky.devel.redhat.com 2.2.1-ac1 #1 smp mon feb 1
17​:44​:44 est 1999 i686 unknown '
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)
  cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
  ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
  stdchar='char', d_stdstdio=undef, 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='cc', 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'

Characteristics of this binary (from libperl)​:
  Built under linux
  Compiled at Apr 6 1999 23​:34​:07
  @​INC​:
  /usr/lib/perl5/5.00503/i386-linux
  /usr/lib/perl5/5.00503
  /usr/lib/perl5/site_perl/5.005/i386-linux
  /usr/lib/perl5/site_perl/5.005

I'm using DBI and DBD​::mysql, and, while I try to insert duplicate record
which contains the % char (which is a thing allowed in mysql and I can
do it from the mysql client command line), the perl program fails to
print the mysqld error code and often segaults​:

inserting record​: www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html

error​:
DBD​::mysql​::db do failed​: Duplicate entry 'www.acenet.it/database/Azioni
135674528nnovative 135674528n%20ambito 1003074360caleel
ampo -1073743128ell%27INFORMATION%20SOCIETY.html'

it does not segfault here, but perl prints this "strange form" of the
error.

but if we add one more %something​:

inserting record​: www.acenet.it/database/Azion%20i%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html

Segmentation fault (core dumped)

then I built a debug version of perl and started gdb (sorry, I can't go
further), here are the results​:

(gdb) r -I./lib ~frank/prova.pl
Starting program​: /home2/frank/perldebug/perl5.005_03/./perl -I./lib
~frank/prova.pl
www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html

Program received signal SIGSEGV, Segmentation fault.
0x80b0352 in Perl_sv_vcatpvfn (sv=0x810fa38,
  pat=0x81bc600 "DBD​::mysql​::db do failed​: Duplicate entry
'www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html'
for key 1", patlen=169, args=0xbffff998, svargs=0x0,
  svmax=0, used_locale=0x0) at sv.c​:4826
4826 default​: *(va_arg(*args, int*)) = i; break;

(gdb) backtrace
#0 0x80b0352 in Perl_sv_vcatpvfn (sv=0x810fa38,
  pat=0x81bc600 "DBD​::mysql​::db do failed​: Duplicate entry
'www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html'
for key 1", patlen=169, args=0xbffff998, svargs=0x0,
  svmax=0, used_locale=0x0) at sv.c​:4826
#1 0x80ae27b in Perl_sv_vsetpvfn (sv=0x810fa38,
  pat=0x81bc600 "DBD​::mysql​::db do failed​: Duplicate entry
'www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html'
for key 1", patlen=169, args=0xbffff998, svargs=0x0,
  svmax=0, used_locale=0x0) at sv.c​:4402
#2 0x808e601 in Perl_mess (
  pat=0x81bc600 "DBD​::mysql​::db do failed​: Duplicate entry
'www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html'
for key 1", args=0xbffff998) at util.c​:1222
#3 0x808f0a6 in Perl_warn (
  pat=0x81bc600 "DBD​::mysql​::db do failed​: Duplicate entry
'www.acenet.it/database/Azioni%20innovative%20in%20ambito%20locale%20nel%20campo%20dell%27INFORMATION%20SOCIETY.html'
for key 1") at util.c​:1367
#4 0x401af43e in XS_DBI_dispatch ()
#5 0x80a2897 in Perl_pp_entersub () at pp_hot.c​:2255
#6 0x809b5a4 in Perl_runops_debug () at run.c​:66
#7 0x805a77e in perl_run (sv_interp=0x810aef8) at perl.c​:1100
#8 0x8057f53 in main (argc=3, argv=0xbffffd14, env=0xbffffd24) at
perlmain.c​:51
#9 0x400a5cb3 in __libc_start_main (main=0x8057ed0 <main>, argc=3,
argv=0xbffffd14, init=0x80570a8 <_init>,
  fini=0x80f10dc <_fini>, rtld_fini=0x4000a350 <_dl_fini>,
stack_end=0xbffffd0c)
  at ../sysdeps/generic/libc-start.c​:78

I really hope that someone can point me out the right solution, other than
not using % chars in mysql records...

Regards.

Francesco Messineo

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

Successfully merging a pull request may close this issue.

None yet
1 participant