Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

Hi Lars, I quote here myself

 please answer privatelly. I am on the list, but not under this address.
 Therefore I see the answers only in the mail-archive some hours later.

 My xforms-version is
   xforms-0.89-369

I upgraded now from
forms-0.89-369
to
xforms-0.89-387 and xformsd-0.89-387.
Totally recompiled. (rpm -tb lyx-1.2.0cvs.tar.gz)

The same behaviour. Crash on open of the lyx-file. Not reproducible
with other pictures. Not reproducible with the debug-version of lyx.

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7CT7ewfbDGmeqhAQFcSQP9Fwu/4dTod6NTa26aGis1mDBgZHoWdg5s
rIOB5sNDiyHpH9ffvO5N593KSpYHea3ewm46iINqF8l6yAJlqvuBvMff7oRCFlPh
Vla9O6/43UPO4rygWIUBl05cWINKapdYqY0OGK0LebzxZUAVPMDClyxmemLYm7ag
e56gx7l0jAo=
=83B+
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko [EMAIL PROTECTED] writes:

| Hi Lars, I quote here myself

 please answer privatelly. I am on the list, but not under this address.
 Therefore I see the answers only in the mail-archive some hours later.

 My xforms-version is
  xforms-0.89-369

| I upgraded now from
|   forms-0.89-369
| to
|   xforms-0.89-387 and xformsd-0.89-387.
| Totally recompiled. (rpm -tb lyx-1.2.0cvs.tar.gz)

| The same behaviour. Crash on open of the lyx-file. Not reproducible
| with other pictures. Not reproducible with the debug-version of lyx.

Can you run LyX with -dbg graphics turned on?

lyx -dbg graphics

That should give some more info.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
 Kornel Benko [EMAIL PROTECTED] writes:
...
 Can you run LyX with -dbg graphics turned on?

 lyx -dbg graphics

 That should give some more info.
Yes, here the whole log. I am running with
-dbg graphics,parser,key,action,lyxrc,files,init

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7QibewfbDGmeqhAQF6LQP/dHrITaOW7qkjuXVJdN5RGh/dwnTiBrdX
zAZyZbtDHtdUM7hx+mMARhbf5X5+81QhJ/nwVOzm1O0plFkwIjuoRPWjtKiGOt5g
XX80fPnMpnIopIp7zzW+QiaIj4SAX31V+6J1sSTRbRj413+KRXEBxgOGEnMA2yTE
8eD9sQvTXf0=
=G5Pv
-END PGP SIGNATURE-


CINTSYSDIR=/usr/lib/cint
COKE_HOME=/usr/bin
COLORTERM=1
COLUMNS=80
CORSO_HELP_DIR=/usr/share/corso/doc
CPLUS_INCLUDE_PATH=/usr/lib/qt/include:/usr/lib/qt/include
CRPATH=/usr/lib/crisp/macros
CSHEDIT=emacs
DATEMSK=/usr2/kornel/.datemask
DISPLAY=:0
DMARSCONF=/usr/lib/mars_e
DTREE=/usr/dtree
EDITOR=editor
FROM_HEADER=YAST_ASK
GNOMEDIR=/opt/gnome
GROUP=wfm
GS_FONTPATH=/usr/share/lilypond/afm
GZIP=-9
HAD_CSHRC=
HELPPATH=/usr/openwin/lib/help
HOME=/usr2/kornel
HOST=cogi
HOSTNAME=cogi.local
HOSTTYPE=i386-linux
INFODIR=/usr/info:/usr/share/info:/usr/local/info
INFOPATH=/usr/info:/usr/share/info:/usr/local/info
INPUTRC=/etc/inputrc
KDEDIR=/opt/kde
KDEDIRS=/etc/opt/kde2:/opt/kde2
KDEHOME=/usr2/kornel/.kde2
LANG=de
LC_COLLATE=POSIX
LD_LIBRARY_PATH=/opt/kde/lib:/opt/kde2/lib:/usr/lib/qt/lib:/usr/lib/qt/lib
LESS=-sM
LESSCHARSET=latin1
LESSKEY=/etc/lesskey.bin
LESSOPEN='|lesspipe.sh %s'
LIBRARY_PATH=/usr/lib/qt/lib
LILYPONDPREFIX=/usr/share/lilypond
LINES=25
LOGNAME=kornel
LS_COLORS=':no=00:fi=00:di=01;34:ln=01:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:ex=01;31:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:'
LS_OPTIONS='-N --color=tty -T 0'
MACHTYPE=i686
MAIL=/var/spool/mail/kornel
MANPATH=/usr/local/man:/usr/share/man:/usr/X11R6/man:/opt/gnome/man:/usr/openwin/man:/usr/man:/usr/share/man/allman
MAXHOME=/usr/lib/maxwell
MFINPUTS=/usr/share/lilypond/mf:/usr/share/lilypond/mf
MINICOM='-c on'
MORE=-sl
MOZILLA_HOME=/usr/local/netscape
NLSPATH=/usr/lib/locale/%L/LC_MESSAGES/%N.cat:~/f3/dest/lib/nls/msg/%L/%N.cat
NNTPSERVER=news
OPENWINHOME=/usr/openwin
OSTYPE=linux
PAGER='/usr/bin/less -sM'
PATH=/opt/kde/bin:/usr2/kornel/bin:/usr2/kornel/f3/dest/bin:/usr/local/bin:/usr/dtree/bin/save:/usr/dtree/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/bin/X11:/opt/kde/bin:/opt/kde2/bin:/opt/gnome/bin:/usr/lib/qt/bin:/usr/rtf2latex2e:/usr/openwin/bin:/etc:.
PRINTER=lp
PROJECT=
PWD=/mnt/gnu/lyx/lyx-1.1.5fix2/lib/doc/TOC_top
QTDIR=/usr/lib/qt
RTF2LATEX2E_DIR=/usr/rtf2latex2e
SHELL=/bin/tcsh
SHLVL=6
SUSE_DOC_HOST=localhost
TERM=linux
TEXINPUTS=/usr/share/lilypond/tex:/usr/share/lilypond/tex
TEXMFS=/usr/share/texmf
TZ=GMT-1
USER=kornel
VARFONTS=/var/texfonts
VENDOR=suse
WINDOWMANAGER=kde
WORM_ADMINPGNO=76
WORM_MOUNTPGNO=242055
WORM_PORT=31027
X=1280
XFILESEARCHPATH=/usr/lib/X11/%L/%T/%N%C:/usr/lib/X11/%l/%T/%N%C:/usr/lib/X11/%T/%N%C:/usr/lib/X11/%L/%T/%N:/usr/lib/X11/%l/%T/%N:/usr/lib/X11/%T/%N:/var/X11R6/%T/%N%C:/var/X11R6/%T/%N
XKEYSYMDB=/usr/X11/lib/X11/XKeysymDB
XMEM=317
XMEM_DAT=/home/kornel/xmem.log
XXGDBWINEDIT=editor
_=/opt/kde/bin/kfm
destdir=/local/dtree/dest
no_proxy=localhost
objdir=/local/dtree/obj
parmsfile=/local/sccsdtree/s/magic/parms/linux22
srcdir=/local/sccsdtree/s
sysvrs=/local/sccsdtree/s/sysvars/linux.vrs
/usr/src/lyx/lyx-1.1.2/src/lyx: Befehl nicht gefunden.
echo: Kein Treffer.



Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Kornel Benko wrote:

 -BEGIN PGP SIGNED MESSAGE-
 
 On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
 
Kornel Benko [EMAIL PROTECTED] writes:

 ...
 
Can you run LyX with -dbg graphics turned on?

lyx -dbg graphics

That should give some more info.

 Yes, here the whole log. I am running with


please zip logs, too much traffic.

this is your file:

Attempting to convert image file: /usr2/kornel/jpg/shmoo.jpg
with recognised extension: jpg.
Scanstring: ÿØÿà
Scanstring: 
[...]
where is the JFIF stamp???

the same file running with my 1.2.0

Attempting to convert image file: /tmp/shmoo.jpg
with recognised extension: jpg.
Scanstring: ÿØÿàJFIFÿÛC
Recognised Fileformat: jpg
[...]

but anyway it shouldn't crash.

Herbert




-- 
http://www.lyx.org/help/




Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko [EMAIL PROTECTED] writes:

| On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
 Kornel Benko [EMAIL PROTECTED] writes:
| ...
 Can you run LyX with -dbg graphics turned on?

 lyx -dbg graphics

 That should give some more info.
| Yes, here the whole log. I am running with
|   -dbg graphics,parser,key,action,lyxrc,files,init

I bet this is the culprit:

istream  operator(istream  is, lyxstring  s)
{
#if 1
// very bad solution
char * nome = new char[1024];
is  nome;
lyxstring tmp(nome);
delete [] nome;
if (!tmp.empty()) s = tmp;
#else
// better solution
int w = is.widdth(0);
s.clear();
char c = 0;
while (is.get(c)) {
if (isspace(c)) { is.putback(c); break; }
s += c;
if (--w == 1) break;
}
if (s.empty()) is.setstate(ios::failbit);
#endif
return is;
}


