Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Dieter Bloms
Hi,

On Fri, Nov 30, Dr. Werner Fink wrote:

> Maybe some more checks are required as if n != 4 this could be that one of the
> variables are not used and therefore not initialized.
> 
> Before sscanf() this could be a `memset(language, 0, sizeof(language));' or 
> more
> simple a `*language = 0;' depending on the type of language.  Also the code
> 
>if (n != 4 || isempty(description)) {
>   free(description);
>   description = NULL;
>}
> 
> could become
> 
>if (n != 4 || isempty(description)) {
>   if (description)
>  free(description);
>   description = NULL;
>}
> 
> as well as the line
> 
>esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, language, 
> description);   
> 
> may look like
> 
>esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, language, 
> description ? description : "");

may code looks like:

--snip--
bool tComponent::FromString(const char *s)
{
  unsigned int Stream, Type;
  description = NULL;
  int n = sscanf(s, "%X %02X %7s %as[^\n]", &Stream, &Type, language, 
&description); // 7 = MAXLANGCODE2 - 1
  esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, language, 
description  ? description : "");

  if (n != 4 || isempty(description)) {
 if (description)
free(description);
 description = NULL;
 }
  stream = Stream;
  type = Type;
  return n >= 3;
}
--snip--

and I get a core dump like:

--snip--
vdrservernew:/usr/src/vdr-1.7.32# gdb --core /tmp/core /usr/local/bin/vdr
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /usr/local/bin/vdr...done.
[New LWP 2829]
[New LWP 2830]
[New LWP 2828]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Core was generated by `/usr/local/bin/vdr --config=/etc/vdr 
--epgfile=/tmp/epg.data --grab=/dev/shm --'.
Program terminated with signal 11, Segmentation fault.
#0  0x799a5fbbe3b3 in strnlen () from /lib/libc.so.0.9.32
(gdb) bt
#0  0x799a5fbbe3b3 in strnlen () from /lib/libc.so.0.9.32
#1  0x799a5fbb7f56 in ?? () from /lib/libc.so.0.9.32
#2  0x799a5fbb55dc in vsnprintf () from /lib/libc.so.0.9.32
#3  0x799a5fbacc29 in vsyslog () from /lib/libc.so.0.9.32
#4  0x0052e570 in syslog_with_tid (priority=3, format=0x551b18 "dbloms: 
\"%X\" \"%02X\" \"%7s\" \"%s\"") at tools.c:40
#5  0x004a1bbd in tComponent::FromString (this=0x22a24b0, s=) at epg.c:37
#6  0x004a4197 in SetComponent (s=, Index=0, 
this=0x22ad550) at epg.c:85
#7  cEvent::Parse (this=, s=) at epg.c:499
#8  0x004e9f76 in cRecordingInfo::Read (this=0x22a50e0, 
f=f@entry=0x22a1f00) at recording.c:468
#9  0x004eb5b3 in cRecording::cRecording (this=0x22a2210, 
FileName=0x22a0fdc "Sex_and_the_City_2/2012-11-19.20.10.27-0.rec") at 
recording.c:723
#10 0x004ecf81 in cRecordings::ScanVideoDir (this=0x7fe900 
, DirName=0x229aca0 "/remote/vdr/Sex_and_the_City_2", 
Foreground=false, LinkLevel=0) at recording.c:1165
#11 0x004ed3fc in cRecordings::ScanVideoDir (this=0x7fe900 
, DirName=0x2285390 "/remote/vdr", Foreground=false, LinkLevel=0) 
at recording.c:1180
#12 0x00526a1e in cThread::StartThread (Thread=0x7fe920 
) at thread.c:262
#13 0x799a614e2406 in start_thread () from /lib/libpthread.so.0.9.32
#14 0x799a614da885 in clone () from /lib/libpthread.so.0.9.32
#15 0x in ?? ()
(gdb) 
--snip--

-- 
Gruß

  Dieter

--
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
>From field.

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Dr. Werner Fink
On Fri, Nov 30, 2012 at 12:08:53PM +0100, Dieter Bloms wrote:
> Hi Werner,
> 
> --snip--
>   25 cString tComponent::ToString(void)
>   26 {
>   27   char buffer[256];
>   28   snprintf(buffer, sizeof(buffer), "%X %02X %s %s", stream, type, 
> language, description ? description : "");
>   29   return buffer;
>   30 }
>   31 
>   32 bool tComponent::FromString(const char *s)
>   33 {
>   34   unsigned int Stream, Type;
>   35   description = NULL;
>   36   int n = sscanf(s, "%X %02X %7s %as[^\n]", &Stream, &Type, language, 
> &description); // 7 = MAXLANGCODE2 - 1
>   37   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, 
> language, description);
>   38 
>   39   if (n != 4 || isempty(description)) {
>   40  free(description);
>   41  description = NULL;
>   42  }
>   43   stream = Stream;
>   44   type = Type;
>   45   return n >= 3;
>   46 }
> --snip--
> 
> 
> and get a core dump with this:
> 
> --snip--
> vdrservernew:/tmp# gdb --core /tmp/core /usr/local/bin/vdr
> GNU gdb (GDB) 7.5
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu".
> For bug reporting instructions, please see:
> ...
> Reading symbols from /usr/local/bin/vdr...done.
> [New LWP 8986]
> [New LWP 8985]
> [New LWP 8987]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/libthread_db.so.1".
> Core was generated by `/usr/local/bin/vdr --config=/etc/vdr 
> --epgfile=/tmp/epg.data --grab=/dev/shm --'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x6b2476b263b3 in strnlen () from /lib/libc.so.0.9.32
> (gdb) bt
> #0  0x6b2476b263b3 in strnlen () from /lib/libc.so.0.9.32
> #1  0x6b2476b1ff56 in ?? () from /lib/libc.so.0.9.32
> #2  0x6b2476b1d5dc in vsnprintf () from /lib/libc.so.0.9.32
> #3  0x6b2476b14c29 in vsyslog () from /lib/libc.so.0.9.32
> #4  0x0052e510 in syslog_with_tid (priority=3, format=0x551ab8 
> "dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"") at tools.c:40
> #5  0x004a1e4e in FromString (s=, this=0x3dabc20) at 
> epg.c:37
> #6  cComponents::SetComponent (this=, Index=, 
> s=s@entry=0x3d2 "1 01 deu 4:3") at epg.c:84
> #7  0x004a4163 in cEvent::Parse (this=0x3d9f4d0, s=) 
> at epg.c:498
> #8  0x004e9f16 in cRecordingInfo::Read (this=0x3da8640, 
> f=f@entry=0x3d9f840) at recording.c:468
> #9  0x004eb553 in cRecording::cRecording (this=0x3da05c0, 
> FileName=0x3d8aa7c "Sex_and_the_City_2/2012-11-19.20.10.27-0.rec") at 
> recording.c:723
> #10 0x004ecf21 in cRecordings::ScanVideoDir (this=0x7fe880 
> , DirName=0x3d9d4c0 "/remote/vdr/Sex_and_the_City_2", 
> Foreground=false, LinkLevel=0) at recording.c:1165
> #11 0x004ed39c in cRecordings::ScanVideoDir (this=0x7fe880 
> , DirName=0x3d83a20 "/remote/vdr", Foreground=false, LinkLevel=0) 
> at recording.c:1180
> #12 0x005269be in cThread::StartThread (Thread=0x7fe8a0 
> ) at thread.c:262
> #13 0x6b247844a406 in start_thread () from /lib/libpthread.so.0.9.32
> #14 0x6b2478442885 in clone () from /lib/libpthread.so.0.9.32
> #15 0x in ?? ()
> (gdb) 
> --snip--

