Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH] attr: don't confuse prefixes with leading directories

From: Jeff King <hidden>
Date: 2016-06-15 22:52:46

Possibly related (same subject, not in this thread)

On Tue, Jan 10, 2012 at 11:23:01AM -0800, Junio C Hamano wrote:
quoted
I'm not sure if the right solution is to change the popping loop to:

  /* we will never run out of stack, because we always have the root */
  while (attr_stack->origin) {
          ...
Yeah, that makes sense, as that existing check "attr_stack &&" was a
misguided defensive coding, that was _not_ defensive at all as we didn't
do anything after we stop iterating from that loop and without checking
dereferenced attr_stack->origin, which was a simple bogosity.
quoted
Or to be extra defensive and put:

  if (!attr_stack)
          die("BUG: we ran out of attr stack!?");

after the loop, or to somehow handle the case of an empty attr stack
below (which is hard to do, because it can't be triggered, so I have no
idea what it would mean).
And this is even more so.
I wasn't clear: the second one is "even more so" making sense, or "even
more so" misguided defensive coding?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help