We are reading a string that is longer than 1024 chars.
It would be interesting to see if we could the the #else part to work.
Then this problem would most likely be solved.

Would you be able to set #if 0 and try again... this patch should
make that happen:

diff -u -p -r1.52 lyxstring.C
--- lyxstring.C 21 Mar 2002 17:06:35 -  1.52
+++ lyxstring.C 6 Apr 2002 11:13:12 -
@@ -1740,7 +1743,7 @@ istream  operator(istream  is, lyxst
if (!tmp.empty()) s = tmp;
 #else
// better solution
-   int w = is.widdth(0);
+   int w = is.width(0);
s.clear();
char c = 0;
while (is.get(c)) {
@@ -1748,7 +1751,7 @@ istream  operator(istream  is, lyxst
s += c;
if (--w == 1) break;
}
-   if (s.empty()) is.setstate(ios::failbit);
+   if (s.empty()) is.setstate(std::ios::failbit);
 #endif
return is;
 }



-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss [EMAIL PROTECTED] writes:

| Kornel Benko wrote:

 -BEGIN PGP SIGNED MESSAGE-
 On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:

Kornel Benko [EMAIL PROTECTED] writes:

 ...

Can you run LyX with -dbg graphics turned on?

lyx -dbg graphics

That should give some more info.

 Yes, here the whole log. I am running with


| please zip logs, too much traffic.

| this is your file:

compiled --with-included-string

| Attempting to convert image file: /usr2/kornel/jpg/shmoo.jpg
| with recognised extension: jpg.
| Scanstring: ÿØÿà
| Scanstring: 
| [...]
| where is the JFIF stamp???

| the same file running with my 1.2.0

compiled --without-included-string

| Attempting to convert image file: /tmp/shmoo.jpg
| with recognised extension: jpg.
| Scanstring: ÿØÿàJFIFÿÛC
  ^
  here it is a '\0' in the shmoo.jpg file

| Recognised Fileformat: jpg
| [...]

| but anyway it shouldn't crash.

the operator for lyxstring cannot handle '\0' chars in the string.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 13:14, Lars Gullik Bjønnes wrote:
...
 I bet this is the culprit:

This did it.

This are the last lines of the lyx-log:

...
Token: 'rotateOrigin'
Token: 'lyxsize_type'
Token: 'lyxwidth'
Token: '\end_inset'
Handling token: `\the_end'
Attempting to convert image file: /usr2/kornel/jpg/shmoo.jpg
with recognised extension: jpg.
Scanstring: 
ÿØÿà^@^PJFIF^@^A^A^@^@^A^@^A^@^@ÿÛ^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H
Recognised Fileformat: jpg
Scanstring: 
ÿØÿà^@^PJFIF^@^A^A^@^@^A^@^A^@^@ÿÛ^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H
Recognised Fileformat: jpg

The image loader can load the following directly:
Windows/OS2 BMP file, extension bmp
NASA/NOST FITS, extension fits
CompuServ GIF, extension gif
JPEG/JFIF format, extension jpg
Portable Pixmap, extension ppm
Portable Graymap, extension pgm
Portable Bitmap, extension pbm
PostScript, extension ps
SGI Iris, extension sgi
Tag Image File Format, extension tif
X11 Bitmap, extension xbm
X Window Dump, extension xwd
XPM format, extension xpm

Of these, LyX recognises the following formats:
bmp, fits, gif, jpg, ppm, pgm, pbm, ps, sgi, tiff, xbm, xwd, xpm

The file contains jpg format data.
No conversion needed!
Loading image.

...

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7brLewfbDGmeqhAQGTcgP/YtboIcjDrnCJ4WLlHZ1CNwV85sqguvJ/
2ou2DswtcqwbvxPjnIP9x2R+39HTJ3NQ9YZiujw4uAkb5NRkiYMCqE75Y7G/jEqU
4TnU9mMp0Qo+fpfbPVxitHFx7xDop5+boeKaF9+vawb4LwjcRRUC8TdeaPXyWIM0
tkzwpYTnlWk=
=gCQu
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 13:45, Herbert Voss wrote:

...
 [...]
 where is the JFIF stamp???

Don't know. The file is created with xsane. Underlying scanner is
HP ScanJet 6300C

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7cuLewfbDGmeqhAQHB8QQAghAGlmHBD7qZO6lxyJ4tlB+0gR7PFKd3
lpHFzUOGN+hFux6yrFtRBr3wchgqWC+5emL4u5JmBwKScdhx2rUvlfudodJ82FiY
VMlX2NwilbaAyIr29AKUtJW6/MVTVimCZmmjo+I9PiUDEVEd8e2HBGIWQyEnercc
iT6UCiLLMng=
=V8+4
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko [EMAIL PROTECTED] writes:

| On Saturday, 6. April 2002 13:14, Lars Gullik Bjønnes wrote:
| ...
 I bet this is the culprit:

| This did it.

Can you try this variant as well?

istream  operator(istream  is, lyxstring  s)
{
#if 0
// very bad solution
char * nome = new char[1024];
is  nome;
lyxstring tmp(nome);
delete [] nome;
if (!tmp.empty()) s = tmp;
#else
// better solution
int w = is.width(0);
s.clear();
int c = 0;
while ((c = is.get()) != istream::traits_type::eof()) {
if (isspace(c)) { is.putback(c); break; }
s += char(c);
if (--w == 1) break;
}
if (s.empty()) is.setstate(std::ios::failbit);
#endif
return is;
}

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 13:42, Lars Gullik Bjønnes wrote:
...
 Can you try this variant as well?

This time it is not compilable.
...
make[3]: Entering directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src/support'
/bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../src 
- -I./../ -I../.. -I../.. -I../../boost  -isystem /usr/X11R6/include  -O2 
- -mcpu=i486 -fno-strength-reduce -W -Wall -c lyxstring.C
g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ -I../.. -I../.. -I../../boost 
- -isystem /usr/X11R6/include -O2 -mcpu=i486 -fno-strength-reduce -W -Wall 
- -Wp,-MD,.deps/lyxstring.pp -c lyxstring.C
lyxstring.C: In function `class istream  operator (istream , lyxstring 
)':
lyxstring.C:1746: `traits_type' is not a member of type `istream'
lyxstring.C:1746: parse error before `::'
lyxstring.C:1747: confused by earlier errors, bailing out
make[3]: *** [lyxstring.lo] Error 1
make[3]: Leaving directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src/support'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src'
make[1]: *** [all-recursive-am] Error 2
make[1]: Leaving directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src'
make: *** [all-recursive] Error 1
Exitcode 2

...
   while ((c = is.get()) != istream::traits_type::eof()) {
   if (isspace(c)) { is.putback(c); break; }
   s += char(c);
   if (--w == 1) break;
   }
   if (s.empty()) is.setstate(std::ios::failbit);
...

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7grrewfbDGmeqhAQH77AQAgO4fzVl3VsePIS4tb0afO5Hw+2RWOFZP
HkpZQ5CFG5eB2VIlUTKtEy1UOOj4pTOSuJ/eO6tNaDoJ86prmoXuUXSb0WgtaPnE
AXZnDAp1d454csnXvdEHcTA5C6F8JvDp0bysfPHcNAxfkYC0XHmE/Yn4FvZ6wvur
vdlSQysv8zI=
=Pkdn
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko [EMAIL PROTECTED] writes:

| On Saturday, 6. April 2002 13:42, Lars Gullik Bjønnes wrote:
| ...
 Can you try this variant as well?

| This time it is not compilable.
| ...
| make[3]: Entering directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src/support'
| /bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../src 
| -I./../ -I../.. -I../.. -I../../boost  -isystem /usr/X11R6/include  -O2 
| -mcpu=i486 -fno-strength-reduce -W -Wall -c lyxstring.C
| g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ -I../.. -I../.. -I../../boost 
| -isystem /usr/X11R6/include -O2 -mcpu=i486 -fno-strength-reduce -W -Wall 
| -Wp,-MD,.deps/lyxstring.pp -c lyxstring.C
| lyxstring.C: In function `class istream  operator (istream , lyxstring 
| )':
| lyxstring.C:1746: `traits_type' is not a member of type `istream'

Ok, substandard library then...

The other version is imho sligtly better anyway so...

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:

| We are reading a string that is longer than 1024 chars.
| It would be interesting to see if we could the the #else part to work.
| Then this problem would most likely be solved.

| Would you be able to set #if 0 and try again... this patch should
| make that happen:

| diff -u -p -r1.52 lyxstring.C
| --- lyxstring.C 21 Mar 2002 17:06:35 -  1.52
| +++ lyxstring.C 6 Apr 2002 11:13:12 -
| @@ -1740,7 +1743,7 @@ istream  operator(istream  is, lyxst
| if (!tmp.empty()) s = tmp;
|  #else
| // better solution
| -   int w = is.widdth(0);
| +   int w = is.width(0);
| s.clear();
| char c = 0;
| while (is.get(c)) {
| @@ -1748,7 +1751,7 @@ istream  operator(istream  is, lyxst
| s += c;
| if (--w == 1) break;
| }
| -   if (s.empty()) is.setstate(ios::failbit);
| +   if (s.empty()) is.setstate(std::ios::failbit);
|  #endif
| return is;
|  }

Ok, so this was a bug in lyxstring... fixed now... (hopefully)
but there is also most likely a problem in getExtFromContents ... it
uses

string str;
ifs  str;

this only reads from ifs until ' ' or '\n' or eof is reached, I guess
it would be more correct to read a whole line and do the checks on
that.

something like...

string str;
getline(ifs, str);

should be enough.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

 Ok, so this was a bug in lyxstring... fixed now... (hopefully)
 but there is also most likely a problem in getExtFromContents ... it
 uses
 
 string str;
 ifs  str;
 
 this only reads from ifs until ' ' or '\n' or eof is reached, I guess
 it would be more correct to read a whole line and do the checks on
 that.


I do not think so. the worst case maybe for example:

BM and_now_tons_of_bytes_without_a_newline

the first token does it all: filetype=bmp.

Herbert


-- 
http://www.lyx.org/help/




Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss [EMAIL PROTECTED] writes:

| Lars Gullik Bjønnes wrote:

 Ok, so this was a bug in lyxstring... fixed now... (hopefully)
 but there is also most likely a problem in getExtFromContents ... it
 uses
 string str;
 ifs  str;
 this only reads from ifs until ' ' or '\n' or eof is reached, I guess
 it would be more correct to read a whole line and do the checks on
 that.


| I do not think so. the worst case maybe for example:

| BM and_now_tons_of_bytes_without_a_newline

| the first token does it all: filetype=bmp.

Then you should read. f.ex. only the first 80 bytes of the file, and
not assume that there is a ' ' or '\n' near the beginning of the file.

As it is not you are not all-files-type-proof, if I tried to load the
lyx binary as a graphcs file it would most likely fail, or just read
_a lot_ too much.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:

| Herbert Voss [EMAIL PROTECTED] writes:

| | Lars Gullik Bjønnes wrote:

 Ok, so this was a bug in lyxstring... fixed now... (hopefully)
 but there is also most likely a problem in getExtFromContents ... it
 uses
 string str;
 ifs  str;
 this only reads from ifs until ' ' or '\n' or eof is reached, I guess
 it would be more correct to read a whole line and do the checks on
 that.


| | I do not think so. the worst case maybe for example:

| | BM and_now_tons_of_bytes_without_a_newline

| | the first token does it all: filetype=bmp.

| Then you should read. f.ex. only the first 80 bytes of the file, and
| not assume that there is a ' ' or '\n' near the beginning of the file.

| As it is not you are not all-files-type-proof, if I tried to load the
| lyx binary as a graphcs file it would most likely fail, or just read
| _a lot_ too much.

btw. I do not agree with the logic of getExtFromContents, first of all
it should be named getFileType :-)

The more important issue is if the  contents turn out to be an unknown
file type, but the extension is known. And also that we really should
know the contents if the extension is right.

f.ex.

cp bin/lyx tmp.jpg

getExtFronContents would return jpg... which is obviously wrong, and
in the code we can easily know that it is wrong. Stuff like this will
most likely lead to strange errors/crashes.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

 btw. I do not agree with the logic of getExtFromContents, first of all
 it should be named getFileType :-)


I have absolutely no problems to agree with important facts ... ;-)


 The more important issue is if the  contents turn out to be an unknown
 file type, but the extension is known. And also that we really should
 know the contents if the extension is right.
 
 f.ex.
 
 cp bin/lyx tmp.jpg
 
 getExtFronContents would return jpg... which is obviously wrong, and
 in the code we can easily know that it is wrong. Stuff like this will
 most likely lead to strange errors/crashes.


that were my arguments in the past to ignore the extension!

It was not my idea to return ext, when nothing was found. The
return of user is enough to handle unknown stuff.

Herbert



-- 
http://www.lyx.org/help/




[PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

 As it is not you are not all-files-type-proof, if I tried to load the
 lyx binary as a graphcs file it would most likely fail, or just read
 _a lot_ too much.

please edit, I never did it in this way (reading from a file)
support/filetools.C - getExtFromContents()

char dummy[64]; // my brain thinks binary ...

[...]

ifs.read(dummy, 64);
str = string(dummy);
[...]


Herbert


-- 
http://www.lyx.org/help/




Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss [EMAIL PROTECTED] writes:

| Lars Gullik Bjønnes wrote:

 As it is not you are not all-files-type-proof, if I tried to load the
 lyx binary as a graphcs file it would most likely fail, or just read
 _a lot_ too much.

| please edit, I never did it in this way (reading from a file)
| support/filetools.C - getExtFromContents()

| char dummy[64]; // my brain thinks binary ...

| [...]

|   ifs.read(dummy, 64);
|   str = string(dummy);
| [...]

actually we can easly argue that what we read in is not a string but
an array of bytes, but to make comparisons easier it is proabably
easiest to stay with string.

char char_array[64];
int read_n = ifs.readsome(dummy, 64);
string str(dymmy, read_n);

unfortunately readsome is missing in a lot of sub-standard C++
libraries.

-- 
Lgb



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

 actually we can easly argue that what we read in is not a string but
 an array of bytes, but to make comparisons easier it is proabably
 easiest to stay with string.
 
 char char_array[64];
 int read_n = ifs.readsome(dummy, 64);
 string str(dymmy, read_n);
 
 unfortunately readsome is missing in a lot of sub-standard C++
 libraries.


yes, that's true.

is there an easy way to get the filesize or the streamsize of

ifstream ifs(filename.c_str());


than we can decrease a counter.

Herbert



-- 
http://www.lyx.org/help/




Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss [EMAIL PROTECTED] writes:

| Lars Gullik Bjønnes wrote:

 actually we can easly argue that what we read in is not a string but
 an array of bytes, but to make comparisons easier it is proabably
 easiest to stay with string.
 char char_array[64];
 int read_n = ifs.readsome(dummy, 64);
 string str(dymmy, read_n);
 unfortunately readsome is missing in a lot of sub-standard C++
 libraries.


| yes, that's true.

| is there an easy way to get the filesize or the streamsize of

|   ifstream ifs(filename.c_str());

That sounds as overkill.

but stat is your friend. Possibly FileInfo han give you this
information.

-- 
Lgb



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

  | yes, that's true.
 
  | is there an easy way to get the filesize or the streamsize of
 
  |ifstream ifs(filename.c_str());
 
  That sounds as overkill.
 
  but stat is your friend. Possibly FileInfo han give you this
  information.


this seems easier to me ...
do a mv ... /dev/null if it's nonsense

Herbert



-- 
http://www.lyx.org/help/



Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.93
diff -u -r1.93 ChangeLog
--- src/support/ChangeLog   6 Apr 2002 13:01:03 -   1.93
+++ src/support/ChangeLog   6 Apr 2002 17:45:42 -
@@ -1,3 +1,8 @@
+2002-04-07  Herbert Voss  [EMAIL PROTECTED]
+
+   * filetools.C: (getExtFromContents) read less bytes to find
+   the file type
+
 2002-04-06  Lars Gullik Bjønnes  [EMAIL PROTECTED]
 
* lyxstring.C (operator): use the better solution, this fixes a
Index: src/support/filetools.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.113
diff -u -r1.113 filetools.C
--- src/support/filetools.C 6 Apr 2002 12:42:42 -   1.113
+++ src/support/filetools.C 6 Apr 2002 17:45:42 -
@@ -1018,6 +1018,12 @@
// Couldn't open file...
return string();
 
+   // get the filesize
+   ifs.seekg(0,ios::end);
+   int filesize = (int)ifs.tellg();
+   ifs.seekg(0,ios::beg);
+   lyxerr[Debug::GRAPHICS]  filesize =   filesize  endl;
+
// gnuzip
string const gzipStamp = \037\213\010\010;
 
@@ -1041,8 +1047,11 @@
 endl;
break;
}
-
-   ifs  str;
+   int read_bytes = (filesize  bytes_to_read) ? bytes_to_read : filesize;
+   char char_array[read_bytes];
+   ifs.read(char_array, read_bytes);
+   string str(char_array, read_bytes);
+   filesize -= bytes_to_read;
lyxerr[Debug::GRAPHICS]
 Scanstring:   str  endl;
string const stamp = str.substr(0,2);




Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Herbert Voss wrote:

 this seems easier to me ...
 do a mv ... /dev/null if it's nonsense


should not be the truth ... ;-)
here is the right one ..., sorry

Herbert



