3

I keep most of my home directory's dot files under revision control, so that I can easily move changes between any of the five or so desktop machines and dozens of servers that I use. Unfortunately, my ~/.gconf directory is a bit of a pain when it comes to this, because gconfd seems to really like making arbitrary whitespace changes and, worse yet, updating the mtime="..." attributes on entries that it hasn't changed.

Has anybody any thoughts on good ways to deal with this? I would prefer never to have to commit whitespace changes or time changes when a value hasn't changed, so that I can easily track my diffs over time.

cjs
  • 1,385
  • 1
  • 12
  • 23
  • gconf is a big FAIL, IMHO. – hayalci Jul 17 '09 at 19:58
  • GConf had such promise back in '02 when I first read about it... With talk of LDAP back-ends (visions of "roaming user profiles" like Windows but w/o all the suck), and a chance to do a centralized configuration repository (dare I say a "registry") that wouldn't have all the suckiness associated with the Windows registry. I've lost track of desktop Linux in the intervening years (focusing instead on servers and embedded platforms), but it looks like GConf ended up going nowhere... That's too bad. – Evan Anderson Jul 17 '09 at 22:55

2 Answers2

3

Instead of storing the directory in git, did you try to store a dump?

 gconftool-2 --dump /
ko-dos
  • 1,369
  • 8
  • 10
  • So this removes mtime. Does it always sort in the same order? Is the whitespace always consistent? – cjs Jul 22 '09 at 03:25
  • One thing this does do appears to be to include all default values. For example, I have no .gconf/apps/gnome-volume-control directory, yet settings for that come out in the dump (and in the "-R /" listing as well). Presumably this means that if I save this, I then override any future changes to the default settings. – cjs Jul 22 '09 at 03:33
2

I currently examine only the real differences by using a diff program that ignores the mtime and whitespace changes:

#!/usr/bin/env ruby

require 'tempfile'

input2 = ARGV.pop || (
    $stderr.puts("Usage: gconf-diff [opts] <file> <file>")
    exit(1)
)
input1 = ARGV.pop

UNWANTED_PAT = /mtime="\d+"/

def copy_tmp(id, path)
    t = Tempfile.new("gconf-diff-#{id}-")
    File.open(path).each { |line| t.write(line.gsub(UNWANTED_PAT, '')) }
    t.close
    t
end
t1 = copy_tmp('1', input1)
t2 = copy_tmp('2', input2)

system('diff', *(ARGV + ['-B', '-b', t1.path, t2.path]))
exit($?.exitstatus)

I have subversion use this by running svn diff --diff-cmd gconf-diff .... I revert files that have no significant changes. However, this is a bit awkward, and doesn't deal well with files where only one or two items have changed, but a dozen others have new timestamps, as all of those changes are still committed.

cjs
  • 1,385
  • 1
  • 12
  • 23