Padraig O'Sullivan wrote:
On Sun, Feb 1, 2009 at 1:36 PM, Philip Herron <[email protected] <mailto:[email protected]>> wrote:

    Kristian Nielsen wrote:

        Philip Herron <[email protected]
        <mailto:[email protected]>> writes:

                @@ -149,11 +149,11 @@
                while (1)
                {
                off_t length;
                - char *buffer= NULL;
                + char *buffer=(char*)malloc(sizeof(char));
                char *temp_buffer;

                /* Read the size */
                - if (read(file, &length, sizeof(uint64_t)) !=
                sizeof(uint64_t))
                + if (read(file, &length, sizeof(uint32_t)) !=
                sizeof(uint32_t))
                break;

                temp_buffer= (char *)realloc(buffer, length);

            I guess its because the length is off_t which is just:
            typedef long off_t
            so its still 32bit and therefore too small to read a 64bit
            int into or
            something along those lines.

        Well, long is 32 bit on 32-bit Linux, but 64 bit on 64-bit
        linux. So this is
        going to fail on 64-bit (big-endian for sure, and probably also
        little-endian).

        And surely the actual size of the number to read depends not
        on whatever
        sizeof(off_t) is, but on what is actually in the file being
        read? So why not
        read the value into a tmp variable of correct size (uint32_t
        or uint64_t
        depending on file format), and afterwards assign to length
        (checking for
        overflow if needed)?

        Hope this helps,

         - Kristian.
    Hey

    Ah yeah that makes more sense, i guess that would be a better
    idea! Read to figure out what 'endian' were in and read for that!

    Hmm.. even with that i am still having problems running drizzled
    with the error's i posted before!

    -Phil


Looking at the revision history for that file, I can see that the offending lines used to be:

uint64_t length;
char *buffer= NULL;
char *temp_buffer;
/* Read the size */
if (read(file, &length, sizeof(uint64_t)) != sizeof(uint64_t))

You are getting the compilation error since length was changed from being of type uint64_t to being of type off_t and you are compiling on a 32-bit platform. I believe that the fix for this should be:

off_t length;
char *buffer= NULL;
char *temp_buffer;
/* Read the size */
if (read(file, &length, sizeof(off_t)) != sizeof(off_t))

This should then compile cleanly. Does that sound about right?


    _______________________________________________
    Mailing list: https://launchpad.net/~drizzle-discuss
    <https://launchpad.net/%7Edrizzle-discuss>
    Post to     : [email protected]
    <mailto:[email protected]>
    Unsubscribe : https://launchpad.net/~drizzle-discuss
    <https://launchpad.net/%7Edrizzle-discuss>
    More help   : https://help.launchpad.net/ListHelp


Hey

Yeah that sounds right to me, because if your on big endian or 64bit it should be a similar result. But i am having the problem of:

redbr...@silix ~/workspace/drizzle/drizzle-bug311013/tests $ ./dtr --start-and-exit
Logging: ./dtr --start-and-exit
Changed limits: max_open_files: 1024 max_connections: 886 table_cache: 64InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
090201  1:12:17  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
090201 1:12:17 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
090201 1:12:17 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
090201  1:12:18 InnoDB Plugin 1.0.2 started; log sequence number 0
Entering pool shutdown
090201  1:12:18  InnoDB: Starting shutdown...
090201  1:12:19  InnoDB: Shutdown completed; log sequence number 46409
Plugin 'MyISAM' has ref_count=1 after deinitialization.MySQL Version 7.0.0
Using MTR_BUILD_THREAD      = -69.4
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
=======================================================
DEFAULT STORAGE ENGINE: innodb
TEST                           RESULT         TIME (ms)
-------------------------------------------------------

mysql-test-run: WARNING: Process 3727 died
main.1st                       [ fail ]

ERROR: Failed to start master mysqld 0

Aborting: main.1st failed in default mode.
To continue, re-run with '--force'.
Stopping All Servers
mysql-test-run: WARNING: caught exit of unknown child -1
mysql-test-run: WARNING: Forcing kill of process 3727
=============

If i do:
~/usr/local/drizzle-bug311013/sbin $ ./drizzled
Changed limits: max_open_files: 1024 max_connections: 886 table_cache: 64090201 1:13:34 InnoDB: highest supported file format is Barracuda.
090201  1:13:34 InnoDB Plugin 1.0.2 started; log sequence number 46429
Can't create IP socket: Address family not supported by protocolAborting
Entering pool shutdown
090201  1:13:34  InnoDB: Starting shutdown...
090201  1:13:35  InnoDB: Shutdown completed; log sequence number 46439
Plugin 'InnoDB' has ref_count=1 after deinitialization../drizzled: Shutdown complete

So you notice i get "Can't create IP socket: Address family not supported by protocolAborting"

I got this when i run: ./dtr --start-and-exit --gdb
So yeah not sure if i have done something really bad trying to figure out where to start to debug this.

Anyways yeah.. maby i have done something stupid so i have cleaned all my branches and recreating, just to make sure!

-Phil
http://redbrain.co.uk

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to