-- 
http://www.lyx.org/help/


Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.93
diff -u -r1.93 ChangeLog
--- src/support/ChangeLog   6 Apr 2002 13:01:03 -   1.93
+++ src/support/ChangeLog   6 Apr 2002 17:53:44 -
@@ -1,3 +1,8 @@
+2002-04-07  Herbert Voss  [EMAIL PROTECTED]
+
+   * filetools.C: (getExtFromContents) read less bytes to find
+   the file type
+
 2002-04-06  Lars Gullik Bjønnes  [EMAIL PROTECTED]
 
* lyxstring.C (operator): use the better solution, this fixes a
Index: src/support/filetools.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.113
diff -u -r1.113 filetools.C
--- src/support/filetools.C 6 Apr 2002 12:42:42 -   1.113
+++ src/support/filetools.C 6 Apr 2002 17:53:45 -
@@ -1013,11 +1013,18 @@
if (filename.empty() || !IsFileReadable(filename))
return string();
 
+   
ifstream ifs(filename.c_str());
if (!ifs)
// Couldn't open file...
return string();
 
+   // get the filesize
+   ifs.seekg(0,ios::end);
+   int filesize = (int)ifs.tellg();
+   ifs.seekg(0,ios::beg);
+   lyxerr[Debug::GRAPHICS]  filesize =   filesize  endl;
+   
// gnuzip
string const gzipStamp = \037\213\010\010;
 
@@ -1032,6 +1039,7 @@
int count = 0;
 
string str, format;
+   int const bytes_to_read = 64;
bool firstLine = true;
while ((count++  max_count)  format.empty()) {
if (ifs.eof()) {
@@ -1041,8 +1049,11 @@
 endl;
break;
}
-
-   ifs  str;
+   int read_bytes = (filesize  bytes_to_read) ? bytes_to_read : filesize;
+   char char_array[read_bytes];
+   ifs.read(char_array, read_bytes);
+   string str(char_array, read_bytes);
+   filesize -= bytes_to_read;
lyxerr[Debug::GRAPHICS]
 Scanstring:   str  endl;
string const stamp = str.substr(0,2);



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss [EMAIL PROTECTED] writes:

| this seems easier to me ...
| do a mv ... /dev/null if it's nonsense

It does not look good...

| + // get the filesize
| + ifs.seekg(0,ios::end);
| + int filesize = (int)ifs.tellg();

(some istream::size_type would probably have been the correct type for
filesize)

| + ifs.seekg(0,ios::beg);

This is just do obfuscated for my liking.
and imho a simple stat does the work in a much more obvious way.

FileInfo fi(file);
off_t filesize = fi.getSize();

| + lyxerr[Debug::GRAPHICS]  filesize =   filesize  endl;
| +
|   // gnuzip
|   string const gzipStamp = \037\213\010\010;
|  
| @@ -1041,8 +1047,11 @@
|endl;
|   break;
|   }
| -
| - ifs  str;
| + int read_bytes = (filesize  bytes_to_read) ?
| bytes_to_read : filesize;

int read_bytes = min(filesize, bytes_to_read);

| + char char_array[read_bytes];
| + ifs.read(char_array, read_bytes);
| + string str(char_array, read_bytes);
| + filesize -= bytes_to_read;
|   lyxerr[Debug::GRAPHICS]
|Scanstring:   str  endl;
|   string const stamp = str.substr(0,2);

Anyway, this is not something that is important to change before
1.2.0. (IMHO)

-- 
Lgb



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss [EMAIL PROTECTED] writes:

| Herbert Voss wrote:

 this seems easier to me ...
 do a mv ... /dev/null if it's nonsense


| should not be the truth ... ;-)
| here is the right one ..., sorry

And I'd really like to se a readsome variant as well, since that is
how we really want this done.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

Hi Lars, I quote here myself

> please answer privatelly. I am on the list, but not under this address.
> Therefore I see the answers only in the mail-archive some hours later.
>
> My xforms-version is
>   xforms-0.89-369

I upgraded now from
forms-0.89-369
to
xforms-0.89-387 and xformsd-0.89-387.
Totally recompiled. (rpm -tb lyx-1.2.0cvs.tar.gz)

The same behaviour. Crash on open of the lyx-file. Not reproducible
with other pictures. Not reproducible with the debug-version of lyx.

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7CT7ewfbDGmeqhAQFcSQP9Fwu/4dTod6NTa26aGis1mDBgZHoWdg5s
rIOB5sNDiyHpH9ffvO5N593KSpYHea3ewm46iINqF8l6yAJlqvuBvMff7oRCFlPh
Vla9O6/43UPO4rygWIUBl05cWINKapdYqY0OGK0LebzxZUAVPMDClyxmemLYm7ag
e56gx7l0jAo=
=83B+
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko <[EMAIL PROTECTED]> writes:

| Hi Lars, I quote here myself
>
>> please answer privatelly. I am on the list, but not under this address.
>> Therefore I see the answers only in the mail-archive some hours later.
>>
>> My xforms-version is
>>  xforms-0.89-369
>
| I upgraded now from
|   forms-0.89-369
| to
|   xforms-0.89-387 and xformsd-0.89-387.
| Totally recompiled. (rpm -tb lyx-1.2.0cvs.tar.gz)
>
| The same behaviour. Crash on open of the lyx-file. Not reproducible
| with other pictures. Not reproducible with the debug-version of lyx.

Can you run LyX with "-dbg graphics" turned on?

"lyx -dbg graphics"

That should give some more info.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
> Kornel Benko <[EMAIL PROTECTED]> writes:
...
> Can you run LyX with "-dbg graphics" turned on?
>
> "lyx -dbg graphics"
>
> That should give some more info.
Yes, here the whole log. I am running with
-dbg graphics,parser,key,action,lyxrc,files,init

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7QibewfbDGmeqhAQF6LQP/dHrITaOW7qkjuXVJdN5RGh/dwnTiBrdX
zAZyZbtDHtdUM7hx+mMARhbf5X5+81QhJ/nwVOzm1O0plFkwIjuoRPWjtKiGOt5g
XX80fPnMpnIopIp7zzW+QiaIj4SAX31V+6J1sSTRbRj413+KRXEBxgOGEnMA2yTE
8eD9sQvTXf0=
=G5Pv
-END PGP SIGNATURE-


CINTSYSDIR=/usr/lib/cint
COKE_HOME=/usr/bin
COLORTERM=1
COLUMNS=80
CORSO_HELP_DIR=/usr/share/corso/doc
CPLUS_INCLUDE_PATH=/usr/lib/qt/include:/usr/lib/qt/include
CRPATH=/usr/lib/crisp/macros
CSHEDIT=emacs
DATEMSK=/usr2/kornel/.datemask
DISPLAY=:0
DMARSCONF=/usr/lib/mars_e
DTREE=/usr/dtree
EDITOR=editor
FROM_HEADER=YAST_ASK
GNOMEDIR=/opt/gnome
GROUP=wfm
GS_FONTPATH=/usr/share/lilypond/afm
GZIP=-9
HAD_CSHRC=
HELPPATH=/usr/openwin/lib/help
HOME=/usr2/kornel
HOST=cogi
HOSTNAME=cogi.local
HOSTTYPE=i386-linux
INFODIR=/usr/info:/usr/share/info:/usr/local/info
INFOPATH=/usr/info:/usr/share/info:/usr/local/info
INPUTRC=/etc/inputrc
KDEDIR=/opt/kde
KDEDIRS=/etc/opt/kde2:/opt/kde2
KDEHOME=/usr2/kornel/.kde2
LANG=de
LC_COLLATE=POSIX
LD_LIBRARY_PATH=/opt/kde/lib:/opt/kde2/lib:/usr/lib/qt/lib:/usr/lib/qt/lib
LESS=-sM
LESSCHARSET=latin1
LESSKEY=/etc/lesskey.bin
LESSOPEN='|lesspipe.sh %s'
LIBRARY_PATH=/usr/lib/qt/lib
LILYPONDPREFIX=/usr/share/lilypond
LINES=25
LOGNAME=kornel
LS_COLORS=':no=00:fi=00:di=01;34:ln=01:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:ex=01;31:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:'
LS_OPTIONS='-N --color=tty -T 0'
MACHTYPE=i686
MAIL=/var/spool/mail/kornel
MANPATH=/usr/local/man:/usr/share/man:/usr/X11R6/man:/opt/gnome/man:/usr/openwin/man:/usr/man:/usr/share/man/allman
MAXHOME=/usr/lib/maxwell
MFINPUTS=/usr/share/lilypond/mf:/usr/share/lilypond/mf
MINICOM='-c on'
MORE=-sl
MOZILLA_HOME=/usr/local/netscape
NLSPATH=/usr/lib/locale/%L/LC_MESSAGES/%N.cat:~/f3/dest/lib/nls/msg/%L/%N.cat
NNTPSERVER=news
OPENWINHOME=/usr/openwin
OSTYPE=linux
PAGER='/usr/bin/less -sM'
PATH=/opt/kde/bin:/usr2/kornel/bin:/usr2/kornel/f3/dest/bin:/usr/local/bin:/usr/dtree/bin/save:/usr/dtree/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/bin/X11:/opt/kde/bin:/opt/kde2/bin:/opt/gnome/bin:/usr/lib/qt/bin:/usr/rtf2latex2e:/usr/openwin/bin:/etc:.
PRINTER=lp
PROJECT=
PWD=/mnt/gnu/lyx/lyx-1.1.5fix2/lib/doc/TOC_top
QTDIR=/usr/lib/qt
RTF2LATEX2E_DIR=/usr/rtf2latex2e
SHELL=/bin/tcsh
SHLVL=6
SUSE_DOC_HOST=localhost
TERM=linux
TEXINPUTS=/usr/share/lilypond/tex:/usr/share/lilypond/tex
TEXMFS=/usr/share/texmf
TZ=GMT-1
USER=kornel
VARFONTS=/var/texfonts
VENDOR=suse
WINDOWMANAGER=kde
WORM_ADMINPGNO=76
WORM_MOUNTPGNO=242055
WORM_PORT=31027
X=1280
XFILESEARCHPATH=/usr/lib/X11/%L/%T/%N%C:/usr/lib/X11/%l/%T/%N%C:/usr/lib/X11/%T/%N%C:/usr/lib/X11/%L/%T/%N:/usr/lib/X11/%l/%T/%N:/usr/lib/X11/%T/%N:/var/X11R6/%T/%N%C:/var/X11R6/%T/%N
XKEYSYMDB=/usr/X11/lib/X11/XKeysymDB
XMEM=317
XMEM_DAT=/home/kornel/xmem.log
XXGDBWINEDIT=editor
_=/opt/kde/bin/kfm
destdir=/local/dtree/dest
no_proxy=localhost
objdir=/local/dtree/obj
parmsfile=/local/sccsdtree/s/magic/parms/linux22
srcdir=/local/sccsdtree/s
sysvrs=/local/sccsdtree/s/sysvars/linux.vrs
/usr/src/lyx/lyx-1.1.2/src/lyx: Befehl nicht gefunden.
echo: Kein Treffer.



Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Kornel Benko wrote:

> -BEGIN PGP SIGNED MESSAGE-
> 
> On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
> 
>>Kornel Benko <[EMAIL PROTECTED]> writes:
>>
> ...
> 
>>Can you run LyX with "-dbg graphics" turned on?
>>
>>"lyx -dbg graphics"
>>
>>That should give some more info.
>>
> Yes, here the whole log. I am running with


please zip logs, too much traffic.

this is your file:

Attempting to convert image file: /usr2/kornel/jpg/shmoo.jpg
with recognised extension: jpg.
Scanstring: ÿØÿà
Scanstring: 
[...]
where is the JFIF stamp???

the same file running with my 1.2.0

Attempting to convert image file: /tmp/shmoo.jpg
with recognised extension: jpg.
Scanstring: ÿØÿàJFIFÿÛC
Recognised Fileformat: jpg
[...]

but anyway it shouldn't crash.

Herbert




-- 
http://www.lyx.org/help/




Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko <[EMAIL PROTECTED]> writes:

| On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
>> Kornel Benko <[EMAIL PROTECTED]> writes:
| ...
>> Can you run LyX with "-dbg graphics" turned on?
>>
>> "lyx -dbg graphics"
>>
>> That should give some more info.
| Yes, here the whole log. I am running with
|   -dbg graphics,parser,key,action,lyxrc,files,init

I bet this is the culprit:

istream & operator>>(istream & is, lyxstring & s)
{
#if 1
// very bad solution
char * nome = new char[1024];
is >> nome;
lyxstring tmp(nome);
delete [] nome;
if (!tmp.empty()) s = tmp;
#else
// better solution
int w = is.widdth(0);
s.clear();
char c = 0;
while (is.get(c)) {
if (isspace(c)) { is.putback(c); break; }
s += c;
if (--w == 1) break;
}
if (s.empty()) is.setstate(ios::failbit);
#endif
return is;
}


We are reading a string that is longer than 1024 chars.
It would be interesting to see if we could the the #else part to work.
Then this problem would most likely be solved.

Would you be able to set "#if 0" and try again... this patch should
make that happen:

