{"thread":{"id":"3101","subject":"/etc in git?","startedAt":"2006-01-19T03:43:44Z","lastAt":"2006-01-20T17:55:14Z","messageCount":16,"participants":["Adam Hunt","Junio C Hamano","H. Peter Anvin","Ryan Anderson","Petr Baudis","Joel Becker","Daniel Barkalow","Peter Baumann","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"14867","messageId":"b476569a0601181943y6a14e703k1b521a7edb9e2e2@mail.gmail.com","threadId":"3101","inReplyTo":null,"subject":"/etc in git?","fromName":"Adam Hunt","fromEmail":"kinema@gmail.com","sentAt":"2006-01-19T03:43:44Z","receivedAt":"2006-01-19T03:43:44Z","isPatch":false,"sender":{"key":"kinema@gmail.com","avatar":null},"body":"I was thinking about puting my /etc in SVN or CVS but then I got to\nthinking about git?  Has anyone ever tried to version their /ect with\ngit?\n\n--adam\n"},{"id":"14869","messageId":"7vlkxckf7o.fsf@assigned-by-dhcp.cox.net","threadId":"3101","inReplyTo":"b476569a0601181943y6a14e703k1b521a7edb9e2e2@mail.gmail.com","subject":"Re: /etc in git?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-19T04:35:07Z","receivedAt":"2006-01-19T04:35:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Hunt <kinema@gmail.com> writes:\n\n> ...  Has anyone ever tried to version their /ect with\n> git?\n\nYes.\n"},{"id":"14870","messageId":"b476569a0601182040w581b72b7xbb99845da4085646@mail.gmail.com","threadId":"3101","inReplyTo":"7vlkxckf7o.fsf@assigned-by-dhcp.cox.net","subject":"Re: /etc in git?","fromName":"Adam Hunt","fromEmail":"kinema@gmail.com","sentAt":"2006-01-19T04:40:22Z","receivedAt":"2006-01-19T04:40:22Z","isPatch":false,"sender":{"key":"kinema@gmail.com","avatar":null},"body":"Do you have any more details by chance?  Does it work?  Does it work\nwell?  How does one do it?\n\n--adam\n\nOn 1/18/06, Junio C Hamano <junkio@cox.net> wrote:\n> Adam Hunt <kinema@gmail.com> writes:\n>\n> > ...  Has anyone ever tried to version their /ect with\n> > git?\n>\n> Yes.\n>\n>\n"},{"id":"14871","messageId":"43CF1CBA.8030206@zytor.com","threadId":"3101","inReplyTo":"b476569a0601182040w581b72b7xbb99845da4085646@mail.gmail.com","subject":"Re: /etc in git?","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2006-01-19T04:59:38Z","receivedAt":"2006-01-19T04:59:38Z","isPatch":false,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"Adam Hunt wrote:\n> Do you have any more details by chance?  Does it work?  Does it work\n> well?  How does one do it?\n\nI've put my home directory dot files into git, and I'm assuming it's \ngoing to be a similar issue for /etc.  I've found git to be unusually \nsuitable for this, for the following reasons:\n\n- git can deal with only managing a handful of files from a large \nhierarchy, without an insane performance penalty.\n- git only needs one repository directory at the root of the tree, not \nin each subdirectory.\n\nThe biggest *problem* with git is that it doesn't handle files which \nneed to have their permissions maintained.\n\n\t-hpa\n"},{"id":"14872","messageId":"7v64ogkdtu.fsf@assigned-by-dhcp.cox.net","threadId":"3101","inReplyTo":"b476569a0601182040w581b72b7xbb99845da4085646@mail.gmail.com","subject":"Re: /etc in git?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-19T05:05:01Z","receivedAt":"2006-01-19T05:05:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Hunt <kinema@gmail.com> writes:\n\n> Do you have any more details by chance?  Does it work?  Does it work\n> well?  How does one do it?\n\nI personally feel it is a horrible and stupid thing to do, if by\n\"version control /etc\" you mean to have /.git which controls\n/etc/hosts and stuff in place.  It would work (git does not\nrefuse to run as root).  But being a *source* control system, we\ndeliberately refuse to store the full permission bits, so if\nyour /etc/shadow is mode 0600 while /etc/hosts is mode 0644, you\nhave to make sure they stay that way after checking things out.\n\nYou are much better off to keep /usr/src/rootstuff/.git (and\nworking tree files are /usr/src/rootstuff/etc/hosts and\nfriends), have a build procedure (read: Makefile) there, and\nversion control that source directory.  I usually have 'install'\nand 'diff' target in that Makefile, so that I can do this:\n\n\t$ cd /usr/src/rootstuff\n        $ make diff ;# to see if somebody edited any targets by hand\n\t$ edit etc/hosts\n\t$ git diff ;# to see the source change\n        $ make diff ;# to see the change I am going to install\n        $ su\n        # make install; exit\n        $ git commit -a -m 'Add a new host.'\n\nBeing able to run \"diff\" before actually doing it is very handy\nand useful safety/sanity measure.\n\nObviously, /usr/src/rootstuff/ should be mode 0770 or stricter,\nowned by the operator group; it would contain some sensitive\ninformation.\n"},{"id":"14876","messageId":"43CF3061.2030504@michonline.com","threadId":"3101","inReplyTo":"7v64ogkdtu.fsf@assigned-by-dhcp.cox.net","subject":"Re: /etc in git?","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2006-01-19T06:23:29Z","receivedAt":"2006-01-19T06:23:29Z","isPatch":false,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"Junio C Hamano wrote:\n> Adam Hunt <kinema@gmail.com> writes:\n> \n> \n>>Do you have any more details by chance?  Does it work?  Does it work\n>>well?  How does one do it?\n> \n> \n> I personally feel it is a horrible and stupid thing to do, if by\n> \"version control /etc\" you mean to have /.git which controls\n> /etc/hosts and stuff in place.  It would work (git does not\n> refuse to run as root).  But being a *source* control system, we\n> deliberately refuse to store the full permission bits, so if\n> your /etc/shadow is mode 0600 while /etc/hosts is mode 0644, you\n> have to make sure they stay that way after checking things out.\n\nThis is, admittedly, a major problem.\n\nIf you instead take the viewpoint that the /etc/.git/ repository is for\ntracking textual diffs and not for serving as a backup, it should be an\nacceptable tool however.  In my opinion, to be truly useful, it would\nneed to also automatically commit changes during package installation,\nupgrade, and removal.  (To be incredibly useful, it would 3-way merge\nchanges.  That, I think, is a fantasy at this time.)\n\n> \n> You are much better off to keep /usr/src/rootstuff/.git (and\n> working tree files are /usr/src/rootstuff/etc/hosts and\n> friends), have a build procedure (read: Makefile) there, and\n> version control that source directory.  I usually have 'install'\n> and 'diff' target in that Makefile, so that I can do this:\n> \n> \t$ cd /usr/src/rootstuff\n>         $ make diff ;# to see if somebody edited any targets by hand\n> \t$ edit etc/hosts\n> \t$ git diff ;# to see the source change\n>         $ make diff ;# to see the change I am going to install\n>         $ su\n>         # make install; exit\n>         $ git commit -a -m 'Add a new host.'\n> \n> Being able to run \"diff\" before actually doing it is very handy\n> and useful safety/sanity measure.\n> \n> Obviously, /usr/src/rootstuff/ should be mode 0770 or stricter,\n> owned by the operator group; it would contain some sensitive\n> information.\n\nIf you're doing this, especially if you're doing this on multiple\nmachines, creating a package is probably a worthwhile thing to\ncontemplate as well.\n\n"},{"id":"14877","messageId":"7vvewgirlt.fsf@assigned-by-dhcp.cox.net","threadId":"3101","inReplyTo":"43CF3061.2030504@michonline.com","subject":"Re: /etc in git?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-19T07:50:22Z","receivedAt":"2006-01-19T07:50:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan Anderson <ryan@michonline.com> writes:\n\n> Junio C Hamano wrote:\n>> Adam Hunt <kinema@gmail.com> writes:\n>> \n>> \n>>>Do you have any more details by chance?  Does it work?  Does it work\n>>>well?  How does one do it?\n>> \n>> \n>> I personally feel it is a horrible and stupid thing to do, if by\n>> \"version control /etc\" you mean to have /.git which controls\n>> /etc/hosts and stuff in place.  It would work (git does not\n>> refuse to run as root).  But being a *source* control system, we\n>> deliberately refuse to store the full permission bits, so if\n>> your /etc/shadow is mode 0600 while /etc/hosts is mode 0644, you\n>> have to make sure they stay that way after checking things out.\n>\n> This is, admittedly, a major problem.\n\nAn SCM is not a replacement of a backup.\n\n>> You are much better off to keep /usr/src/rootstuff/.git (and\n>> working tree files are /usr/src/rootstuff/etc/hosts and\n>> friends), have a build procedure (read: Makefile) there, and\n>> version control that source directory.  I usually have 'install'\n>> and 'diff' target in that Makefile, so that I can do this:\n>>... \n> If you're doing this, especially if you're doing this on multiple\n> machines, creating a package is probably a worthwhile thing to\n> contemplate as well.\n\nIn my workplace environment, the equivalent of the above\n/usr/src/rootstuff is accessible throughout the networked\nmachines (mostly NFS mounted); for things that needs per-host\ncustomization, we do not have /usr/src/rootstuff/etc/hosts but\nkeep /usr/src/rootstuff/etc/hosts.in as the source, and Makefile\ncustomizes that into a form suitable for installation for each\nmachine.  Especially useful is vfstab.in --- a single source\nbuilds fstab for local mounting and nfs exports, while other\nmachines have mountpoints and project symlinks pointing into\nlocation automounted from that machine with disk, generated\nautomatically.  This does not match typical \"package\" use.\n"},{"id":"14881","messageId":"20060119094156.GY28365@pasky.or.cz","threadId":"3101","inReplyTo":"7vvewgirlt.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Support precise tracking of file modes","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-01-19T09:41:56Z","receivedAt":"2006-01-19T09:41:56Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Jan 19, 2006 at 08:50:22AM CET, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Ryan Anderson <ryan@michonline.com> writes:\n> \n> > Junio C Hamano wrote:\n> >> Adam Hunt <kinema@gmail.com> writes:\n> >> \n> >> \n> >>>Do you have any more details by chance?  Does it work?  Does it work\n> >>>well?  How does one do it?\n> >> \n> >> \n> >> I personally feel it is a horrible and stupid thing to do, if by\n> >> \"version control /etc\" you mean to have /.git which controls\n> >> /etc/hosts and stuff in place.  It would work (git does not\n> >> refuse to run as root).  But being a *source* control system, we\n> >> deliberately refuse to store the full permission bits, so if\n> >> your /etc/shadow is mode 0600 while /etc/hosts is mode 0644, you\n> >> have to make sure they stay that way after checking things out.\n> >\n> > This is, admittedly, a major problem.\n> \n> An SCM is not a replacement of a backup.\n\nIt seems that this is mostly an artificial imposition and it's annoying.\nHey, I need to leave for an exam in 15 minutes and I have few urgent\nitems in my Cogito TODO (sorry, Pavel!), but I couldn't resist.\n\nTaking \"quick'n'dirty\" to the extreme _and_ combining it with Linus'\nattitude to testing and documentation... ;-)\n\ndiff --git a/cache.h b/cache.h\nindex 29c9e81..0311066 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -94,7 +94,9 @@ struct cache_entry {\n #define ce_size(ce) cache_entry_size(ce_namelen(ce))\n #define ce_stage(ce) ((CE_STAGEMASK & ntohs((ce)->ce_flags)) >> CE_STAGESHIFT)\n \n-#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)\n+extern int track_filemode;\n+\n+#define ce_permissions(mode) (track_filemode ? (mode) : (((mode) & 0100) ? 0755 : 0644))\n static inline unsigned int create_ce_mode(unsigned int mode)\n {\n \tif (S_ISLNK(mode))\ndiff --git a/checkout-index.c b/checkout-index.c\nindex 53dd8cb..b073baa 100644\n--- a/checkout-index.c\n+++ b/checkout-index.c\n@@ -115,6 +115,8 @@ int main(int argc, char **argv)\n \tint newfd = -1;\n \tint all = 0;\n \n+\tgit_config(git_default_config);\n+\n \tprefix = setup_git_directory();\n \tprefix_length = prefix ? strlen(prefix) : 0;\n \ndiff --git a/config.c b/config.c\nindex 8355224..a92ee0f 100644\n--- a/config.c\n+++ b/config.c\n@@ -222,6 +222,11 @@ int git_default_config(const char *var, \n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(var, \"core.trackallfilemodes\")) {\n+\t\ttrack_filemode = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \tif (!strcmp(var, \"core.symrefsonly\")) {\n \t\tonly_use_symrefs = git_config_bool(var, value);\n \t\treturn 0;\ndiff --git a/entry.c b/entry.c\nindex 410b758..493f2b9 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -87,6 +87,11 @@ static int write_entry(struct cache_entr\n \t\t\treturn error(\"git-checkout-index: unable to create file %s (%s)\",\n \t\t\t\tpath, strerror(errno));\n \t\t}\n+\t\tif (track_filemode) {\n+\t\t\tif (fchmod(fd, ntohl(ce->ce_mode)) < 0)\n+\t\t\t\treturn error(\"git-checkout-index: unable to chmod file %s (%s)\",\n+\t\t\t\t\tpath, strerror(errno));\n+\t\t}\n \t\twrote = write(fd, new, size);\n \t\tclose(fd);\n \t\tfree(new);\ndiff --git a/environment.c b/environment.c\nindex 0596fc6..53248ec 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -12,6 +12,7 @@\n char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n int trust_executable_bit = 1;\n+int track_filemode = 0;\n int only_use_symrefs = 0;\n int repository_format_version = 0;\n char git_commit_encoding[MAX_ENCODING_LENGTH] = \"utf-8\";\ndiff --git a/fsck-objects.c b/fsck-objects.c\nindex 90e638e..719add2 100644\n--- a/fsck-objects.c\n+++ b/fsck-objects.c\n@@ -174,7 +174,8 @@ static int fsck_tree(struct tree *item)\n \t\t\tif (!check_strict)\n \t\t\t\tbreak;\n \t\tdefault:\n-\t\t\thas_bad_modes = 1;\n+\t\t\tif (!track_filemode || (entry->mode & ~(S_IFREG|0777)))\n+\t\t\t\thas_bad_modes = 1;\n \t\t}\n \n \t\tif (last) {\ndiff --git a/read-cache.c b/read-cache.c\nindex c5474d4..624d2c3 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -98,7 +98,7 @@ static int ce_match_stat_basic(struct ca\n \t\t * \"mode changes\"\n \t\t */\n \t\tif (trust_executable_bit &&\n-\t\t    (0100 & (ntohl(ce->ce_mode) ^ st->st_mode)))\n+\t\t    ((track_filemode ? 0777 : 0100) & (ntohl(ce->ce_mode) ^ st->st_mode)))\n \t\t\tchanged |= MODE_CHANGED;\n \t\tbreak;\n \tcase S_IFLNK:\n\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"},{"id":"14900","messageId":"20060119165458.GF4380@ca-server1.us.oracle.com","threadId":"3101","inReplyTo":"7v64ogkdtu.fsf@assigned-by-dhcp.cox.net","subject":"Re: /etc in git?","fromName":"Joel Becker","fromEmail":"joel.becker@oracle.com","sentAt":"2006-01-19T16:54:58Z","receivedAt":"2006-01-19T16:54:58Z","isPatch":false,"sender":{"key":"joel.becker@oracle.com","avatar":null},"body":"On Wed, Jan 18, 2006 at 09:05:01PM -0800, Junio C Hamano wrote:\n> You are much better off to keep /usr/src/rootstuff/.git (and\n> working tree files are /usr/src/rootstuff/etc/hosts and\n> friends), have a build procedure (read: Makefile) there, and\n> version control that source directory.  I usually have 'install'\n> and 'diff' target in that Makefile, so that I can do this:\n\n\tA while back I wrote CVSMan, which tries to be berkeley sup(8)\nwith CVS as the transport.  I think git would work well here, but I\nhaven't yet generalized the code to support non-CVS SCMs (I certainly\nhave wanted to, it's the only thing I use CVS for anymore).\n\tLike GIT, CVS doesn't do perms well.  However, CVSMan handles\nthe perms via .cvsperms files.\n\nJoel\n\n-- \n\n\"What does it say about a society's priorities when the time you\n spend in meetings on Monday is greater than the total number of\n hours you spent sleeping over the weekend?\"\n\t- Nat Friedman\n\nJoel Becker\nPrincipal Software Developer\nOracle\nE-mail: joel.becker@oracle.com\nPhone: (650) 506-8127\n"},{"id":"14909","messageId":"7vacdsdqio.fsf@assigned-by-dhcp.cox.net","threadId":"3101","inReplyTo":"20060119094156.GY28365@pasky.or.cz","subject":"Re: [PATCH] Support precise tracking of file modes","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-19T18:25:03Z","receivedAt":"2006-01-19T18:25:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Taking \"quick'n'dirty\" to the extreme _and_ combining it with Linus'\n> attitude to testing and documentation... ;-)\n\nIt is premature for us mere mortals to imitate Linus in that\naspect by at least ten years ;-).  Please don't.\n\nAbout the content of the change, if we were to do this, we need\nto also record owner and group. recording full permissions\nwithout recording owner and group does not make much sense.\n"},{"id":"14914","messageId":"20060119184614.GG28365@pasky.or.cz","threadId":"3101","inReplyTo":"7vacdsdqio.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Support precise tracking of file modes","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-01-19T18:46:14Z","receivedAt":"2006-01-19T18:46:14Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Jan 19, 2006 at 07:25:03PM CET, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > Taking \"quick'n'dirty\" to the extreme _and_ combining it with Linus'\n> > attitude to testing and documentation... ;-)\n> \n> It is premature for us mere mortals to imitate Linus in that\n> aspect by at least ten years ;-).  Please don't.\n\nYes, it was really just kind of proof-of-concept patch.\n\n> About the content of the change, if we were to do this, we need\n> to also record owner and group. recording full permissions\n> without recording owner and group does not make much sense.\n\nThis would require much larger changes to the tree structure while we\ncan get this essentially for free and I believe it covers most of the\nusage scenarios. In my /etc, all but two files are owned by root.root,\nand in my ~, all the dot-files are owned by pasky.users, while the\npermissions are a lot more varied.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"},{"id":"14927","messageId":"Pine.LNX.4.64.0601191700120.25300@iabervon.org","threadId":"3101","inReplyTo":"7v64ogkdtu.fsf@assigned-by-dhcp.cox.net","subject":"Re: /etc in git?","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2006-01-19T22:22:57Z","receivedAt":"2006-01-19T22:22:57Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 18 Jan 2006, Junio C Hamano wrote:\n\n> Adam Hunt <kinema@gmail.com> writes:\n> \n> > Do you have any more details by chance?  Does it work?  Does it work\n> > well?  How does one do it?\n> \n> I personally feel it is a horrible and stupid thing to do, if by\n> \"version control /etc\" you mean to have /.git which controls\n> /etc/hosts and stuff in place.  It would work (git does not\n> refuse to run as root).  But being a *source* control system, we\n> deliberately refuse to store the full permission bits, so if\n> your /etc/shadow is mode 0600 while /etc/hosts is mode 0644, you\n> have to make sure they stay that way after checking things out.\n\nAt some point, people considered setting up an object type that would have \nall of the bits. That is, if you want a directory to come out literally \nthe same as it went in, uid/gid/sticky-bit and all, you'd do something \nspecial to make this happen.\n\nI think you could do some nifty stuff where you have git take care of \n/etc, and make all your changes to clones of the repository, push them, \nand check them out. I bet you could even have three-way merge on package \ninstalls this way; install the package into a fake root that has the /etc \ngenerated by the install of the previous version of the package (i.e., \nwithout your changes), commit that head, then merge that head into your \nmaster branch etc (in a non-real working tree, of course), check over the \nresult, commit, push to the real repository, and check out. For that \nmatter, you could probably generate the \"package added replacing previous \npackage\" commit without using a working tree, directly from the package.\n\n(Sure, it's currently set up for source control only, but the original \ntheory was general content, and it should be good at producing exactly the \nright directory structure if it had a type to represent exact stuff like \nthat)\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"14947","messageId":"43D0EAA2.8090308@michonline.com","threadId":"3101","inReplyTo":"7vvewgirlt.fsf@assigned-by-dhcp.cox.net","subject":"Re: /etc in git?","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2006-01-20T13:50:26Z","receivedAt":"2006-01-20T13:50:26Z","isPatch":false,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"Junio C Hamano wrote:\n\n>Ryan Anderson <ryan@michonline.com> writes:\n>  \n>\n>>Junio C Hamano wrote:\n>>    \n>>\n>>>You are much better off to keep /usr/src/rootstuff/.git (and\n>>>working tree files are /usr/src/rootstuff/etc/hosts and\n>>>friends), have a build procedure (read: Makefile) there, and\n>>>version control that source directory.  I usually have 'install'\n>>>and 'diff' target in that Makefile, so that I can do this:\n>>>... \n>>>      \n>>>\n>>If you're doing this, especially if you're doing this on multiple\n>>machines, creating a package is probably a worthwhile thing to\n>>contemplate as well.\n>>    \n>>\n>\n>In my workplace environment, the equivalent of the above\n>/usr/src/rootstuff is accessible throughout the networked\n>machines (mostly NFS mounted); for things that needs per-host\n>customization, we do not have /usr/src/rootstuff/etc/hosts but\n>keep /usr/src/rootstuff/etc/hosts.in as the source, and Makefile\n>customizes that into a form suitable for installation for each\n>machine.  Especially useful is vfstab.in --- a single source\n>builds fstab for local mounting and nfs exports, while other\n>machines have mountpoints and project symlinks pointing into\n>location automounted from that machine with disk, generated\n>automatically.  This does not match typical \"package\" use.\n>  \n>\nTo provide an off-topic, but perhaps useful, counter-example, where I\nwork, I've made a package that does something similar.\n\nI use a Makefile to generate a few template files, such as\n/etc/resolv.conf, /etc/apt/preferences, /etc/sudoers, /etc/ntp.conf\nIt Pre-Depends on, ntp, sudo, (etc).\n\nA postinstallation script does a little bit of tweaking of these files\nbased upon the answers to one or two questions asked during installation.\n\nIt's simply another way of looking at the problem.\n\n-- \n\nRyan Anderson\n  sometimes Pug Majere\n\n"},{"id":"14949","messageId":"802d21790601200616l7d872cbal@mail.gmail.com","threadId":"3101","inReplyTo":"20060119094156.GY28365@pasky.or.cz","subject":"Re: [PATCH] Support precise tracking of file modes","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-01-20T14:16:29Z","receivedAt":"2006-01-20T14:16:29Z","isPatch":true,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"2006/1/19, Petr Baudis <pasky@suse.cz>:\n> It seems that this is mostly an artificial imposition and it's annoying.\n> Hey, I need to leave for an exam in 15 minutes and I have few urgent\n> items in my Cogito TODO (sorry, Pavel!), but I couldn't resist.\n>\n> Taking \"quick'n'dirty\" to the extreme _and_ combining it with Linus'\n> attitude to testing and documentation... ;-)\n>\n> diff --git a/cache.h b/cache.h\n> index 29c9e81..0311066 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -94,7 +94,9 @@ struct cache_entry {\n>  #define ce_size(ce) cache_entry_size(ce_namelen(ce))\n>  #define ce_stage(ce) ((CE_STAGEMASK & ntohs((ce)->ce_flags)) >> CE_STAGESHIFT)\n>\n> -#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)\n> +extern int track_filemode;\n> +\n> +#define ce_permissions(mode) (track_filemode ? (mode) : (((mode) & 0100) ? 0755 : 0644))\n>  static inline unsigned int create_ce_mode(unsigned int mode)\n>  {\n>         if (S_ISLNK(mode))\n> diff --git a/checkout-index.c b/checkout-index.c\n> index 53dd8cb..b073baa 100644\n> --- a/checkout-index.c\n> +++ b/checkout-index.c\n> @@ -115,6 +115,8 @@ int main(int argc, char **argv)\n>         int newfd = -1;\n>         int all = 0;\n>\n> +       git_config(git_default_config);\n> +\n>         prefix = setup_git_directory();\n>         prefix_length = prefix ? strlen(prefix) : 0;\n>\n> diff --git a/config.c b/config.c\n> index 8355224..a92ee0f 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -222,6 +222,11 @@ int git_default_config(const char *var,\n>                 return 0;\n>         }\n>\n> +       if (!strcmp(var, \"core.trackallfilemodes\")) {\n> +               track_filemode = git_config_bool(var, value);\n> +               return 0;\n> +       }\n> +\n>         if (!strcmp(var, \"core.symrefsonly\")) {\n>                 only_use_symrefs = git_config_bool(var, value);\n>                 return 0;\n> diff --git a/entry.c b/entry.c\n> index 410b758..493f2b9 100644\n> --- a/entry.c\n> +++ b/entry.c\n> @@ -87,6 +87,11 @@ static int write_entry(struct cache_entr\n>                         return error(\"git-checkout-index: unable to create file %s (%s)\",\n>                                 path, strerror(errno));\n>                 }\n> +               if (track_filemode) {\n> +                       if (fchmod(fd, ntohl(ce->ce_mode)) < 0)\n> +                               return error(\"git-checkout-index: unable to chmod file %s (%s)\",\n> +                                       path, strerror(errno));\n> +               }\n>                 wrote = write(fd, new, size);\n>                 close(fd);\n>                 free(new);\n> diff --git a/environment.c b/environment.c\n> index 0596fc6..53248ec 100644\n> --- a/environment.c\n> +++ b/environment.c\n> @@ -12,6 +12,7 @@\n>  char git_default_email[MAX_GITNAME];\n>  char git_default_name[MAX_GITNAME];\n>  int trust_executable_bit = 1;\n> +int track_filemode = 0;\n>  int only_use_symrefs = 0;\n>  int repository_format_version = 0;\n>  char git_commit_encoding[MAX_ENCODING_LENGTH] = \"utf-8\";\n> diff --git a/fsck-objects.c b/fsck-objects.c\n> index 90e638e..719add2 100644\n> --- a/fsck-objects.c\n> +++ b/fsck-objects.c\n> @@ -174,7 +174,8 @@ static int fsck_tree(struct tree *item)\n>                         if (!check_strict)\n>                                 break;\n>                 default:\n> -                       has_bad_modes = 1;\n> +                       if (!track_filemode || (entry->mode & ~(S_IFREG|0777)))\n> +                               has_bad_modes = 1;\n>                 }\n>\n>                 if (last) {\n> diff --git a/read-cache.c b/read-cache.c\n> index c5474d4..624d2c3 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -98,7 +98,7 @@ static int ce_match_stat_basic(struct ca\n>                  * \"mode changes\"\n>                  */\n>                 if (trust_executable_bit &&\n> -                   (0100 & (ntohl(ce->ce_mode) ^ st->st_mode)))\n> +                   ((track_filemode ? 0777 : 0100) & (ntohl(ce->ce_mode) ^ st->st_mode)))\n>                         changed |= MODE_CHANGED;\n>                 break;\n>         case S_IFLNK:\n>\n>\n> --\n>                                 Petr \"Pasky\" Baudis\n\nI didn't test the patch, but the feature the patch tries to implement\nis really something I'm missing from git (or any other scm I know of).\nIdeally, this will be combined with exact owner tracking, but exact\npermission and/or owner handling should be activated independently per\nrepository.\n\nPeter Baumann\n"},{"id":"14951","messageId":"81b0412b0601200727r516059f1n1d3fc7b33473ed66@mail.gmail.com","threadId":"3101","inReplyTo":"7vacdsdqio.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Support precise tracking of file modes","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-01-20T15:27:21Z","receivedAt":"2006-01-20T15:27:21Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 1/19/06, Junio C Hamano <junkio@cox.net> wrote:\n> Petr Baudis <pasky@suse.cz> writes:\n>\n> > Taking \"quick'n'dirty\" to the extreme _and_ combining it with Linus'\n> > attitude to testing and documentation... ;-)\n>\n> It is premature for us mere mortals to imitate Linus in that\n> aspect by at least ten years ;-).  Please don't.\n>\n> About the content of the change, if we were to do this, we need\n> to also record owner and group. recording full permissions\n> without recording owner and group does not make much sense.\n>\n\nMaybe implement tracking of a generic file attribute would be a better idea?\nSo that porcellans can implement permissions/ownership/EA themselves,\nif they really want to...\n"},{"id":"14955","messageId":"7vlkxabx8d.fsf@assigned-by-dhcp.cox.net","threadId":"3101","inReplyTo":"43D0EAA2.8090308@michonline.com","subject":"Re: /etc in git?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-20T17:55:14Z","receivedAt":"2006-01-20T17:55:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan Anderson <ryan@michonline.com> writes:\n\n>>...  This does not match typical \"package\" use.\n>>\n> To provide an off-topic, but perhaps useful, counter-example, where I\n> work, I've made a package that does something similar...\n\nAh, haven't thought about the use of postinstallation scripts.\nIf your environment is more or less uniform that is an excellent\nway of doing it.\n\nUnfortunately, our Solaris boxen do not understand .deb postinst\nscripts, so that is why we are not doing it X-<.  Maybe after we\nget rid of them perhaps..\n"}]}