Nov 282009
 

Version 0.4, released 2009-11-27: http://dsp.mcbf.net/checkcopy/checkcopy-0.4.tar.bz2

Checkcopy is a copy program which computes checksums on the fly to verify them
and/or write them out to disk.

This program will copy one or more files / directories to a destination,
and compute its checksum on the fly. If checksum files are getting copied
over, their contents are parsed and compared to the computed checksums. If no
checksum was found for a file, then the computed one is written to disk.

So in the end at the destination every file has a checksum stored on disk, and all files which already had a checksum are verified.

Checkcopy uses GIO, and as such operates on local and remote files /
destinations.

Known Issues

W A R N I N G:
Similarly to how `cp’ works, checkcopy currently overwrites destination
files without warning!

Usage

1. The source files / directories have to be specified on the command line.
So running just “checkcopy” is not going to get you anywhere. See TODO.

2. The destination is can be predetermined, preselected, or simply selected.
a. If a destination was specified by the -d switch, then the user
will not get asked.
b. If a default destination was specified by the -D switch, then a file
chooser will get displayed, starting at the specified URI.
c. Otherwise, a file chooser will be shown with the current directory as the
starting location.

This should allow easy bindings in file managers.

Before the files are being copied, they are scanned for checksum files.
Currently only files ending in .md5, .sha, .sha1 and CHECKSUM are detected as
containing checksums. Its contents are then parsed, and remembered.

While the files are copied, the checksum is created. If a checksum is on file,
it will get compared. If no checksum was previously discovered, the computed
one is written to disk as /foo/bar/${DESTINATION}/${DESTINATION}.CHECKSUM
(currently always as sha1).

Requirements

checkcopy requires the following libraries to be installed:

  • gtk+ toolkit:
    Checkcopy was tested with gtk 2.18.3, but gtk 2.16 would probably suffice.
  • gio:
    All file operations are based on GIO functions.
  • libxfce4util:
    Required for some utility functions.

Development

The development code can be found at http://github.com/squisher/checkcopy/

Feedback

Please check the TODO file for the current plan for checkcopy.

All comments, feedback, and bug reports are very welcome! Please email the
author at david@mcbf.net .

Nov 282009
 

Version 0.1, released 2008-07-20
This program is deprecated. Please now use checkcopy, which has more functionality and is more reliable.

This program will copy one or more files / directories to a destination,
and compute an md5 checksum on the fly. Currently the .md5 files are generated
per directory.

Usage

The source files / directories have to be specified on the command line. Then
a dialog will pop up asking you for the destination, unless it was also
specified on the command line (-d switch).

This should allow easy bindings in file managers.

W A R N I N G

  Similarly to how `cp' works, md5copy currently overwrites destination
  files without warning!

The checksum will be saved in one .md5 file per directory. So if you have a
layout like:

a/
  sub1/
    (some files)
  sub2/
    (some files)

you would end up with the following checksum files:

  • a/sub1/sub1.md5
  • a/sub2/sub2.md5

Note that there is no a/a.md5, because there were no files (just directories)
inside of a/.

I recommend the program cfv to verify files. cfv has the ‘-r’ switch, which
allows you to verify a whole directory structure copied with md5copy.

Internals

At the moment md5copy is slightly unoptimized to copy a large number of small files, since the total size of the copy operation is calculated first.

The mhash library is used to compute the checksum. This should make md5copy pretty reliable, and at no point in testing there was ever an incorrect checksum.

md5copy should be pretty fast. The reading part was inspired by GNU coreutil’s md5sum. GUI, copy and hashing are all run in separate threads, so the hashing should not slow down the copying (although this statement has not benchmarked very well).

Requirements

md5copy requires the following libraries to be installed:

  • gtk+ toolkit:
    it was tested with gtk 2.12.11, but probably gtk 2.10 would suffice
  • mhash library:
    it was tested with 0.9.9 (libmhash2 in Debian)

the manpage refers to 0.9.2, so I assume that’s the minimum required

Feedback / Bugs

I’m interested in feedback! Did it work fast? Could you tune something in settings.h? Did you find a bug? Let me know by sending an email to david at x.mcbf.net (remove the x. to get a valid email address)

Download

Sep 302009
 

Setup

”’Note that I’m not a kerberos expert by any means. These short instructions got puzzled together from some tutorials, and they work for me. It’s likely I forgot something too, so YMMV”’

1. Initialize the kdc database. On debian this is done through debconf at package install time. Take the rest of the initial setup of /etc/krb5.conf and /etc/krb5kdc/kadm.acl etc from the first link of the resources.
1. Add an admin account.

 
kadmin.local -q "addprinc root/admin"

1. Add an account for the machine

kadmin.local -q "addprinc -randkey host/foo.bar"

1. For every client, on the server
1. Add a machine account

kadmin -q "addprinc -randkey host/client.bar"

1. Add a nfs account

kadmin -q "addprinc -randkey nfs/client.bar"

1. On every client add the keys generated on the server to the tab

kadmin -q "ktadd host/client.bar"
kadmin -q "ktadd -e des-cbc-crc:normal nfs/client.bar"

