* [patch] fork optional branch point normazilation @ 2005-04-17 12:04 Brad Roberts 2005-04-17 12:25 ` Petr Baudis 2005-04-17 17:13 ` [patch] " Linus Torvalds 0 siblings, 2 replies; 12+ messages in thread From: Brad Roberts @ 2005-04-17 12:04 UTC (permalink / raw) To: git (ok, author looks better, but committer doesn't obey the AUTHOR_ vars yet) This might not be how you intended git fork to behave, but without doing _something_ to protect the head parameter a bit, this is just asking for a corrutped .git/HEAD file. commit 76faec069dfeae59c3ce5faaad10bdcded0cc908 tree c291316b28eff4042c80850cd93445345a606835 parent 1cdbc0a19b8d9b68f1f42735e2f14f1289823a63 author Brad Roberts <braddr@puremagic.com> 1113738584 -0700 committer Brad Roberts,,, <braddr@gameboy2> 1113738584 -0700 gitfork needs to normalize the optional third parameter before using it. Index: gitfork.sh =================================================================== --- 51b1bddbbc05e50d5bbf1f9662e503c2e85d5e96/gitfork.sh (mode:100755 sha1:e5692ea9bdbc39b028fe1e1205381da632541bab) +++ c291316b28eff4042c80850cd93445345a606835/gitfork.sh (mode:100755 sha1:386148ae9a99739d06a09742ff4157d0f7e4e223) @@ -37,6 +37,7 @@ [ -e "$destdir" ] && die "$destdir already exists" [ "$head" ] || head=$(commit-id) +head=$(gitXnormid.sh -c $head) git lntree "$destdir" echo $head >.git/heads/$name ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: fork optional branch point normazilation 2005-04-17 12:04 [patch] fork optional branch point normazilation Brad Roberts @ 2005-04-17 12:25 ` Petr Baudis 2005-04-17 12:40 ` Brad Roberts 2005-04-17 17:13 ` [patch] " Linus Torvalds 1 sibling, 1 reply; 12+ messages in thread From: Petr Baudis @ 2005-04-17 12:25 UTC (permalink / raw) To: Brad Roberts; +Cc: git Dear diary, on Sun, Apr 17, 2005 at 02:04:16PM CEST, I got a letter where Brad Roberts <braddr@puremagic.com> told me that... > This might not be how you intended git fork to behave, but without doing > _something_ to protect the head parameter a bit, this is just asking for a > corrutped .git/HEAD file. > > commit 76faec069dfeae59c3ce5faaad10bdcded0cc908 > tree c291316b28eff4042c80850cd93445345a606835 > parent 1cdbc0a19b8d9b68f1f42735e2f14f1289823a63 > author Brad Roberts <braddr@puremagic.com> 1113738584 -0700 > committer Brad Roberts,,, <braddr@gameboy2> 1113738584 -0700 > > gitfork needs to normalize the optional third parameter before using it. > > Index: gitfork.sh > =================================================================== > --- 51b1bddbbc05e50d5bbf1f9662e503c2e85d5e96/gitfork.sh (mode:100755 sha1:e5692ea9bdbc39b028fe1e1205381da632541bab) > +++ c291316b28eff4042c80850cd93445345a606835/gitfork.sh (mode:100755 sha1:386148ae9a99739d06a09742ff4157d0f7e4e223) > @@ -37,6 +37,7 @@ > [ -e "$destdir" ] && die "$destdir already exists" > > [ "$head" ] || head=$(commit-id) > +head=$(gitXnormid.sh -c $head) > > git lntree "$destdir" > echo $head >.git/heads/$name commit-id always returns the normalized commit ID. -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: fork optional branch point normazilation 2005-04-17 12:25 ` Petr Baudis @ 2005-04-17 12:40 ` Brad Roberts 0 siblings, 0 replies; 12+ messages in thread From: Brad Roberts @ 2005-04-17 12:40 UTC (permalink / raw) To: Petr Baudis; +Cc: git > > > > Index: gitfork.sh > > =================================================================== > > --- 51b1bddbbc05e50d5bbf1f9662e503c2e85d5e96/gitfork.sh (mode:100755 sha1:e5692ea9bdbc39b028fe1e1205381da632541bab) > > +++ c291316b28eff4042c80850cd93445345a606835/gitfork.sh (mode:100755 sha1:386148ae9a99739d06a09742ff4157d0f7e4e223) > > @@ -37,6 +37,7 @@ > > [ -e "$destdir" ] && die "$destdir already exists" > > > > [ "$head" ] || head=$(commit-id) > > +head=$(gitXnormid.sh -c $head) > > > > git lntree "$destdir" > > echo $head >.git/heads/$name > > commit-id always returns the normalized commit ID. > > -- > Petr "Pasky" Baudis > Stuff: http://pasky.or.cz/ > C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor > This feels better to me. Diffed against my previus commit. The problem was that commit-id wasn't called if a branch point was specified nor was that value checked for validity. Index: gitfork.sh =================================================================== --- c9ccaa172ccab8e56f2fe621ee24896bfddacf26/gitfork.sh (mode:100755 sha1:386148ae9a99739d06a09742ff4157d0f7e4e223) +++ f9e06a309f63ac6858d019b51f2172283378d2ef/gitfork.sh (mode:100755 sha1:dbb508b8431368fc95cc9516eada52f5bf0f8bc1) @@ -16,7 +16,7 @@ name=$1 destdir=$2 -head=$3 +head=$(gitXnormid.sh -c $3) die () { echo gitfork.sh: $@ >&2 @@ -36,9 +36,6 @@ [ -e "$destdir" ] && die "$destdir already exists" -[ "$head" ] || head=$(commit-id) -head=$(gitXnormid.sh -c $head) - git lntree "$destdir" echo $head >.git/heads/$name ln -s heads/$name "$destdir/.git/HEAD" ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-17 12:04 [patch] fork optional branch point normazilation Brad Roberts 2005-04-17 12:25 ` Petr Baudis @ 2005-04-17 17:13 ` Linus Torvalds 2005-04-17 17:21 ` Daniel Barkalow 2005-04-17 23:27 ` Brad Roberts 1 sibling, 2 replies; 12+ messages in thread From: Linus Torvalds @ 2005-04-17 17:13 UTC (permalink / raw) To: Brad Roberts; +Cc: git On Sun, 17 Apr 2005, Brad Roberts wrote: > > (ok, author looks better, but committer doesn't obey the AUTHOR_ vars yet) They should't, but maybe I should add COMMITTER_xxx overrides. I just do _not_ want people to think that they should claim to be somebody else: it's not a security issue (you could compile your own "commit-tree.c" after all), it's more of a "social rule" thing. I prefer seeing bad email addresses that at least match the system setup to seeing good email addresses that people made up just to make them look clean. Mind showing what your /etc/passwd file looks like (just your own entry, and please just remove your password entry if you don't use shadow passwords). Maybe I should just remove _all_ strange characters when I do the name cleanup in "commit". Right now I just remove the ones that matter to parsing it unambiguosly: '\n' '<' and '>'. (The ',' character really is special: some people have Torvalds, Linus and maybe I should not just remove the commas, I should convert it to always be "Linus Torvalds". But your gecos entry is just _strange_. Why the extra commas, I wonder?) Linus ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-17 17:13 ` [patch] " Linus Torvalds @ 2005-04-17 17:21 ` Daniel Barkalow 2005-04-17 23:27 ` Brad Roberts 1 sibling, 0 replies; 12+ messages in thread From: Daniel Barkalow @ 2005-04-17 17:21 UTC (permalink / raw) To: Linus Torvalds; +Cc: Brad Roberts, git On Sun, 17 Apr 2005, Linus Torvalds wrote: > On Sun, 17 Apr 2005, Brad Roberts wrote: > > > > (ok, author looks better, but committer doesn't obey the AUTHOR_ vars yet) > > They should't, but maybe I should add COMMITTER_xxx overrides. I just do > _not_ want people to think that they should claim to be somebody else: > it's not a security issue (you could compile your own "commit-tree.c" > after all), it's more of a "social rule" thing. I prefer seeing bad email > addresses that at least match the system setup to seeing good email > addresses that people made up just to make them look clean. It seems to me like there should be a set of variables for the user in general, and the various git scripts should arrange them appropriately (e.g., git apply could look for a first Signed-Off-By, and make the AUTHOR_ variables match that (for the next commit), while making the COMMITTER match the user, etc). It seems to me like the current situation is likely to lead to people claiming to be other people when applying their patches, just due to having set up their correct info for handling their own patches. Actually, if the scripts are reorganizing them, they might as well send them on the command line. -Daniel *This .sig left intentionally blank* ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-17 17:13 ` [patch] " Linus Torvalds 2005-04-17 17:21 ` Daniel Barkalow @ 2005-04-17 23:27 ` Brad Roberts 2005-04-17 23:39 ` Linus Torvalds 1 sibling, 1 reply; 12+ messages in thread From: Brad Roberts @ 2005-04-17 23:27 UTC (permalink / raw) To: Linus Torvalds; +Cc: git On Sun, 17 Apr 2005, Linus Torvalds wrote: > On Sun, 17 Apr 2005, Brad Roberts wrote: > > > > (ok, author looks better, but committer doesn't obey the AUTHOR_ vars yet) > > They should't, but maybe I should add COMMITTER_xxx overrides. I just do > _not_ want people to think that they should claim to be somebody else: > it's not a security issue (you could compile your own "commit-tree.c" > after all), it's more of a "social rule" thing. I prefer seeing bad email > addresses that at least match the system setup to seeing good email > addresses that people made up just to make them look clean. > > Mind showing what your /etc/passwd file looks like (just your own entry, > and please just remove your password entry if you don't use shadow > passwords). > > Maybe I should just remove _all_ strange characters when I do the name > cleanup in "commit". Right now I just remove the ones that matter to > parsing it unambiguosly: '\n' '<' and '>'. > > (The ',' character really is special: some people have > > Torvalds, Linus > > and maybe I should not just remove the commas, I should convert it to > always be "Linus Torvalds". But your gecos entry is just _strange_. Why > the extra commas, I wonder?) > > Linus > - I fully agree with the intent of the field separation, they're two very different activities. braddr:x:1000:1000:Brad Roberts,,,:/home/braddr:/bin/bash All gecos entries on all my debian boxes are of the form: fullname, office number, office extension, and home number This is taken from the chfn man page on debian. Looking on my nearest redhat box, the chfn man page is roughly the same. Debian's man page also has one snippit that's not in redhat's, suggested delimiter is a ','. A bit of searching for other platforms, aix suggests a ';' as a delimiter. HPUX seems to want a ','. Later, Brad ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-17 23:27 ` Brad Roberts @ 2005-04-17 23:39 ` Linus Torvalds 2005-04-18 0:23 ` Petr Baudis 2005-04-18 10:45 ` Martin Schlemmer 0 siblings, 2 replies; 12+ messages in thread From: Linus Torvalds @ 2005-04-17 23:39 UTC (permalink / raw) To: Brad Roberts; +Cc: git On Sun, 17 Apr 2005, Brad Roberts wrote: > > braddr:x:1000:1000:Brad Roberts,,,:/home/braddr:/bin/bash > > All gecos entries on all my debian boxes are of the form: > > fullname, office number, office extension, and home number Ahh, ok. I'll make the "cleanup" thing just remove strange characters from the end, that should fix this kind of thing for now. I'd just remove everything after the first strange number, but I can also see people using the "lastname, firstname" format, and I'd hate to just ignore firstname in that case. Linus ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-17 23:39 ` Linus Torvalds @ 2005-04-18 0:23 ` Petr Baudis 2005-04-18 1:07 ` Linus Torvalds 2005-04-18 10:45 ` Martin Schlemmer 1 sibling, 1 reply; 12+ messages in thread From: Petr Baudis @ 2005-04-18 0:23 UTC (permalink / raw) To: Linus Torvalds; +Cc: Brad Roberts, git Dear diary, on Mon, Apr 18, 2005 at 01:39:10AM CEST, I got a letter where Linus Torvalds <torvalds@osdl.org> told me that... > > > On Sun, 17 Apr 2005, Brad Roberts wrote: > > > > braddr:x:1000:1000:Brad Roberts,,,:/home/braddr:/bin/bash > > > > All gecos entries on all my debian boxes are of the form: > > > > fullname, office number, office extension, and home number > > Ahh, ok. > > I'll make the "cleanup" thing just remove strange characters from the end, > that should fix this kind of thing for now. > > I'd just remove everything after the first strange number, but I can also > see people using the "lastname, firstname" format, and I'd hate to just > ignore firstname in that case. > + /* > + * Go back, and remove crud from the end: some people > + * have commas etc in their gecos field > + */ > + dst--; > + while (--dst >= p) { > + unsigned char c = *dst; > + switch (c) { > + case ',': case ';': case '.': > + *dst = 0; > + continue; > + } > + break; > + } Am I just slow or does the first dst-- make it miss the last trailing /[,;.]/? -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-18 0:23 ` Petr Baudis @ 2005-04-18 1:07 ` Linus Torvalds 2005-04-18 1:51 ` [PATCH] remove_special() tentative fix Junio C Hamano 2005-04-18 2:01 ` [patch] fork optional branch point normazilation Brad Roberts 0 siblings, 2 replies; 12+ messages in thread From: Linus Torvalds @ 2005-04-18 1:07 UTC (permalink / raw) To: Petr Baudis; +Cc: Brad Roberts, git On Mon, 18 Apr 2005, Petr Baudis wrote: > > Am I just slow or does the first dst-- make it miss the last trailing > /[,;.]/? Hopefully not. It _should_ make it miss the last '\0', but hey, it got my usual amount of testing (ie none). I'm sure Brad can tell us whether it makes any difference.. Linus ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] remove_special() tentative fix. 2005-04-18 1:07 ` Linus Torvalds @ 2005-04-18 1:51 ` Junio C Hamano 2005-04-18 2:01 ` [patch] fork optional branch point normazilation Brad Roberts 1 sibling, 0 replies; 12+ messages in thread From: Junio C Hamano @ 2005-04-18 1:51 UTC (permalink / raw) To: Linus Torvalds; +Cc: Petr Baudis, Brad Roberts, git >>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes: LT> On Mon, 18 Apr 2005, Petr Baudis wrote: >> >> Am I just slow or does the first dst-- make it miss the last trailing >> /[,;.]/? LT> Hopefully not. It _should_ make it miss the last '\0', but hey, it got my LT> usual amount of testing (ie none). I'm sure Brad can tell us whether it LT> makes any difference.. No, you are both slow ;-) At that point p is not the beginning of the input anymore. This is a *tentative* fix to implement your intended solution. I have a suspicion that your intended solution would not work on systems that really use these GECOS subfields, though. These commas are there to separate subfields and your intended solution would keep the office numbers etc. as part of commiter name. Honestly, I think your COMMITTER_* environment variable idea is far better than playing games like this, although at the same time I sympathize your not wanting to encourage people to lie about the committer identity. Signed-off-by: Junio C Hamano <junkio@cox.net> --- cd /opt/packrat/playpen/public/in-place/git/git/ show-diff commit-tree.c commit-tree.c: ec53a4565ec0033aaf6df2a48d233ccf4823e8b0 --- commit-tree.c +++ commit-tree.c 2005-04-17 18:43:39.000000000 -0700 @@ -83,6 +83,7 @@ static void finish_buffer(char *tag, cha static void remove_special(char *p) { char c; + char *begin = p; char *dst = p; for (;;) { @@ -102,7 +103,7 @@ static void remove_special(char *p) * have commas etc in their gecos field */ dst--; - while (--dst >= p) { + while (--dst >= begin) { unsigned char c = *dst; switch (c) { case ',': case ';': case '.': Compilation finished at Sun Apr 17 18:44:55 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-18 1:07 ` Linus Torvalds 2005-04-18 1:51 ` [PATCH] remove_special() tentative fix Junio C Hamano @ 2005-04-18 2:01 ` Brad Roberts 1 sibling, 0 replies; 12+ messages in thread From: Brad Roberts @ 2005-04-18 2:01 UTC (permalink / raw) To: Linus Torvalds; +Cc: Petr Baudis, git The patch needed some tweaking, but not in the way you thought. :) commit a6aa192641e9ea242332fee4916abf5ad2640d75 tree c69878b009ec2f505d75aa7d99e9ee30cd21ab02 parent 60e1274460f50bcecdc3f162b4fced9e5ebf2dfb author Brad Roberts <braddr@puremagic.com> 1113789519 -0700 committer Brad Roberts <braddr@gameboy2> 1113789519 -0700 Fix remove_specials for real. The second half logic needs the original head of the string. Signed-off-by: Brad Roberts <braddr@puremagic.com> Index: commit-tree.c =================================================================== --- 02cf6917da6297ff4f9172f7af174ba329f01b3d/commit-tree.c (mode:100644 sha1:ec53a4565ec0033aaf6df2a48d233ccf4823e8b0) +++ c69878b009ec2f505d75aa7d99e9ee30cd21ab02/commit-tree.c (mode:100644 sha1:f41cda6f9496b9e33cb95305ef1093f846c663ae) @@ -83,11 +83,11 @@ static void remove_special(char *p) { char c; - char *dst = p; + char *dst = p, *src = p; for (;;) { - c = *p; - p++; + c = *src; + src++; switch(c) { case '\n': case '<': case '>': continue; Later, Brad ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] fork optional branch point normazilation 2005-04-17 23:39 ` Linus Torvalds 2005-04-18 0:23 ` Petr Baudis @ 2005-04-18 10:45 ` Martin Schlemmer 1 sibling, 0 replies; 12+ messages in thread From: Martin Schlemmer @ 2005-04-18 10:45 UTC (permalink / raw) To: Linus Torvalds; +Cc: Brad Roberts, git [-- Attachment #1: Type: text/plain, Size: 862 bytes --] On Sun, 2005-04-17 at 16:39 -0700, Linus Torvalds wrote: > > On Sun, 17 Apr 2005, Brad Roberts wrote: > > > > braddr:x:1000:1000:Brad Roberts,,,:/home/braddr:/bin/bash > > > > All gecos entries on all my debian boxes are of the form: > > > > fullname, office number, office extension, and home number > > Ahh, ok. > > I'll make the "cleanup" thing just remove strange characters from the end, > that should fix this kind of thing for now. > > I'd just remove everything after the first strange number, but I can also > see people using the "lastname, firstname" format, and I'd hate to just > ignore firstname in that case. > If we get the info from /etc/passwd, then we should just use whatever before the first [,;] (see patch I posted earlier). If not, then I think AUTHOR_* should be sane). -- Martin Schlemmer [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-04-18 10:37 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-04-17 12:04 [patch] fork optional branch point normazilation Brad Roberts 2005-04-17 12:25 ` Petr Baudis 2005-04-17 12:40 ` Brad Roberts 2005-04-17 17:13 ` [patch] " Linus Torvalds 2005-04-17 17:21 ` Daniel Barkalow 2005-04-17 23:27 ` Brad Roberts 2005-04-17 23:39 ` Linus Torvalds 2005-04-18 0:23 ` Petr Baudis 2005-04-18 1:07 ` Linus Torvalds 2005-04-18 1:51 ` [PATCH] remove_special() tentative fix Junio C Hamano 2005-04-18 2:01 ` [patch] fork optional branch point normazilation Brad Roberts 2005-04-18 10:45 ` Martin Schlemmer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).