diff -u -p -r1.52 lyxstring.C
--- lyxstring.C 21 Mar 2002 17:06:35 -  1.52
+++ lyxstring.C 6 Apr 2002 11:13:12 -
@@ -1740,7 +1743,7 @@ istream & operator>>(istream & is, lyxst
if (!tmp.empty()) s = tmp;
 #else
// better solution
-   int w = is.widdth(0);
+   int w = is.width(0);
s.clear();
char c = 0;
while (is.get(c)) {
@@ -1748,7 +1751,7 @@ istream & operator>>(istream & is, lyxst
s += c;
if (--w == 1) break;
}
-   if (s.empty()) is.setstate(ios::failbit);
+   if (s.empty()) is.setstate(std::ios::failbit);
 #endif
return is;
 }



-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss <[EMAIL PROTECTED]> writes:

| Kornel Benko wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> On Saturday, 6. April 2002 12:02, Lars Gullik Bjønnes wrote:
>>
>>>Kornel Benko <[EMAIL PROTECTED]> writes:
>>>
>> ...
>>
>>>Can you run LyX with "-dbg graphics" turned on?
>>>
>>>"lyx -dbg graphics"
>>>
>>>That should give some more info.
>>>
>> Yes, here the whole log. I am running with
>
>
| please zip logs, too much traffic.
>
| this is your file:

compiled --with-included-string

| Attempting to convert image file: /usr2/kornel/jpg/shmoo.jpg
| with recognised extension: jpg.
| Scanstring: ÿØÿà
| Scanstring: 
| [...]
| where is the JFIF stamp???
>
| the same file running with my 1.2.0

compiled --without-included-string

| Attempting to convert image file: /tmp/shmoo.jpg
| with recognised extension: jpg.
| Scanstring: ÿØÿàJFIFÿÛC
  ^
  here it is a '\0' in the shmoo.jpg file

| Recognised Fileformat: jpg
| [...]
>
| but anyway it shouldn't crash.

the operator>> for lyxstring cannot handle '\0' chars in the string.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 13:14, Lars Gullik Bjønnes wrote:
...
> I bet this is the culprit:

This did it.

This are the last lines of the lyx-log:

...
Token: 'rotateOrigin'
Token: 'lyxsize_type'
Token: 'lyxwidth'
Token: '\end_inset'
Handling token: `\the_end'
Attempting to convert image file: /usr2/kornel/jpg/shmoo.jpg
with recognised extension: jpg.
Scanstring: 
ÿØÿà^@^PJFIF^@^A^A^@^@^A^@^A^@^@ÿÛ^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H
Recognised Fileformat: jpg
Scanstring: 
ÿØÿà^@^PJFIF^@^A^A^@^@^A^@^A^@^@ÿÛ^@C^@^F^D^E^F^E^D^F^F^E^F^G^G^F^H
Recognised Fileformat: jpg

The image loader can load the following directly:
Windows/OS2 BMP file, extension "bmp"
NASA/NOST FITS, extension "fits"
CompuServ GIF, extension "gif"
JPEG/JFIF format, extension "jpg"
Portable Pixmap, extension "ppm"
Portable Graymap, extension "pgm"
Portable Bitmap, extension "pbm"
PostScript, extension "ps"
SGI Iris, extension "sgi"
Tag Image File Format, extension "tif"
X11 Bitmap, extension "xbm"
X Window Dump, extension "xwd"
XPM format, extension "xpm"

Of these, LyX recognises the following formats:
bmp, fits, gif, jpg, ppm, pgm, pbm, ps, sgi, tiff, xbm, xwd, xpm

The file contains jpg format data.
No conversion needed!
Loading image.

...

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7brLewfbDGmeqhAQGTcgP/YtboIcjDrnCJ4WLlHZ1CNwV85sqguvJ/
2ou2DswtcqwbvxPjnIP9x2R+39HTJ3NQ9YZiujw4uAkb5NRkiYMCqE75Y7G/jEqU
4TnU9mMp0Qo+fpfbPVxitHFx7xDop5+boeKaF9+vawb4LwjcRRUC8TdeaPXyWIM0
tkzwpYTnlWk=
=gCQu
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 13:45, Herbert Voss wrote:

...
> [...]
> where is the JFIF stamp???

Don't know. The file is created with xsane. Underlying scanner is
HP ScanJet 6300C

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7cuLewfbDGmeqhAQHB8QQAghAGlmHBD7qZO6lxyJ4tlB+0gR7PFKd3
lpHFzUOGN+hFux6yrFtRBr3wchgqWC+5emL4u5JmBwKScdhx2rUvlfudodJ82FiY
VMlX2NwilbaAyIr29AKUtJW6/MVTVimCZmmjo+I9PiUDEVEd8e2HBGIWQyEnercc
iT6UCiLLMng=
=V8+4
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko <[EMAIL PROTECTED]> writes:

| On Saturday, 6. April 2002 13:14, Lars Gullik Bjønnes wrote:
| ...
>> I bet this is the culprit:
>
| This did it.

Can you try this variant as well?

istream & operator>>(istream & is, lyxstring & s)
{
#if 0
// very bad solution
char * nome = new char[1024];
is >> nome;
lyxstring tmp(nome);
delete [] nome;
if (!tmp.empty()) s = tmp;
#else
// better solution
int w = is.width(0);
s.clear();
int c = 0;
while ((c = is.get()) != istream::traits_type::eof()) {
if (isspace(c)) { is.putback(c); break; }
s += char(c);
if (--w == 1) break;
}
if (s.empty()) is.setstate(std::ios::failbit);
#endif
return is;
}

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-

On Saturday, 6. April 2002 13:42, Lars Gullik Bjønnes wrote:
...
> Can you try this variant as well?

This time it is not compilable.
...
make[3]: Entering directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src/support'
/bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../src 
- -I./../ -I../.. -I../.. -I../../boost  -isystem /usr/X11R6/include  -O2 
- -mcpu=i486 -fno-strength-reduce -W -Wall -c lyxstring.C
g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ -I../.. -I../.. -I../../boost 
- -isystem /usr/X11R6/include -O2 -mcpu=i486 -fno-strength-reduce -W -Wall 
- -Wp,-MD,.deps/lyxstring.pp -c lyxstring.C
lyxstring.C: In function `class istream & operator >>(istream &, lyxstring 
&)':
lyxstring.C:1746: `traits_type' is not a member of type `istream'
lyxstring.C:1746: parse error before `::'
lyxstring.C:1747: confused by earlier errors, bailing out
make[3]: *** [lyxstring.lo] Error 1
make[3]: Leaving directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src/support'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src'
make[1]: *** [all-recursive-am] Error 2
make[1]: Leaving directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src'
make: *** [all-recursive] Error 1
Exitcode 2

...
>   while ((c = is.get()) != istream::traits_type::eof()) {
>   if (isspace(c)) { is.putback(c); break; }
>   s += char(c);
>   if (--w == 1) break;
>   }
>   if (s.empty()) is.setstate(std::ios::failbit);
...

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK7grrewfbDGmeqhAQH77AQAgO4fzVl3VsePIS4tb0afO5Hw+2RWOFZP
HkpZQ5CFG5eB2VIlUTKtEy1UOOj4pTOSuJ/eO6tNaDoJ86prmoXuUXSb0WgtaPnE
AXZnDAp1d454csnXvdEHcTA5C6F8JvDp0bysfPHcNAxfkYC0XHmE/Yn4FvZ6wvur
vdlSQysv8zI=
=Pkdn
-END PGP SIGNATURE-



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Kornel Benko <[EMAIL PROTECTED]> writes:

| On Saturday, 6. April 2002 13:42, Lars Gullik Bjønnes wrote:
| ...
>> Can you try this variant as well?
>
| This time it is not compilable.
| ...
| make[3]: Entering directory `/home/kornel/rpm/BUILD/lyx-1.2.0cvs/src/support'
| /bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../src 
| -I./../ -I../.. -I../.. -I../../boost  -isystem /usr/X11R6/include  -O2 
| -mcpu=i486 -fno-strength-reduce -W -Wall -c lyxstring.C
| g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ -I../.. -I../.. -I../../boost 
| -isystem /usr/X11R6/include -O2 -mcpu=i486 -fno-strength-reduce -W -Wall 
| -Wp,-MD,.deps/lyxstring.pp -c lyxstring.C
| lyxstring.C: In function `class istream & operator >>(istream &, lyxstring 
| &)':
| lyxstring.C:1746: `traits_type' is not a member of type `istream'

Ok, substandard library then...

The other version is imho sligtly better anyway so...

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:

| We are reading a string that is longer than 1024 chars.
| It would be interesting to see if we could the the #else part to work.
| Then this problem would most likely be solved.
>
| Would you be able to set "#if 0" and try again... this patch should
| make that happen:
>
| diff -u -p -r1.52 lyxstring.C
| --- lyxstring.C 21 Mar 2002 17:06:35 -  1.52
| +++ lyxstring.C 6 Apr 2002 11:13:12 -
| @@ -1740,7 +1743,7 @@ istream & operator>>(istream & is, lyxst
| if (!tmp.empty()) s = tmp;
|  #else
| // better solution
| -   int w = is.widdth(0);
| +   int w = is.width(0);
| s.clear();
| char c = 0;
| while (is.get(c)) {
| @@ -1748,7 +1751,7 @@ istream & operator>>(istream & is, lyxst
| s += c;
| if (--w == 1) break;
| }
| -   if (s.empty()) is.setstate(ios::failbit);
| +   if (s.empty()) is.setstate(std::ios::failbit);
|  #endif
| return is;
|  }

Ok, so this was a bug in lyxstring... fixed now... (hopefully)
but there is also most likely a problem in getExtFromContents ... it
uses

string str;
ifs >> str;

this only reads from ifs until ' ' or '\n' or eof is reached, I guess
it would be more correct to read a whole line and do the checks on
that.

something like...

string str;
getline(ifs, str);

should be enough.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

> Ok, so this was a bug in lyxstring... fixed now... (hopefully)
> but there is also most likely a problem in getExtFromContents ... it
> uses
> 
> string str;
> ifs >> str;
> 
> this only reads from ifs until ' ' or '\n' or eof is reached, I guess
> it would be more correct to read a whole line and do the checks on
> that.


I do not think so. the worst case maybe for example:

BM 

the first token does it all: filetype=bmp.

Herbert


-- 
http://www.lyx.org/help/




Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>
>> Ok, so this was a bug in lyxstring... fixed now... (hopefully)
>> but there is also most likely a problem in getExtFromContents ... it
>> uses
>> string str;
>> ifs >> str;
>> this only reads from ifs until ' ' or '\n' or eof is reached, I guess
>> it would be more correct to read a whole line and do the checks on
>> that.
>
>
| I do not think so. the worst case maybe for example:
>
| BM 
>
| the first token does it all: filetype=bmp.

Then you should read. f.ex. only the first 80 bytes of the file, and
not assume that there is a ' ' or '\n' near the beginning of the file.

As it is not you are not all-files-type-proof, if I tried to load the
lyx binary as a graphcs file it would most likely fail, or just read
_a lot_ too much.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:

| Herbert Voss <[EMAIL PROTECTED]> writes:
>
| | Lars Gullik Bjønnes wrote:
>>
>>> Ok, so this was a bug in lyxstring... fixed now... (hopefully)
>>> but there is also most likely a problem in getExtFromContents ... it
>>> uses
>>> string str;
>>> ifs >> str;
>>> this only reads from ifs until ' ' or '\n' or eof is reached, I guess
>>> it would be more correct to read a whole line and do the checks on
>>> that.
>>
>>
| | I do not think so. the worst case maybe for example:
>>
| | BM 
>>
| | the first token does it all: filetype=bmp.
>
| Then you should read. f.ex. only the first 80 bytes of the file, and
| not assume that there is a ' ' or '\n' near the beginning of the file.
>
| As it is not you are not all-files-type-proof, if I tried to load the
| lyx binary as a graphcs file it would most likely fail, or just read
| _a lot_ too much.

btw. I do not agree with the logic of getExtFromContents, first of all
it should be named getFileType :-)

The more important issue is if the  contents turn out to be an unknown
file type, but the extension is known. And also that we really should
know the contents if the extension is right.

f.ex.

cp bin/lyx tmp.jpg

getExtFronContents would return jpg... which is obviously wrong, and
in the code we can easily know that it is wrong. Stuff like this will
most likely lead to strange errors/crashes.

-- 
Lgb



Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

> btw. I do not agree with the logic of getExtFromContents, first of all
> it should be named getFileType :-)


I have absolutely no problems to agree with important facts ... ;-)


> The more important issue is if the  contents turn out to be an unknown
> file type, but the extension is known. And also that we really should
> know the contents if the extension is right.
> 
> f.ex.
> 
> cp bin/lyx tmp.jpg
> 
> getExtFronContents would return jpg... which is obviously wrong, and
> in the code we can easily know that it is wrong. Stuff like this will
> most likely lead to strange errors/crashes.


that were my arguments in the past to ignore the extension!

It was not my idea to return ext, when nothing was found. The
return of "user" is enough to handle "unknown" stuff.

Herbert



-- 
http://www.lyx.org/help/




[PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

> As it is not you are not all-files-type-proof, if I tried to load the
> lyx binary as a graphcs file it would most likely fail, or just read
> _a lot_ too much.

please edit, I never did it in this way (reading from a file)
support/filetools.C - getExtFromContents()

char dummy[64]; // my brain thinks binary ...

[...]

ifs.read(dummy, 64);
str = string(dummy);
[...]


Herbert


-- 
http://www.lyx.org/help/




Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>
>> As it is not you are not all-files-type-proof, if I tried to load the
>> lyx binary as a graphcs file it would most likely fail, or just read
>> _a lot_ too much.
>
| please edit, I never did it in this way (reading from a file)
| support/filetools.C - getExtFromContents()
>
| char dummy[64]; // my brain thinks binary ...
>
| [...]
>
|   ifs.read(dummy, 64);
|   str = string(dummy);
| [...]

actually we can easly argue that what we read in is not a string but
an array of bytes, but to make comparisons easier it is proabably
easiest to stay with string.

char char_array[64];
int read_n = ifs.readsome(dummy, 64);
string str(dymmy, read_n);

unfortunately readsome is missing in a lot of sub-standard C++
libraries.

-- 
Lgb



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

> actually we can easly argue that what we read in is not a string but
> an array of bytes, but to make comparisons easier it is proabably
> easiest to stay with string.
> 
> char char_array[64];
> int read_n = ifs.readsome(dummy, 64);
> string str(dymmy, read_n);
> 
> unfortunately readsome is missing in a lot of sub-standard C++
> libraries.


yes, that's true.

is there an easy way to get the filesize or the streamsize of

ifstream ifs(filename.c_str());


than we can decrease a counter.

Herbert



-- 
http://www.lyx.org/help/




Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>
>> actually we can easly argue that what we read in is not a string but
>> an array of bytes, but to make comparisons easier it is proabably
>> easiest to stay with string.
>> char char_array[64];
>> int read_n = ifs.readsome(dummy, 64);
>> string str(dymmy, read_n);
>> unfortunately readsome is missing in a lot of sub-standard C++
>> libraries.
>
>
| yes, that's true.
>
| is there an easy way to get the filesize or the streamsize of
>
|   ifstream ifs(filename.c_str());

That sounds as overkill.

but stat is your friend. Possibly FileInfo han give you this
information.

-- 
Lgb



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Lars Gullik Bjønnes wrote:

 > | yes, that's true.
 >
 > | is there an easy way to get the filesize or the streamsize of
 >
 > |ifstream ifs(filename.c_str());
 >
 > That sounds as overkill.
 >
 > but stat is your friend. Possibly FileInfo han give you this
 > information.


this seems easier to me ...
do a mv ... /dev/null if it's nonsense

Herbert



-- 
http://www.lyx.org/help/



Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.93
diff -u -r1.93 ChangeLog
--- src/support/ChangeLog   6 Apr 2002 13:01:03 -   1.93
+++ src/support/ChangeLog   6 Apr 2002 17:45:42 -
@@ -1,3 +1,8 @@
+2002-04-07  Herbert Voss  <[EMAIL PROTECTED]>
+
+   * filetools.C: (getExtFromContents) read less bytes to find
+   the file type
+
 2002-04-06  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
* lyxstring.C (operator>>): use the better solution, this fixes a
Index: src/support/filetools.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.113
diff -u -r1.113 filetools.C
--- src/support/filetools.C 6 Apr 2002 12:42:42 -   1.113
+++ src/support/filetools.C 6 Apr 2002 17:45:42 -
@@ -1018,6 +1018,12 @@
// Couldn't open file...
return string();
 
+   // get the filesize
+   ifs.seekg(0,ios::end);
+   int filesize = (int)ifs.tellg();
+   ifs.seekg(0,ios::beg);
+   lyxerr[Debug::GRAPHICS] << "filesize = " << filesize << endl;
+
// gnuzip
string const gzipStamp = "\037\213\010\010";
 
@@ -1041,8 +1047,11 @@
<< endl;
break;
}
-
-   ifs >> str;
+   int read_bytes = (filesize > bytes_to_read) ? bytes_to_read : filesize;
+   char char_array[read_bytes];
+   ifs.read(char_array, read_bytes);
+   string str(char_array, read_bytes);
+   filesize -= bytes_to_read;
lyxerr[Debug::GRAPHICS]
<< "Scanstring: " << str << endl;
string const stamp = str.substr(0,2);




Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Herbert Voss

Herbert Voss wrote:

> this seems easier to me ...
> do a mv ... /dev/null if it's nonsense


should not be the truth ... ;-)
here is the right one ..., sorry

Herbert



-- 
http://www.lyx.org/help/


Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.93
diff -u -r1.93 ChangeLog
--- src/support/ChangeLog   6 Apr 2002 13:01:03 -   1.93
+++ src/support/ChangeLog   6 Apr 2002 17:53:44 -
@@ -1,3 +1,8 @@
+2002-04-07  Herbert Voss  <[EMAIL PROTECTED]>
+
+   * filetools.C: (getExtFromContents) read less bytes to find
+   the file type
+
 2002-04-06  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
* lyxstring.C (operator>>): use the better solution, this fixes a
Index: src/support/filetools.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.113
diff -u -r1.113 filetools.C
--- src/support/filetools.C 6 Apr 2002 12:42:42 -   1.113
+++ src/support/filetools.C 6 Apr 2002 17:53:45 -
@@ -1013,11 +1013,18 @@
if (filename.empty() || !IsFileReadable(filename))
return string();
 
+   
ifstream ifs(filename.c_str());
if (!ifs)
// Couldn't open file...
return string();
 
+   // get the filesize
+   ifs.seekg(0,ios::end);
+   int filesize = (int)ifs.tellg();
+   ifs.seekg(0,ios::beg);
+   lyxerr[Debug::GRAPHICS] << "filesize = " << filesize << endl;
+   
// gnuzip
string const gzipStamp = "\037\213\010\010";
 
@@ -1032,6 +1039,7 @@
int count = 0;
 
string str, format;
+   int const bytes_to_read = 64;
bool firstLine = true;
while ((count++ < max_count) && format.empty()) {
if (ifs.eof()) {
@@ -1041,8 +1049,11 @@
<< endl;
break;
}
-
-   ifs >> str;
+   int read_bytes = (filesize > bytes_to_read) ? bytes_to_read : filesize;
+   char char_array[read_bytes];
+   ifs.read(char_array, read_bytes);
+   string str(char_array, read_bytes);
+   filesize -= bytes_to_read;
lyxerr[Debug::GRAPHICS]
<< "Scanstring: " << str << endl;
string const stamp = str.substr(0,2);



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss <[EMAIL PROTECTED]> writes:

| this seems easier to me ...
| do a mv ... /dev/null if it's nonsense

It does not look good...

| + // get the filesize
| + ifs.seekg(0,ios::end);
| + int filesize = (int)ifs.tellg();

(some istream::size_type would probably have been the correct type for
filesize)

| + ifs.seekg(0,ios::beg);

This is just do obfuscated for my liking.
and imho a simple stat does the work in a much more obvious way.

FileInfo fi(file);
off_t filesize = fi.getSize();

| + lyxerr[Debug::GRAPHICS] << "filesize = " << filesize << endl;
| +
|   // gnuzip
|   string const gzipStamp = "\037\213\010\010";
|  
| @@ -1041,8 +1047,11 @@
|   << endl;
|   break;
|   }
| -
| - ifs >> str;
| + int read_bytes = (filesize > bytes_to_read) ?
| bytes_to_read : filesize;

int read_bytes = min(filesize, bytes_to_read);

| + char char_array[read_bytes];
| + ifs.read(char_array, read_bytes);
| + string str(char_array, read_bytes);
| + filesize -= bytes_to_read;
|   lyxerr[Debug::GRAPHICS]
|   << "Scanstring: " << str << endl;
|   string const stamp = str.substr(0,2);

Anyway, this is not something that is important to change before
1.2.0. (IMHO)

-- 
Lgb



Re: [PATCH] Re: crash on inserted jpg-file

2002-04-06 Thread Lars Gullik Bjønnes

Herbert Voss <[EMAIL PROTECTED]> writes:

| Herbert Voss wrote:
>
>> this seems easier to me ...
>> do a mv ... /dev/null if it's nonsense
>
>
| should not be the truth ... ;-)
| here is the right one ..., sorry

And I'd really like to se a readsome variant as well, since that is
how we really want this done.

-- 
Lgb



crash on inserted jpg-file

2002-04-05 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-


The crash occurs with current 1.2cvs. Lyx was created with rpm -tb.
(Same crash with the 1.2pre1 version)
I tried to reproduce the crash with other jpg-files too, but failed.
Manually convert the file (via convert) to eps and use it works OK.
Compiling lyx with --enable-debug looks OK too.
The only backtrace I have is from the non-debug-version.

(gdb) info locals
No symbol table info available.