Notes

  • In debian, edit /etc/default/nfs-common and nfs-kernel-server to make sure that statd is not running, and that idmap and the gss services are started.
  • Make sure that the fqdn of the server doesn’t resolve to 127.0.0.1 through /etc/hosts – it will break kadmin
  • Edit /etc/idmap.confand change
    
    

[General] Domain = your.domain

Otherwise you will get errors like ”rpc.svcgssd[5054]: WARNING: get_ids: failed to map name ‘nfs/alucardo.nd.mcbf.net@ND.MCBF.NET’ to uid/gid: Invalid argument” in syslog.

  • hostname –fqdn really does need to return the full-qualified domain name. Often it does not, because many people set up /etc/hostsso that the unqualified domain name comes before the full qualified one. A correct setup is:
    
    

10.0.0.1 foo.bar foo

A wrong setup will cause errors like

Aug 23 20:47:19 tor rpc.svcgssd[4738]: ERROR: GSS-API: error in gss_acquire_cred(): Unspecified GSS failure.  Minor code may provide more information - No principal in keytab matches desired name 
Aug 23 20:47:19 tor rpc.svcgssd[4738]: Unable to obtain credentials for 'nfs' 
Aug 23 20:47:19 tor rpc.svcgssd[4738]: unable to obtain root (machine) credentials 
Aug 23 20:47:19 tor rpc.svcgssd[4738]: do you have a keytab entry for nfs/@ in /etc/krb5.keytab?
  • Clocks must be synchronized (ntp is sufficient), or you will get strange errors. I.e. an gss error where the major code is Unknown Error and the minor code is unknown as well.

Resources

Additional pages not really used:

Jun 042009
 

I adapted a little program to help with a dual monitor setup and two separate X screens. It allows you to configure the X screens to be apart (so that you can play games without having the mouse cross over), but still have the convenience of a crossing cursor when needed.

For a little more detail see http://gentoo-wiki.com/HOWTO_Dual_Monitors#Switchscreen.

Releases

  • Deprecated Warning: This utility will now be developed as part of DualscreenMouseUtils. Check there for the newest release.
  • Bugfix: place cursor on the correct x coordinate after switching screens2008-08-15 : Download v0.3b
  • Bugfix: screens can now have different resolutions.2008-08-13 : Download v0.3
  • Small update: detect current screen reliably, option to specify the relation of the two screens.Download v0.2
May 282009
 

My card uses the saa7134 driver. lspci output:

00:0a.0 Multimedia controller: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast Decoder (rev d1)
	Subsystem: Micro-Star International Co., Ltd. TV@nywhere Plus

It seems in 2.6 kernels with this driver the remote should just register as a keyboard, you can check in /proc/bus/input/devices if it shows up. Mine did not out of the box on debian testing with a 2.6.26 kernel.

With 2.6.29 a patch (http://marc.info/?l=linux-video&m=122086916009931&w=2) is integrated which does make the remote show up as a keyboard input. Using it then with lirc requires a special config file: http://linux.bytesex.org/v4l2/faq.html#lircd , which seems to be the same essentially as http://www.lemis.com/grog/programs/multimedia/TVatnywhere. I ended up using the former. It does work fine now, aside from two buttons which are switched somehow, which is not a big deal to me.

The remaining step is to setup an ~/.lircrc. Information on this is surprisingly sparse, so I’ll post my version shortly.

Jun 172008
 

Last updated: 2008-06-17

Trying to do play around with some static analysis? Here a review of software that helps to create an abstract syntax tree for C:

  • styx, a scanner and parser software that says it is easier to use than lex/yacc (with some small limitations). It is supposed to automatically generate an abstract syntax tree.
    Problem: I was unable to find any grammars for it except the ones on the download page (they do have a grammar for php there), and the documentation about writing one is not really complete.
  • elsa/elkhound, generates an abstract syntax tree for C++, but lacks documentation for how to write a context sensitive analysis that can process the tree. It is complicated without documentation, because meta programming is used for the ast.
  • olmar is an ocaml wrapper for elsa and adds a nice program to generate graphs of the AST. This would be my option if I had been able to use ocaml.
  • Open C++ core, the core of the Open C++ project, which introduces aspect oriented / meta object programming to C++. Almost no documentation exists though.
  • oink is a Collaboration of C++ Static Analysis Tools, which sounds like a nice middle-ware (it uses elsa as a backend). It lists as one of its goals extensible for ease in adding backends, yet I could not find much information about how to actually do that.

elsa seems to be the standard tool for the task, but understanding its internals was too complicated for my small project, so I ended up printing the AST as XML and reading that back in from my program.

Jun 142008
 

Are you trying to boot Windows from a second hard drive, but it just hangs and nothing happens?

Windows apparently only really supports booting from the first hard drive, but grub can trick Windows by remapping drives:

title Windows
        rootnoverify (hd1,0)
        map (hd0) (hd1)
        map (hd1) (hd0)
        chainloader +1

Source: http://www.weiqigao.com/blog/2004/01/14/windows_on_the_second_hard_drive_linux_on_the_first.html