{"thread":{"id":"10208","subject":"possible bug in using local branches","startedAt":"2007-10-09T10:11:47Z","lastAt":"2007-10-09T11:07:08Z","messageCount":3,"participants":["Natanael Copa","Frank Lichtenheld"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"55248","messageId":"1191924707.10822.94.camel@nc.nor.wtbts.org","threadId":"10208","inReplyTo":null,"subject":"possible bug in using local branches","fromName":"Natanael Copa","fromEmail":"natanael.copa@gmail.com","sentAt":"2007-10-09T10:11:47Z","receivedAt":"2007-10-09T10:11:47Z","isPatch":false,"sender":{"key":"natanael.copa@gmail.com","avatar":null},"body":"Hi,\n\nI think I might have found a bug in git, but I'm not sure if I am\nmisunderstanding the way local branches is supposed to work. I will\ndescribe all teh steps I am doing. Please let me know if I'm doing\nsomething wrong.\n\nIt seems that when committing changes to one branch, one file is\nmodified across the branches. (all branches ge the modified file)\n\nThe source files used are those:\n\nhttp://distfiles.gentoo.org/distfiles/linux-2.6.22.tar.bz2\nhttp://distfiles.gentoo.org/distfiles/genpatches-2.6.22-9.base.tar.bz2\nhttp://people.linux-vserver.org/~harry/patch-2.6.22.6-vs2.2.0.3-grsec2.1.11-20070905.diff\n\nFirst unpack the linux-2.6.22.tar.bz2 archive, genpatches archive and\nadd linux kernel to a local repository.\n\n$ tar -jxf linux-2.6.22.tar.bz2\n$ tar -jxf genpatches-2.6.22-9.base.tar.bz2\n$ cd linux-2.6.22\n$ git-init\nInitialized empty Git repository in .git/\n$ git-add .\n$ git commit -m 'vanilla 2.6.22'\n...\n create mode 100644 usr/Makefile\n create mode 100644 usr/gen_init_cpio.c\n create mode 100644 usr/initramfs_data.S\n\nApply the genpatches to get kernel up to 2.6.22.9\n\n$ ls ../2.6.22/100*\n../2.6.22/1000_linux-2.6.22.1.patch  ../2.6.22/1005_linux-2.6.22.6.patch\n../2.6.22/1001_linux-2.6.22.2.patch  ../2.6.22/1006_linux-2.6.22.7.patch\n../2.6.22/1002_linux-2.6.22.3.patch  ../2.6.22/1007_linux-2.6.22.8.patch\n../2.6.22/1003_linux-2.6.22.4.patch  ../2.6.22/1008_linux-2.6.22.9.patch\n../2.6.22/1004_linux-2.6.22.5.patch\n$ for i in ../2.6.22/100*; do patch -p1 < $i ; done\n...\npatching file net/ipv6/raw.c\npatching file net/sunrpc/svcsock.c\npatching file scripts/kconfig/conf.c\n\nCommit those changes to git repo.\n\n$ git-commit -a -m'vanilla 2.6.22.9'\nCreated commit a374b11: vanilla 2.6.22.9\n 217 files changed, 1748 insertions(+), 863 deletions(-)\n delete mode 100644 arch/i386/kernel/legacy_serial.c\n\nWe want merge the gentoo patches with the vserver/grsecurity patch so we\ncreate 2 branches: vsgrsec-orig and genpatches.\n\n$ git-branch vsgrsec-orig\n$ git-branch genpatches\n\nWe switch to the vsgrsec-orig branch:\n\n$ git-checkout vsgrsec-orig\nSwitched to branch \"vsgrsec-orig\"\n$ git-branch               \n  genpatches\n  master\n* vsgrsec-orig\n\nBefore we commit any patch, we verify that we dont have any gresecurity\nrelated stuff in there, just to be sure. We check the file that I have\nhad problems with.\n\n$ grep PAX arch/i386/kernel/vmlinux.lds.S\n\nIts verified clean. Just to be sure, verify the other branches as well.\n\n$ git-checkout genpatches\nSwitched to branch \"genpatches\"\n$ grep PAX arch/i386/kernel/vmlinux.lds.S \n$ git-checkout master    \nSwitched to branch \"master\"\n$ grep PAX arch/i386/kernel/vmlinux.lds.S \n\nOk, its clean (why wouldnt it?), lets switch back to vsgrsec-orig and\napply the vserver/grsec patch.\n\n$ git-checkout vsgrsec-orig\nSwitched to branch \"vsgrsec-orig\"\n$ patch -p1 < ../patch-2.6.22.6-vs2.2.0.3-grsec2.1.11-20070905.diff \n...\npatching file sound/pci/ens1370.c\npatching file sound/pci/intel8x0.c\npatching file sound/pci/intel8x0m.c\n\nThere are one reject (due to the patch was made for 2.6.22.6), lets\nmerge it manually.\n\n$ find -name '*.rej'\n./fs/locks.c.rej\n$ cat ./fs/locks.c.rej\n***************\n*** 787,792 ****\n                goto out;\n        locks_copy_lock(new_fl, request);\n        locks_insert_lock(&inode->i_flock, new_fl);\n        new_fl = NULL;\n        error = 0;\n  \n--- 806,812 ----\n                goto out;\n        locks_copy_lock(new_fl, request);\n        locks_insert_lock(&inode->i_flock, new_fl);\n+       vx_locks_inc(new_fl);\n        new_fl = NULL;\n        error = 0;\n  \n$ vim +809 ./fs/locks.c\n\nInsert the missing \"vx_locks_inc(new_fl);\", save and exit. Remove the\nreject file.\n\n$ rm ./fs/locks.c.rej\n\nVerify that the propblematic file is modified.\n\n$ grep PAX arch/i386/kernel/vmlinux.lds.S\n#ifdef CONFIG_PAX_KERNEXEC\n\nCommit all the changes to the vsgrsec-orig branch.\n\n$ git-branch\n  genpatches\n  master\n* vsgrsec-orig\n$ git-add .\n$ git-commit -a -m'patch-2.6.22.6-vs2.2.0.3-grsec2.1.11-20070905.diff'\n...\n create mode 100644 mm/slab_vs.h\n create mode 100644 net/ipv4/devinet.c.orig\n create mode 100644 net/ipv4/netfilter/ipt_stealth.c\n\nLets diff the commits and check if git has recordend the\narch/i386/kernel/vmlinux.lds.S modification.\n\n$ git-log | cat\ncommit 9f2718984a6bc32d6ac1eee69ee27811496269d5\nAuthor: Natanael Copa <natanael.copa@gmail.com>\nDate:   Tue Oct 9 11:54:33 2007 +0200\n\n    patch-2.6.22.6-vs2.2.0.3-grsec2.1.11-20070905.diff\n\ncommit a374b11b6fb93de40c9d3cf0cad4ff1cd7261283\nAuthor: Natanael Copa <natanael.copa@gmail.com>\nDate:   Tue Oct 9 11:31:57 2007 +0200\n\n    vanilla 2.6.22.9\n\ncommit 2a31a9171d62b1ae8ed41124b61e43f49e4efb0b\nAuthor: Natanael Copa <natanael.copa@gmail.com>\nDate:   Tue Oct 9 11:27:55 2007 +0200\n\n    vanilla 2.6.22\n\n$ git-diff -p a374b11b6fb93de40c9d3cf0cad4ff1cd7261283 \\\n   | grep arch/i386/kernel/vmlinux.lds.S\n(empty)\n\nWhat? shouldn't git detect that? Well something has changed:\n\n$ git-diff -p a374b11b6fb93de40c9d3cf0cad4ff1cd7261283 \\\n   | wc -l                              \n77138\n\nLets check the file again:\n\n$ grep PAX  arch/i386/kernel/vmlinux.lds.S\n#ifdef CONFIG_PAX_KERNEXEC\n\nWell file is modified. Lets checkout the other branches.\n\n$ git-checkout master\nSwitched to branch \"master\"\n$ grep PAX  arch/i386/kernel/vmlinux.lds.S\n#ifdef CONFIG_PAX_KERNEXEC\n\nWhat? That is not supposed to be there? the\narch/i386/kernel/vmlinux.lds.S file is modified on all branches.\n\nLets see what the log says about this branch:\n\n$ git log | cat\ncommit a374b11b6fb93de40c9d3cf0cad4ff1cd7261283\nAuthor: Natanael Copa <natanael.copa@gmail.com>\nDate:   Tue Oct 9 11:31:57 2007 +0200\n\n    vanilla 2.6.22.9\n\ncommit 2a31a9171d62b1ae8ed41124b61e43f49e4efb0b\nAuthor: Natanael Copa <natanael.copa@gmail.com>\nDate:   Tue Oct 9 11:27:55 2007 +0200\n\n    vanilla 2.6.22\n\nWell, nothing about the vserver/grsec patch there.\n\n$ git-status\n# On branch master\nnothing to commit (working directory clean)\n\nLets make a diff between branches.\n\n$ git-diff master vsgrsec-orig | wc -l             \n77138\n\nSure, something has changed. But is the vmlinux.lds.S changed?\n\n$ git-diff master vsgrsec-orig | grep  arch/i386/kernel/vmlinux.lds.S\n(empty)\n\nnope! Same thing happens in genpatches branch that I created earlier.\n\n$ git checkout genpatches\nSwitched to branch \"genpatches\"\n$ git-diff master | grep  arch/i386/kernel/vmlinux.lds.S\n$ grep PAX  arch/i386/kernel/vmlinux.lds.S\n#ifdef CONFIG_PAX_KERNEXEC\n\nWhat is going on? Did I do something wrong or is this a bug?\n\nI managed to duplicate this on my 64 bit gentoo ox and my 64 bit ubuntu\nbox.\n$ git --version\ngit version 1.5.3.3\n\n$ git --version\ngit version 1.5.2.5\n\n\n-nc\n"},{"id":"55254","messageId":"20071009105620.GD31659@planck.djpig.de","threadId":"10208","inReplyTo":"1191924707.10822.94.camel@nc.nor.wtbts.org","subject":"Re: possible bug in using local branches","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-10-09T10:56:20Z","receivedAt":"2007-10-09T10:56:20Z","isPatch":false,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Tue, Oct 09, 2007 at 12:11:47PM +0200, Natanael Copa wrote:\n> \n> http://distfiles.gentoo.org/distfiles/linux-2.6.22.tar.bz2\n> http://distfiles.gentoo.org/distfiles/genpatches-2.6.22-9.base.tar.bz2\n> http://people.linux-vserver.org/~harry/patch-2.6.22.6-vs2.2.0.3-grsec2.1.11-20070905.diff\n> \n> First unpack the linux-2.6.22.tar.bz2 archive, genpatches archive and\n> add linux kernel to a local repository.\n> \n> $ tar -jxf linux-2.6.22.tar.bz2\n> $ tar -jxf genpatches-2.6.22-9.base.tar.bz2\n> $ cd linux-2.6.22\n> $ git-init\n> Initialized empty Git repository in .git/\n> $ git-add .\n> $ git commit -m 'vanilla 2.6.22'\n> ...\n>  create mode 100644 usr/Makefile\n>  create mode 100644 usr/gen_init_cpio.c\n>  create mode 100644 usr/initramfs_data.S\n\nIt already goes wrong here. The top-level .gitignore contains a\nvmlinux*, so the file you later test is never actually committed...\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"55255","messageId":"1191928028.10822.96.camel@nc.nor.wtbts.org","threadId":"10208","inReplyTo":"20071009105620.GD31659@planck.djpig.de","subject":"Re: possible bug in using local branches","fromName":"Natanael Copa","fromEmail":"natanael.copa@gmail.com","sentAt":"2007-10-09T11:07:08Z","receivedAt":"2007-10-09T11:07:08Z","isPatch":false,"sender":{"key":"natanael.copa@gmail.com","avatar":null},"body":"On Tue, 2007-10-09 at 12:56 +0200, Frank Lichtenheld wrote:\n> On Tue, Oct 09, 2007 at 12:11:47PM +0200, Natanael Copa wrote:\n> > \n> > http://distfiles.gentoo.org/distfiles/linux-2.6.22.tar.bz2\n> > http://distfiles.gentoo.org/distfiles/genpatches-2.6.22-9.base.tar.bz2\n> > http://people.linux-vserver.org/~harry/patch-2.6.22.6-vs2.2.0.3-grsec2.1.11-20070905.diff\n> > \n> > First unpack the linux-2.6.22.tar.bz2 archive, genpatches archive and\n> > add linux kernel to a local repository.\n> > \n> > $ tar -jxf linux-2.6.22.tar.bz2\n> > $ tar -jxf genpatches-2.6.22-9.base.tar.bz2\n> > $ cd linux-2.6.22\n> > $ git-init\n> > Initialized empty Git repository in .git/\n> > $ git-add .\n> > $ git commit -m 'vanilla 2.6.22'\n> > ...\n> >  create mode 100644 usr/Makefile\n> >  create mode 100644 usr/gen_init_cpio.c\n> >  create mode 100644 usr/initramfs_data.S\n> \n> It already goes wrong here. The top-level .gitignore contains a\n> vmlinux*, so the file you later test is never actually committed...\n\nYou saved my day! Thanks!\n\n>\n> Gruesse,\n\n-nc\n"}]}