Notes: March 2008 Archives

« February 2008 | Main | April 2008 »

March 28, 2008

snmpd interface name length bug

I found a string handling bug in snmpd when parsing v6 interfaces on linux.

While reading /proc/net/if_inet6 net-snmp uses:

rc = sscanf(line, "%39s %02x %02x %02x %02x %8s\n",
addr, &if_index, &pfx_len, &scope, &flags, if_name);

to read the input, but on linux interfaces can currently be up to 16 characters in length.

The result of which was errors like:

Feb 27 22:45:09 rosa snmpd[6082]: ioctl 35123 returned -1

many times in logs.

I have reported this bug towards upstream via the debian bug tracking system at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468260

Patch is at: http://hachi.kuiki.net/bug_reports/snmpd.patch

March 19, 2008

Git on OSX 10.4.1 with Bus Error

compiler flags -O2 on OSX 10.4.1
bus error on clone, something about git-update-ref
dropping to -O1 makes it go away


$ gcc -v
Reading specs from /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/specs
Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)


$ cat iter.sh
#!/bin/sh

set -e
set -x

make prefix=/Users/hachi clean all
cd t
make t1400-update-ref.sh

$ git checkout master
$ git pull
$ git bisect start
$ git bisect bad
$ git checkout v1.5.3
$ git bisect good
$ git bisect run ./iter.sh
... lots of output
c43a24834a9babd3ddd9c27ccc81174c2cb36859 is first bad commit
commit c43a24834a9babd3ddd9c27ccc81174c2cb36859
Author: Pierre Habouzit
Date: Fri Dec 21 11:41:41 2007 +0100

Force the sticked form for options with optional arguments.

This forbids "git tag -n -l" we allowed earlier, so
adjust t7004 while at it.

Signed-off-by: Pierre Habouzit

:100644 100644 e12b428c0a76a635041f678a3eaf05300d780061 7a08a0c64f9f447e09ef6771d83dbf95f8f3545d M parse-options.c
:040000 040000 97d205cf36b2a3f2521726b510fb37096b60e5dc fcd2f25cef31e362d755a91c5f5dc181169ce5ff M t
bisect run success

March 18, 2008

Merging in Git

The problem


I have a git repo with a directory structure that looks like:


/code/conf/*
/code/src/*
/code/modules/*

The commit history of this part is uninteresting...

master <---- HEAD
... 20 revisions
(unnamed) <---- initial commit
And a remote repo to mine with a directory structure that looks like:


/conf/*
/src/*
/modules/*

Now, the revision history of this second one is barely interesting:

remotes/floot/master <----- HEAD
... 10 revisions
remotes/floot/alpha <---- arbitrary branch ref
... 130 or so revisions
remotes/floot/release-1-2-1 <---- nearest point to 'merge' from
... some uncounted number of commits
(unnamed) <---- initial commit


Now, the initial commit on master, and remotes/floot/release-1-2-1 are still about 2000 lines in difference.

My goal is to make these two histories join together.

I would like to try and make git resolve as much as it can for me and present me with what I need to merge manually as a set of (or a single) conflict.

OR I'm happy to hear a different method that may be the correct action for me... but I'm not used to merging in any way other than 'manually'. So I'm not sure how much git can help me.

First attempt


I have attempted to cherry-pick revisions from remotes/floot/release-1-2-1..remotes/floot/alpha and try to merge things as necessary to bring the two histories together into a merge. This approach appears to work, but I burn out after about 25 merges... unable to keep my brain straight about what I need to keep track of.


Second attempt


I have attempted to do the 'subtree merge strategy'


$ git remote add -f floot /path/to/floot
$ git merge -s ours --no-commit floot/alpha
Automatic merge went well; stopped before committing as requested
$ git read-tree --prefix=code/ -u floot/alpha
fatal: subdirectory 'code/' already exists.

Third attempt



hachi@miyako:~/devel/purl$ git filter-branch --index-filter 'git ls-files -s | sed "s-\tcode/-\t-" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' master
Rewrite 29d15946542ef58088cf09be7c9fc16ee4dccfce (1/7)mv: cannot stat `/home/hachi/devel/purl/.git-rewrite/t/../index.new': No such file or directory
index filter failed: git ls-files -s | sed "s-\tcode/-\t-" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE