Re: [patch] Re: More patches soon ...

Dmitry Nikitin <[email protected]> Mon, 07 Mar 2011 19:57:09 +0300
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
Hi!

> Attached is a patch. Does it help?
> 

Probe the patch "g_warning.diff", but have'nt success, give next errors:  
$ make
....
gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -pthread -DORBIT2=1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libglade-2.0 -I/usr/include/libxml2 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-
 1.0   -DDATADIR="\"/usr/local/share\"" -DGMDB_ICONDIR="\"/usr/local/share/gmdb/glade/\"" -DGMDB_GLADEDIR="\"/usr/local/share/gmdb/glade/\""    -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -MT table_export.o -MD -MP -MF .deps/table_export.Tpo -c -o table_export.o table_export.c
table_export.c: In function ‘gmdb_table_export_button_cb’:
table_export.c:198: error: format not a string literal and no format arguments
table_export.c:204: error: format not a string literal and no format arguments
table_export.c:209: error: format not a string literal and no format arguments
table_export.c:214: error: format not a string literal and no format arguments
make[3]: *** [table_export.o] Error 1
make[3]: Залишаю каталог "/home/luckas/SVN/MDB/mdbtools.git/src/gmdb2"

list of errors lines:
[luckas@wind gmdb2]$ cat -n table_export.c|grep 198
   198                          if (i>0) fprintf(outfile,delimiter);
[luckas@wind gmdb2]$ cat -n table_export.c|grep 204
   204          if (need_headers) fprintf(outfile,lineterm);
[luckas@wind gmdb2]$ cat -n table_export.c|grep 209
   209                          if (i>0) fprintf(outfile,delimiter);
[luckas@wind gmdb2]$ cat -n table_export.c|grep 214
   214                  fprintf(outfile,lineterm);

Previous warnings also presented.

The odbc patch worked also without  CFLAGS="-Werror=format-security"
But with in - give error:
gcc -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -I. -I../../include  -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include     -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT mdb-export.o -MD -MP -MF .deps/mdb-export.Tpo -c -o mdb-export.o mdb-export.c
mdb-export.c: In function ‘main’:
mdb-export.c:208: error: format not a string literal and no format arguments
make[2]: *** [mdb-export.o] Error 1

Others warnings add in the attched file...

> I don't have a git repository. Brian Burns is the author.
> The latest repository is located at https://github.com/brianb/mdbtools.git

Sorry :) - for Brian. 

> > But when I would build the RPM package for my distr (Mandriva 2010), the
> build CFLAGS of:
> > CFLAGS="-O2 -g -pipe -Wformat -Werror=format-security
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL"
> > give the errors in sources:
> > main2.c: In function ‘gmdb_about_cb’:
> > main2.c:75: warning: passing argument 1 of ‘gtk_show_about_dialog’ from
> incompatible pointer type
> > /usr/include/gtk-2.0/gtk/gtkaboutdialog.h:67: note: expected ‘struct
> GtkWindow *’ but argument is of type ‘struct GtkWidget *’
> > main2.c: In function ‘gmdb_help_cb’:
> > main2.c:105: error: format not a string literal and no format arguments
> > make[3]: *** [main2.o] Error 1
> > 
> > This errors take the CFLAGS="-Werror=format-security", without this flags
> compiled as is.
> 
> I think it's not the proper way to fix that. It's a very interresting
> warning/error message my compiler doesn't show. A pity.
> 
> I think it's the same problem than using "printf(message)" when you have no
> idea whether the message might contain "%".
> 
> You should use puts(message) or printf("%s", message) in these cases.
> 
> > Also give errors in build mdbtools with unixODBC:
> > My configurations:
> > Mandriva 2010.0, x86_64, mdbtools-git-2011-02-28,
> lib64gtk+2.0_0-devel-2.18.9-1.2mdv2010.0.x86_64,
> lib64unixODBC-devel-2.2.14-8mdv2010.0.x86_64

> > Also I would like propouse a some thinks:
> > 1) need to fix maximum varchar (255) for mysql
> 
> I read limit is 65535 since mysql 5.0.3.
> http://dev.mysql.com/doc/refman/5.0/en/char.html

Oh, yes!  But I think it will be better for compatibillity (max 510 for MSAccess- max 255 utf8 for mysql), 
And somebody have old comp's whit old mysql.  

> > 2) need to fix the procedure of sanitize (-S) the dump of MDB files. You
> already changes dates to utf-8 codepage, and the more "dummy"
> > MS windows users and "admins" used the non ASCII symbols for names of tables
> and columns in the MDB-files, like as cyrilic :(
> > May be the procedure of sanitize can replace the symbols in names as
> transliterate (need check the match of names and length?)
> > Now, the replaced only spaces in names as "_", and .... the other
> non-english symbols taking "____________________________" as name of table.

> Sanitize is really buggy.
> I would recommand removing it from the code.
> All backends should now handle the non ascii characters in table/colum names
> correctly, quoting them.
> Do you really need -S?

I think- Yes, "-S" its good idea for package!!! (non-ASCII symbols in variables, names of tables and other is bad practise in developing.
  
> If using Jet3, don't forget to set MDB_JET3_CHARSET as described in mdb-schema
> manual and HACKING file.

I tested JET4 file with ciryllic symbols, spaces, " ' " and others :((( in names of tables, fields.

Good Luck, Dmitry

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d

_______________________________________________
mdbtools-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mdbtools-dev
make-error.log (application/octet-stream, 6.7 KB)
=================================================================== 
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/local/include -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT connectparams.lo -MD -MP -MF .deps/connectparams.Tpo -c connectparams.c  -fPIC -DPIC -o .libs/connectparams.o 
connectparams.c: In function ‘visit’: 
connectparams.c:470: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘gpointer’ 
connectparams.c:470: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘gpointer’ 
 
===================== 
gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -I/usr/local/include   -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT unittest.o -MD -MP -MF .deps/unittest.Tpo -c -o unittest.o unittest.c 
unittest.c: In function ‘main’: 
unittest.c:198: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘SQLINTEGER’ 
mv -f .deps/unittest.Tpo .deps/unittest.Po 
==================== 
gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -I/usr/local/include   -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT unittest.o -MD -MP -MF .deps/unittest.Tpo -c -o unittest.o unittest.c 
unittest.c: In function ‘main’: 
unittest.c:198: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘SQLINTEGER’ 
===================== 
gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -pthread -DORBIT2=1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libglade-2.0 -I/usr/include/libxml2 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-1.0   -DDATADIR="\"/usr/local/share\"" -DGMDB_ICONDIR="\"/usr/local/share/gmdb/glade/\"" -DGMDB_GLADEDIR="\"/usr/local/share/gmdb/glade/\""    -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT debug.o -MD -MP -MF .deps/debug.Tpo -c -o debug.o debug.c 
debug.c: In function ‘gmdb_debug_dissect_index2’: 
debug.c:488: warning: missing sentinel in function call 
debug.c: In function ‘gmdb_debug_add_page_ptr’: 
debug.c:506: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘guint32’ 
debug.c: In function ‘gmdb_debug_init’: 
debug.c:1081: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’ 
======================= 
gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -pthread -DORBIT2=1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libglade-2.0 -I/usr/include/libxml2 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-1.0   -DDATADIR="\"/usr/local/share\"" -DGMDB_ICONDIR="\"/usr/local/share/gmdb/glade/\"" -DGMDB_GLADEDIR="\"/usr/local/share/gmdb/glade/\""    -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT sql.o -MD -MP -MF .deps/sql.Tpo -c -o sql.o sql.c 
sql.c: In function ‘gmdb_sql_write_rslt_cb’: 
sql.c:83: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘struct GladeXML *’ 
sql.c:107: error: format not a string literal and no format arguments 
sql.c:117: error: format not a string literal and no format arguments 
sql.c:129: error: format not a string literal and no format arguments 
sql.c:138: error: format not a string literal and no format arguments 
sql.c: In function ‘gmdb_sql_execute_cb’: 
sql.c:436: warning: passing argument 5 of ‘gtk_message_dialog_new’ makes pointer from integer without a cast 
/usr/include/gtk-2.0/gtk/gtkmessagedialog.h:82: note: expected ‘const gchar *’ but argument is of type ‘int’ 
sql.c:436: error: format not a string literal and no format arguments 
make[3]: [sql.o] Error 1 (ignored) 
====================== 
gcc -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -I. -I../../include  -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include     -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT mdb-sql.o -MD -MP -MF .deps/mdb-sql.Tpo -c -o mdb-sql.o mdb-sql.c 
mdb-sql.c: In function ‘dump_results’: 
mdb-sql.c:286: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘void *’ 
mdb-sql.c:289: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘void *’ 
========================= 
gcc -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -I. -I../../include  -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include     -O2 -g -pipe -Wformat -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT mdb-import.o -MD -MP -MF .deps/mdb-import.Tpo -c -o mdb-import.o mdb-import.c 
mdb-import.c: In function ‘main’: 
mdb-import.c:214: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result