Maybe some more checks are required as if n != 4 this could be that one of the
variables are not used and therefore not initialized.

Before sscanf() this could be a `memset(language, 0, sizeof(language));' or more
simple a `*language = 0;' depending on the type of language.  Also the code

   if (n != 4 || isempty(description)) {
  free(description);
  description = NULL;
   }

could become

   if (n != 4 || isempty(description)) {
  if (description)
 free(description);
  description = NULL;
   }

as well as the line

   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, language, 
description);   

may look like

   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, language, 
description ? description : "");


Werner

-- 
  "Having a smoking section in a restaurant is like having
  a peeing section in a swimming pool." -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Dieter Bloms
Hi Werner,

On Fri, Nov 30, Dr. Werner Fink wrote:

> On Fri, Nov 30, 2012 at 11:00:52AM +0100, Dieter Bloms wrote:
> > 
> > I changed it this way:
> > 
> > --snip--
> >   32 bool tComponent::FromString(const char *s)
> >   33 {
> >   34   unsigned int Stream, Type;
> >   35   description = NULL;
> >   36   int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, 
> > &description); // 7 = MAXLANGCODE2 - 1
> >   37   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%a\"", Stream, Type, 
> > language, description);
> >   38 
> >   39   if (n != 4 || isempty(description)) {
> >   40  free(description);
> >   41  description = NULL;
> >   42  }
> >   43   stream = Stream;
> >   44   type = Type;
> >   45   return n >= 3;
> >   46 }
> > --snip--
> 
> IMHO the %a should become %s in esyslog() whereas in sscanf() the %a should 
> become %as
> for the GNU extension of dynamically allocating string conversions.