(gdb) bt
#0  0x402fd111 in chunk_alloc () from /lib/libc.so.6
#1  0x402fcf64 in malloc () from /lib/libc.so.6
#2  0x40240659 in __builtin_new () from /usr/lib/libstdc++-libc6.2-2.so.3
#3  0x40240840 in __builtin_vec_new () from /usr/lib/libstdc++-libc6.2-2.so.3
#4  0x0822da00 in lyxstring::Srep::Srep ()
#5  0x0822e2ce in lyxstring::lyxstring ()
#6  0x082313b5 in operator ()
#7  0x08228743 in getExtFromContents ()
#8  0x08229187 in zippedFile ()
#9  0x0821bee2 in grfx::GCacheItem::convertToDisplayFormat ()
#10 0x0821a86b in grfx::GCacheItem::startLoading ()
#11 0x08219beb in grfx::GCache::startLoading ()
#12 0x0815f1b1 in InsetGraphics::draw ()
#13 0x08103ae2 in LyXText::drawInset ()
#14 0x081043d4 in LyXText::draw ()
#15 0x0810eb34 in LyXText::paintRowText ()
#16 0x0810ecb7 in LyXText::getVisibleRow ()
#17 0x080f05e7 in LyXScreen::drawFromTo ()
#18 0x080f04c4 in LyXScreen::redraw ()
#19 0x080576ed in BufferView::Pimpl::workAreaExpose ()
#20 0x08235d94 in SigC::ObjectSlot0_void, BufferView::Pimpl::callback ()
#21 0x08233dce in SigC::Signal0void, SigC::Marshalvoid ::emit ()
#22 0x08087467 in WorkArea::work_area_handler ()
#23 0x08085f33 in C_WorkArea_work_area_handler ()
#24 0x40097226 in fl_handle_it () from /usr/X11R6/lib/libforms.so.0.89
#25 0x400972e5 in fl_handle_object () from /usr/X11R6/lib/libforms.so.0.89
#26 0x40096bbb in redraw_marked () from /usr/X11R6/lib/libforms.so.0.89
#27 0x40096ce1 in fl_redraw_object () from /usr/X11R6/lib/libforms.so.0.89
#28 0x080554d9 in BufferView::Pimpl::redraw ()
#29 0x08055b5c in BufferView::Pimpl::resizeCurrentBuffer ()
#30 0x08055248 in BufferView::Pimpl::buffer ()
#31 0x08050279 in BufferView::buffer ()
#32 0x080ce51f in LyXFunc::open ()
#33 0x080c9567 in LyXFunc::dispatch ()
#34 0x080c6951 in LyXFunc::verboseDispatch ()
#35 0x080c68de in LyXFunc::verboseDispatch ()
#36 0x081d3afd in Menubar::Pimpl::MenuCallback ()
#37 0x081ced06 in C_Menubar_Pimpl_MenuCallback ()
#38 0x4005964e in fl_object_qread () from /usr/X11R6/lib/libforms.so.0.89
#39 0x40069fc8 in fl_check_forms () from /usr/X11R6/lib/libforms.so.0.89
#40 0x081ce1d9 in GUIRunTime::runTime ()
#41 0x080bc044 in LyXGUI::runTime ()
#42 0x080bc738 in LyX::LyX ()
#43 0x080e43d1 in main ()
#44 0x402a67ee in __libc_start_main () from /lib/libc.so.6

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK3nv7ewfbDGmeqhAQFOXQP8DO2jopzrGbgl/Az6cH1DgPkQIOVO62f5
6+A6340GI5DJjOob6MXePdtReL5mPqkAMekZ5ew5To/m4N9ABt4qVQ3RO72BVzfN
7thmab8XepNqOt59SdXtHwmzvf0OsUJZIeukPMgrK0xO+6HDtyGWtNJTA9maWyU1
WjIb43rtemo=
=aJ0O
-END PGP SIGNATURE-


#LyX 1.2 created this file. For more info see http://www.lyx.org/
\lyxformat 220
\textclass article
\language ngerman
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard


\begin_inset Graphics FormatVersion 1
filename /usr2/kornel/jpg/shmoo.jpg
display color
size_type 1
width 10cm
keepAspectRatio
rotateOrigin center
lyxsize_type 1
lyxwidth 10cm

\end_inset 


\the_end

attachment: shmoo.jpg

Re: crash on inserted jpg-file

2002-04-05 Thread Lars Gullik Bjønnes

Kornel Benko [EMAIL PROTECTED] writes:

| The crash occurs with current 1.2cvs. Lyx was created with rpm -tb.
| (Same crash with the 1.2pre1 version)

I do not see this crash.

What version of xforms are you using?

-- 
Lgb



crash on inserted jpg-file

2002-04-05 Thread Kornel Benko

-BEGIN PGP SIGNED MESSAGE-


The crash occurs with current 1.2cvs. Lyx was created with "rpm -tb".
(Same crash with the 1.2pre1 version)
I tried to reproduce the crash with other jpg-files too, but failed.
Manually convert the file (via convert) to eps and use it works OK.
Compiling lyx with --enable-debug looks OK too.
The only backtrace I have is from the non-debug-version.

(gdb) info locals
No symbol table info available.

(gdb) bt
#0  0x402fd111 in chunk_alloc () from /lib/libc.so.6
#1  0x402fcf64 in malloc () from /lib/libc.so.6
#2  0x40240659 in __builtin_new () from /usr/lib/libstdc++-libc6.2-2.so.3
#3  0x40240840 in __builtin_vec_new () from /usr/lib/libstdc++-libc6.2-2.so.3
#4  0x0822da00 in lyxstring::Srep::Srep ()
#5  0x0822e2ce in lyxstring::lyxstring ()
#6  0x082313b5 in operator>> ()
#7  0x08228743 in getExtFromContents ()
#8  0x08229187 in zippedFile ()
#9  0x0821bee2 in grfx::GCacheItem::convertToDisplayFormat ()
#10 0x0821a86b in grfx::GCacheItem::startLoading ()
#11 0x08219beb in grfx::GCache::startLoading ()
#12 0x0815f1b1 in InsetGraphics::draw ()
#13 0x08103ae2 in LyXText::drawInset ()
#14 0x081043d4 in LyXText::draw ()
#15 0x0810eb34 in LyXText::paintRowText ()
#16 0x0810ecb7 in LyXText::getVisibleRow ()
#17 0x080f05e7 in LyXScreen::drawFromTo ()
#18 0x080f04c4 in LyXScreen::redraw ()
#19 0x080576ed in BufferView::Pimpl::workAreaExpose ()
#20 0x08235d94 in SigC::ObjectSlot0_::callback ()
#21 0x08233dce in SigC::Signal0::emit ()
#22 0x08087467 in WorkArea::work_area_handler ()
#23 0x08085f33 in C_WorkArea_work_area_handler ()
#24 0x40097226 in fl_handle_it () from /usr/X11R6/lib/libforms.so.0.89
#25 0x400972e5 in fl_handle_object () from /usr/X11R6/lib/libforms.so.0.89
#26 0x40096bbb in redraw_marked () from /usr/X11R6/lib/libforms.so.0.89
#27 0x40096ce1 in fl_redraw_object () from /usr/X11R6/lib/libforms.so.0.89
#28 0x080554d9 in BufferView::Pimpl::redraw ()
#29 0x08055b5c in BufferView::Pimpl::resizeCurrentBuffer ()
#30 0x08055248 in BufferView::Pimpl::buffer ()
#31 0x08050279 in BufferView::buffer ()
#32 0x080ce51f in LyXFunc::open ()
#33 0x080c9567 in LyXFunc::dispatch ()
#34 0x080c6951 in LyXFunc::verboseDispatch ()
#35 0x080c68de in LyXFunc::verboseDispatch ()
#36 0x081d3afd in Menubar::Pimpl::MenuCallback ()
#37 0x081ced06 in C_Menubar_Pimpl_MenuCallback ()
#38 0x4005964e in fl_object_qread () from /usr/X11R6/lib/libforms.so.0.89
#39 0x40069fc8 in fl_check_forms () from /usr/X11R6/lib/libforms.so.0.89
#40 0x081ce1d9 in GUIRunTime::runTime ()
#41 0x080bc044 in LyXGUI::runTime ()
#42 0x080bc738 in LyX::LyX ()
#43 0x080e43d1 in main ()
#44 0x402a67ee in __libc_start_main () from /lib/libc.so.6

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPK3nv7ewfbDGmeqhAQFOXQP8DO2jopzrGbgl/Az6cH1DgPkQIOVO62f5
6+A6340GI5DJjOob6MXePdtReL5mPqkAMekZ5ew5To/m4N9ABt4qVQ3RO72BVzfN
7thmab8XepNqOt59SdXtHwmzvf0OsUJZIeukPMgrK0xO+6HDtyGWtNJTA9maWyU1
WjIb43rtemo=
=aJ0O
-END PGP SIGNATURE-


#LyX 1.2 created this file. For more info see http://www.lyx.org/
\lyxformat 220
\textclass article
\language ngerman
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard


\begin_inset Graphics FormatVersion 1
filename /usr2/kornel/jpg/shmoo.jpg
display color
size_type 1
width 10cm
keepAspectRatio
rotateOrigin center
lyxsize_type 1
lyxwidth 10cm

\end_inset 


\the_end

<>

Re: crash on inserted jpg-file

2002-04-05 Thread Lars Gullik Bjønnes

Kornel Benko <[EMAIL PROTECTED]> writes:

| The crash occurs with current 1.2cvs. Lyx was created with "rpm -tb".
| (Same crash with the 1.2pre1 version)

I do not see this crash.

What version of xforms are you using?

-- 
Lgb