gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Corrupt database


From: Busser, Jim
Subject: Re: [Gnumed-devel] Corrupt database
Date: Fri, 31 May 2013 03:49:12 +0000

On 2013-05-30, at 9:57 AM, Vaibhav Banait <address@hidden> wrote:

> 4. How can I check a database integrity

The following will tell you whether the database schema has been altered by 
someone, adapted and updated from

        http://lists.gnu.org/archive/html/gnumed-devel/2011-10/msg00144.html

which described how, from inside your downloaded server directory, which in my 
case is

        ~/Downloads/gnumed-server.18.4/server

you can run

        ./gm-fingerprint_db.py <database> <gm-dbo-password>

For example, for the current-versioned database which is version 18:

        ./gm-fingerprint_db.py gnumed_v18 foo 

This will generate, in the directory from which it was run, a file (previously 
named fingerprint.log) now named

        gm_db-gnumed_v18-fingerprint.log

whose initial 4 lines should be the same as the reference fingerprint 
now-included in the server downloads, see 

        
~/Downloads/gnumed-server.18.4/server/sql/v17-v18/gm_db-gnumed_v18-fingerprint.txt

which you can test under the POSIX 'diff' command whether they are

        -s identical
        -y Output in two columns. 

as shown here

        diff -s <(head −n 4 file1) <(head −n 4 file2)

or, in this case,

        diff -s <(head -n 4 
~/Downloads/gnumed-server.18.4/server/gm_db-gnumed_v18-fingerprint.log) <(head 
-n 4 
~/Downloads/gnumed-server.18.4/server/sql/v17-v18/gm_db-gnumed_v18-fingerprint.txt)

where -s yields

        Files /dev/fd/63 and /dev/fd/62 are identical

and -y yields

        Fingerprinting GNUmed database …                                        
Fingerprinting GNUmed database … 
        Name: gnumed_v18                                                        
                Name: gnumed_v18
        Schema hash: a0f9efcabdecfb4ddb6d8c0b69c02092   Schema hash: 
a0f9efcabdecfb4ddb6d8c0b69c02092 

        
NOTE: Windows does not possess the 'diff' command. The Windows FC command does 
not seem suitable and diffutils remains compatible with Windows 8 but maybe 
Winmerge could be suitable?

        http://www.majorgeeks.com/files/details/winmerge.html
        http://download.cnet.com/WinMerge/3000-2079_4-10386887.html
        http://winmerge.org

-- Jim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]