Now I've the following code:

--snip--
  25 cString tComponent::ToString(void)
  26 {
  27   char buffer[256];
  28   snprintf(buffer, sizeof(buffer), "%X %02X %s %s", stream, type, 
language, description ? description : "");
  29   return buffer;
  30 }
  31 
  32 bool tComponent::FromString(const char *s)
  33 {
  34   unsigned int Stream, Type;
  35   description = NULL;
  36   int n = sscanf(s, "%X %02X %7s %as[^\n]", &Stream, &Type, language, 
&description); // 7 = MAXLANGCODE2 - 1
  37   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%s\"", Stream, Type, 
language, description);
  38 
  39   if (n != 4 || isempty(description)) {
  40  free(description);
  41  description = NULL;
  42  }
  43   stream = Stream;
  44   type = Type;
  45   return n >= 3;
  46 }
--snip--


and get a core dump with this:

--snip--
vdrservernew:/tmp# gdb --core /tmp/core /usr/local/bin/vdr
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /usr/local/bin/vdr...done.
[New LWP 8986]
[New LWP 8985]
[New LWP 8987]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Core was generated by `/usr/local/bin/vdr --config=/etc/vdr 
--epgfile=/tmp/epg.data --grab=/dev/shm --'.
Program terminated with signal 11, Segmentation fault.
#0  0x6b2476b263b3 in strnlen () from /lib/libc.so.0.9.32
(gdb) bt
#0  0x6b2476b263b3 in strnlen () from /lib/libc.so.0.9.32
#1  0x6b2476b1ff56 in ?? () from /lib/libc.so.0.9.32
#2  0x6b2476b1d5dc in vsnprintf () from /lib/libc.so.0.9.32
#3  0x6b2476b14c29 in vsyslog () from /lib/libc.so.0.9.32
#4  0x0052e510 in syslog_with_tid (priority=3, format=0x551ab8 "dbloms: 
\"%X\" \"%02X\" \"%7s\" \"%s\"") at tools.c:40
#5  0x004a1e4e in FromString (s=, this=0x3dabc20) at 
epg.c:37
#6  cComponents::SetComponent (this=, Index=, 
s=s@entry=0x3d2 "1 01 deu 4:3") at epg.c:84
#7  0x004a4163 in cEvent::Parse (this=0x3d9f4d0, s=) at 
epg.c:498
#8  0x004e9f16 in cRecordingInfo::Read (this=0x3da8640, 
f=f@entry=0x3d9f840) at recording.c:468
#9  0x004eb553 in cRecording::cRecording (this=0x3da05c0, 
FileName=0x3d8aa7c "Sex_and_the_City_2/2012-11-19.20.10.27-0.rec") at 
recording.c:723
#10 0x004ecf21 in cRecordings::ScanVideoDir (this=0x7fe880 
, DirName=0x3d9d4c0 "/remote/vdr/Sex_and_the_City_2", 
Foreground=false, LinkLevel=0) at recording.c:1165
#11 0x004ed39c in cRecordings::ScanVideoDir (this=0x7fe880 
, DirName=0x3d83a20 "/remote/vdr", Foreground=false, LinkLevel=0) 
at recording.c:1180
#12 0x005269be in cThread::StartThread (Thread=0x7fe8a0 
) at thread.c:262
#13 0x6b247844a406 in start_thread () from /lib/libpthread.so.0.9.32
#14 0x6b2478442885 in clone () from /lib/libpthread.so.0.9.32
#15 0x in ?? ()
(gdb) 
--snip--


-- 
Gruß

  Dieter

--
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
>From field.

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] Skystar USB HD + VDR + Astra 23.5E 11817 V / 8psk, fec=5/6

2012-11-30 Thread N. D.









 > Оригинално писмо 

 >От: Newsy Paper newspaperman_germ...@yahoo.com

 >Относно: Re: [vdr] Skystar USB HD + VDR + Astra 23.5E 11817 V / 8psk, fec=5/6

 >До: VDR Mailing List 

 >Изпратено на: Вторник, 2012, Ноември 27 22:38:10 EET

> --- N. D.  schrieb am Do, 22.11.2012:
 
> 
 
> > Von: N. D. 
 
> > Betreff: Re: [vdr] Skystar USB HD + VDR + Astra 23.5E 11817 V / 8psk, 
> > fec=5/6
 
> > An: "Ales Jurik" 
 
> > CC: "VDR Mailing List" 
 
> > Datum: Donnerstag, 22. November, 2012 14:31 Uhr
 
> > 
 
> > 
 
> >  > Оригинално писмо 
 
> > 
 
> >  >От: Ales Jurik aju...@quick.cz
 
> > 
 
> >  >Относно: Re: [vdr] Skystar USB HD + VDR + Astra
 
> > 23.5E 11817 V / 8psk,fec=5/6
 
> > 
 
> >  >До: VDR Mailing List 
 
> > 
 
> >  >Изпратено на: Сряда, 2012, Юни 13
 
> > 18:34:55 EEST
 
> > 
 
> > 
 
> > 
 
> >  
 
> > > On 06/13/12 10:45, N. D. wrote:
 
> >  
 
> > > > 
 
> >  
 
> > > >        
 
> >            
 
> >            
 
> >     Hi,
 
> >  
 
> > > > Since recently I have been using Skystar USB HD
 
> > with my vdr 
 
> >  
 
> > > > box. However I have some strange issues with
 
> > 11817V on Astra 23.5E. 
 
> >  
 
> > > > Femon reports that there is a lock and sound comes
 
> > but the image is 
 
> >  
 
> > > > completely garbled. I am starting to suspect that
 
> > there might be 
 
> >  
 
> > > > something wrong with the driver, because I have no
 
> > trouble with the 
 
> >  
 
> > > > other transpoders. Maybe it is the combination of
 
> > fec=5/6 and 8psk on 
 
> >  
 
> > > > the said transponder that is the reason for this.
 
> > Other transponders 
 
> >  
 
> > > > with fec=3/4 and 8psk are OK. The same setup with
 
> > an HVR-4000 works 
 
> >  
 
> > > > fine.
 
> >  
 
> > > > 
 
> >  
 
> > > > Kernel: 3.3.4
 
> >  
 
> > > > 
 
> >  
 
> > > > VDR: 1.7.27
 
> >  
 
> > > > 
 
> >  
 
> > > > Could someone who owns a Skystar USB HD and has
 
> > access to Astra 23.5E 
 
> >  
 
> > > > share his experience? Is this a driver issue a
 
> > problem with vdr or is my card faulty?
 
> >  
 
> > > > 
 
> >  
 
> > > > If someone would be kind enough to test this with
 
> > his/hers hardware, there is a FTA channel on the problematic
 
> > transponder:
 
> >  
 
> > > > 
 
> >  
 
> > > > 
 
> >  
 
> > > > 
 
> >  
 
> > > > Planeta
 
> > HD;SatelliteBG:11817:VC56M5O35S1:S23.5E:27500:1001=27:1002=@3:0:0:5410:3:3206:0
 
> >  
 
> > > > 
 
> >  
 
> > > > 
 
> >  
 
> > > > 
 
> >  
 
> > > > Any help would be greatly
 
> > appreciated.       
 
> >            
 
> >             
 
> >  
 
> > > > 
 
> >  
 
> > > 
 
> >  
 
> > > Hi,
 
> >  
 
> > > 
 
> >  
 
> > > few months ago on this transponder was nearly 30% of
 
> > null PID packets
 
> >  
 
> > > broadcasted, but now it seems to be much better (less
 
> > than 1Mbps). Also
 
> >  
 
> > > multiplexing of this transponder was not equal within
 
> > time - there was
 
> >  
 
> > > chunks of packets of PlanetHD multiplexed with chunks
 
> > of other SD
 
> >  
 
> > > channels mixed packets. Maybe the buffers for USB are
 
> > not big enough to
 
> >  
 
> > > memorize such chunks? But I didn't done measuring for
 
> > some months, so
 
> >  
 
> > > the situation may be different now.
 
> >  
 
> > > 
 
> >  
 
> > > You can see bitrates of this transponder at
 
> >  
 
> > > http://www.digitalbitrate.com/dtv.php?mux=11817&pid=5410&live=70&lang=en
 
> > .
 
> >  
 
> > > 
 
> >  
 
> > > The bitrate of this channel is nothing special, with
 
> > maximum about 11
 
> >  
 
> > > Mbps, the peak of 20.2Mbps at 22.5. was maybe a joke.
 
> >  
 
> > > 
 
> >  
 
> > > Regards,
 
> >  
 
> > > 
 
> >  
 
> > > Ales
 
> > 
 
> > Hi,
 
> > 
 
> > Since 20 Nov transponders 12051V and 12207V on the same
 
> > satellite Astra 3B were switched to fec=5/6 and they also
 
> > became unwatchable. Before the change they were 8psk,
 
> > fec=3/4. Now they are 8psk, fec=5/6. 
 
> > 
 
> > ___
 
> have you tried this patch written by Old_Man?
 
> 
 
> http://www.vdr-portal.de/board16-video-disk-recorder/board85-hdtv-dvb-s2/p977938-stb0899-fec-3-4-tester-gesucht/#post977938
 
> 
 
> kind regards
 
> 
 
> Newsy
 
> 
 
 > ___
 
I am running kernel 3.6.2 on that particular machine and as far as I can tell 
that patch is already included. I also tried reverting it but it didn't help. 
For me the telling difference can be seen here:
http://www.digitalbitrate.com/dtv.php?liste=1&live=70&lang=en&mux=12207
Before the change to fec=5/6 the total bitrate of 12207V and 12051V was below 
60Mbps. Now it is over 65Mbps. According to the spec for Technotrend S2-3200 
(http://www.tt-downloads.de/update/engl/techspec_tt-budget_s2-3200_en.pdf) 
60Mbps is the limit for DVB-S. For DVB-S2 it is stated that the card supports 
bitrates of up to 90Mbps. So my next guess is that the linux driver 
implementation somehow precludes the support of bitrat

Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread sundararaj reel
On Fri, Nov 30, 2012 at 11:31 AM, Dieter Bloms  wrote:

> Hi,
>
> On Fri, Nov 30, sundararaj reel wrote:
>
> > %a to print a char* is not right. char* is interpreted as double (see the
> > compiler warning) . If you want to print the pointer 'description', then
> > use %p.
>
> with "esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%p\"", Stream, Type,
> language, description);"
> I get the following log entry:
>
> --snip--
> Nov 30 10:27:24 vdrservernew local1.err vdr: [7118] dbloms: "1" "01" "
>  deu" "0x4080"
> --snip--
>
> > The following code crashes on my box too. I dont know why.
>
> did you do it on uClibc system or a glibc one ?
>
>
>
Ran that code on ubuntu 10.04.

$ /lib/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7) stable release version
2.11.1, by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.3.
Compiled on a Linux >>2.6.24-27-server<< system on 2010-04-22.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
For bug reporting instructions, please see:
.
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Dr. Werner Fink
On Fri, Nov 30, 2012 at 11:00:52AM +0100, Dieter Bloms wrote:
> 
> I changed it this way:
> 
> --snip--
>   32 bool tComponent::FromString(const char *s)
>   33 {
>   34   unsigned int Stream, Type;
>   35   description = NULL;
>   36   int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, 
> &description); // 7 = MAXLANGCODE2 - 1
>   37   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%a\"", Stream, Type, 
> language, description);
>   38 
>   39   if (n != 4 || isempty(description)) {
>   40  free(description);
>   41  description = NULL;
>   42  }
>   43   stream = Stream;
>   44   type = Type;
>   45   return n >= 3;
>   46 }
> --snip--

IMHO the %a should become %s in esyslog() whereas in sscanf() the %a should 
become %as
for the GNU extension of dynamically allocating string conversions.

 Werner

-- 
  "Having a smoking section in a restaurant is like having
  a peeing section in a swimming pool." -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Gerald Dachs

Am 2012-11-30 10:17, schrieb Lars Hanisch:

 Looks like the pointer returned by sscanf is not valid:

32: bool tComponent::FromString(const char *s)
33: {
34:   unsigned int Stream, Type;
35:   int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type,
language, &description); // 7 = MAXLANGCODE2 - 1
36:   if (n != 4 || isempty(description)) {
37:  free(description);
38:  description = NULL;
39:  }
40:   stream = Stream;
41:   type = Type;
42:   return n >= 3;
43: }


From man sscanf:

   The GNU C library supports a nonstandard extension that causes 
the library to
   dynamically allocate a string of sufficient size for input 
strings for the %s

   and %a[range] conversion specifiers.

This is the reason why it doesn't work with ulibc.

Gerald


___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Dieter Bloms
Hi,

On Fri, Nov 30, sundararaj reel wrote:

> %a to print a char* is not right. char* is interpreted as double (see the
> compiler warning) . If you want to print the pointer 'description', then
> use %p.

with "esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%p\"", Stream, Type, language, 
description);"
I get the following log entry:

--snip--
Nov 30 10:27:24 vdrservernew local1.err vdr: [7118] dbloms: "1" "01" "deu" 
"0x4080"
--snip--

> The following code crashes on my box too. I dont know why.

did you do it on uClibc system or a glibc one ?


-- 
Regards

  Dieter

--
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
>From field.

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread sundararaj reel
On Fri, Nov 30, 2012 at 11:00 AM, Dieter Bloms  wrote:

>
> --snip--
> g++ -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -c
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -DVDR_USER=\"root\" -DLIRC_DEVICE=\"/var/run/lirc/lircd\" -D_GNU_SOURCE
> -DVIDEODIR=\"/remote/vdr/video\" -DCONFDIR=\"/etc/vdr/config\"
> -DCACHEDIR=\"\" -DRESDIR=\"\"
> -DPLUGINDIR=\"/usr/src/vdr-1.7.32/PLUGINS/lib\"
> -DLOCDIR=\"/usr/share/vdr/locale\" -I/usr/include/freetype2
> -I/usr/src/v4l-dvb/linux/include epg.c
> epg.c: In member function 'bool tComponent::FromString(const char*)':
> epg.c:37:3: warning: format '%a' expects argument of type 'double', but
> argument 6 has type 'char*' [-Wformat]
> --snip--
>
> And after start in the logfile
>
> --snip--
> Nov 30 09:48:05 vdrservernew local1.err vdr: [4094] dbloms: "1" "01" "
>  deu" "0x8.799b08p-1052"
> --snip--
>
> I think %a in my esyslog call isn't correct, but it is used this way
> with the sscanf call and when I changed it with %s I don't see any log
> entry.
>
> So how should the esyslog call look like ?
>
>
%a to print a char* is not right. char* is interpreted as double (see the
compiler warning) . If you want to print the pointer 'description', then
use %p.


The following code crashes on my box too. I dont know why.

 $ ./a.out
errno: 0
n=4
Stream:1 Type:1 lang:'deu'
desc addr:'0x4080'
Segmentation fault
$

In gdb:
Program received signal SIGSEGV, Segmentation fault.
0x0016e50b in _IO_vfprintf_internal (s=0x2844e0, format=0x8048711
"desc:'%s'\n", ap=0xb3f4 "") at vfprintf.c:1614
1614vfprintf.c: No such file or directory.
in vfprintf.c
(gdb) bt
#0  0x0016e50b in _IO_vfprintf_internal (s=0x2844e0, format=0x8048711
"desc:'%s'\n", ap=0xb3f4 "") at vfprintf.c:1614
#1  0x00175160 in __printf (format=0x8048711 "desc:'%s'\n") at printf.c:35
#2  0x080485aa in FromString (s=0x804871c "1 01 deu 4:3") at fromstring.c:14
#3  0x080485ee in main (argc=1, argv=0xb514) at fromstring.c:22


--- snip ---

#include 
#include 

void FromString(const char *s)
{
  unsigned int Stream, Type;
  char language[8] = {0};
  char* description=NULL;
  int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language,
&description); // 7 = MAXLANGCODE2 - 1
  printf("errno: %d\n", errno);
  printf("n=%d\n", n);
  printf("Stream:%u Type:%u lang:'%s'\n", Stream, Type, language);
  printf("desc addr:'%p'\n", description);
  printf("desc:'%s'\n", description); // XXX crashes here
}

int main(int argc, char* argv[])
{
  if (argc == 2)
FromString((const char*)argv[1]);
  else
FromString("1 01 deu 4:3");

  return 0;
}

- snip -
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Dieter Bloms
Hi Lars,

thank you for the help!

On Fri, Nov 30, Lars Hanisch wrote:

> 32: bool tComponent::FromString(const char *s)
> 33: {
> 34:   unsigned int Stream, Type;
> 35:   int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, 
> &description); // 7 = MAXLANGCODE2 - 1
> 36:   if (n != 4 || isempty(description)) {
> 37:  free(description);
> 38:  description = NULL;
> 39:  }
> 40:   stream = Stream;
> 41:   type = Type;
> 42:   return n >= 3;
> 43: }
> 
>  What I would do:
> - set description to NULL before the sscanf
> - log all values returned by sscanf and compare it with the given string

I changed it this way:

--snip--
  32 bool tComponent::FromString(const char *s)
  33 {
  34   unsigned int Stream, Type;
  35   description = NULL;
  36   int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, 
&description); // 7 = MAXLANGCODE2 - 1
  37   esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%a\"", Stream, Type, 
language, description);
  38 
  39   if (n != 4 || isempty(description)) {
  40  free(description);
  41  description = NULL;
  42  }
  43   stream = Stream;
  44   type = Type;
  45   return n >= 3;
  46 }
--snip--

but during compile I saw this message:

--snip--
g++ -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -c 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-DVDR_USER=\"root\" -DLIRC_DEVICE=\"/var/run/lirc/lircd\" -D_GNU_SOURCE 
-DVIDEODIR=\"/remote/vdr/video\" -DCONFDIR=\"/etc/vdr/config\" -DCACHEDIR=\"\" 
-DRESDIR=\"\" -DPLUGINDIR=\"/usr/src/vdr-1.7.32/PLUGINS/lib\" 
-DLOCDIR=\"/usr/share/vdr/locale\" -I/usr/include/freetype2   
-I/usr/src/v4l-dvb/linux/include epg.c
epg.c: In member function 'bool tComponent::FromString(const char*)':
epg.c:37:3: warning: format '%a' expects argument of type 'double', but 
argument 6 has type 'char*' [-Wformat]
--snip--

And after start in the logfile

--snip--
Nov 30 09:48:05 vdrservernew local1.err vdr: [4094] dbloms: "1" "01" "deu" 
"0x8.799b08p-1052"
--snip--

I think %a in my esyslog call isn't correct, but it is used this way
with the sscanf call and when I changed it with %s I don't see any log
entry.

So how should the esyslog call look like ?


-- 
Regards

  Dieter

--
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
>From field.

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] get a segmentation fault when starting vdr (backtrace included)

2012-11-30 Thread Lars Hanisch
Hi,

Am 29.11.2012 16:17, schrieb Dieter Bloms:
> Hello,
> 
> I've compiled vdr on alpinelinux 2.5.0 and get a segfault during
> start of vdr.
> Even without plugins I get this segfault (I didn't apply any patch to
> vdr sources).
> Vdr was started with the command:
> 
> /usr/local/bin/vdr --config=/etc/vdr --epgfile=/tmp/epg.data --grab=/dev/shm 
> --log=3.1 --mute --no-kbd --user=root --video=/remote/vdr/
> 
> I've made a backtrace with gdb:
> 
> --snip--
> vdrservernew:/tmp# gdb --core core /usr/local/bin/vdr
> GNU gdb (GDB) 7.5
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu".
> For bug reporting instructions, please see:
> ...
> Reading symbols from /usr/local/bin/vdr...done.
> [New LWP 26493]
> [New LWP 26492]
> [New LWP 26494]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/libthread_db.so.1".
> Core was generated by `/usr/local/bin/vdr --config=/etc/vdr 
> --epgfile=/tmp/epg.data --grab=/dev/shm --'.
> Program terminated with signal 11, Segmentation fault.
> #0  skipspace (s=0x4080 ) at tools.h:196
> 196   if ((uchar)*s > ' ') // most strings don't have any leading space, 
> so handle this case as fast as possible
> (gdb) bt
> #0  skipspace (s=0x4080 ) at tools.h:196
> #1  isempty (s=0x4080 ) at tools.c:249
> #2  0x004a1eb9 in FromString (s=0x2e531d2 "1 01 deu 4:3", 
> this=0x2e4aba0) at epg.c:36

 Looks like the pointer returned by sscanf is not valid:

32: bool tComponent::FromString(const char *s)
33: {
34:   unsigned int Stream, Type;
35:   int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, 
&description); // 7 = MAXLANGCODE2 - 1
36:   if (n != 4 || isempty(description)) {
37:  free(description);
38:  description = NULL;
39:  }
40:   stream = Stream;
41:   type = Type;
42:   return n >= 3;
43: }

 What I would do:
- set description to NULL before the sscanf
- log all values returned by sscanf and compare it with the given string

 Maybe a problem/different behaviour in the uClibc?

Lars.

> #3  cComponents::SetComponent (this=, Index=0, 
> s=s@entry=0x2e531d2 "1 01 deu 4:3") at epg.c:81
> #4  0x004a40f3 in cEvent::Parse (this=0x2e43360, s=) 
> at epg.c:495
> #5  0x004e9ea6 in cRecordingInfo::Read (this=0x2e2d110, 
> f=f@entry=0x2e2c330) at recording.c:468
> #6  0x004eb4e3 in cRecording::cRecording (this=0x2e2c650, 
> FileName=0x2e4c15c "Sex_and_the_City_2/2012-11-19.20.10.27-0.rec") at 
> recording.c:723
> #7  0x004eceb1 in cRecordings::ScanVideoDir (this=0x7fe7c0 
> , DirName=0x2e412b0 "/remote/vdr/Sex_and_the_City_2", 
> Foreground=false, LinkLevel=0) at recording.c:1165
> #8  0x004ed32c in cRecordings::ScanVideoDir (this=0x7fe7c0 
> , DirName=0x2e25ff0 "/remote/vdr", Foreground=false, LinkLevel=0) 
> at recording.c:1180
> #9  0x0052694e in cThread::StartThread (Thread=0x7fe7e0 
> ) at thread.c:262
> #10 0x6e6b7ce69406 in start_thread () from /lib/libpthread.so.0.9.32
> #11 0x6e6b7ce61885 in clone () from /lib/libpthread.so.0.9.32
> #12 0x in ?? ()
> --snip--
> 
> does anybody see what is wrong here ?
> 
>

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr