git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug
@ 2007-03-06  7:01 Nur Hussein
  2007-03-06  7:06 ` Junio C Hamano
  2007-03-06  7:47 ` Josef Sipek
  0 siblings, 2 replies; 5+ messages in thread
From: Nur Hussein @ 2007-03-06  7:01 UTC (permalink / raw)
  To: jsipek; +Cc: git

A bug occurred where the temporary mbox is deleted even when 'N' or 'n' was selected
because of the incorrect use of the -a operator when testing user input. Fixed now to
use -o instead.

Signed-off-by: Nur Hussein <hussein@cs.usm.my>
---
 guilt-patchbomb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/guilt-patchbomb b/guilt-patchbomb
index 6f51b4b..ad80fb1 100755
--- a/guilt-patchbomb
+++ b/guilt-patchbomb
@@ -88,5 +88,5 @@ fi
 echo -n "Delete temporary directory? [Y/n] "
 read n
 
-[ "$n" != "n" -a "$n" != "N" ] && exit 0
+[ "$n" != "n" -o "$n" != "N" ] && exit 0
 rm -rf $dir
-- 
1.4.4.4


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug
  2007-03-06  7:01 [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug Nur Hussein
@ 2007-03-06  7:06 ` Junio C Hamano
  2007-03-06  7:38   ` Josef Sipek
  2007-03-06  7:47 ` Josef Sipek
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-03-06  7:06 UTC (permalink / raw)
  To: Nur Hussein; +Cc: jsipek, git

Nur Hussein <hussein@cs.usm.my> writes:

>  echo -n "Delete temporary directory? [Y/n] "
>  read n
>  
> -[ "$n" != "n" -a "$n" != "N" ] && exit 0
> +[ "$n" != "n" -o "$n" != "N" ] && exit 0
>  rm -rf $dir

Is it just me who finds this much more readable?

	case "$n" in [nN]*) exit 0 ;; esac

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug
  2007-03-06  7:06 ` Junio C Hamano
@ 2007-03-06  7:38   ` Josef Sipek
  0 siblings, 0 replies; 5+ messages in thread
From: Josef Sipek @ 2007-03-06  7:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nur Hussein, git

On Mon, Mar 05, 2007 at 11:06:26PM -0800, Junio C Hamano wrote:
> Nur Hussein <hussein@cs.usm.my> writes:
> 
> >  echo -n "Delete temporary directory? [Y/n] "
> >  read n
> >  
> > -[ "$n" != "n" -a "$n" != "N" ] && exit 0
> > +[ "$n" != "n" -o "$n" != "N" ] && exit 0
> >  rm -rf $dir
> 
> Is it just me who finds this much more readable?
> 
> 	case "$n" in [nN]*) exit 0 ;; esac
 
I don't know. I never saw case being "abused" as the condition in a while
loop either. I guess it is really a matter of taste. For anything more
complex then [nN] I'd go with the case statement as well.

I hear that the whole while-case is just an optimization for sh of many
moons ago - something about case being builtin but test not.

Josef "Jeff" Sipek.

-- 
Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former.
		- Albert Einstein

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug
  2007-03-06  7:01 [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug Nur Hussein
  2007-03-06  7:06 ` Junio C Hamano
@ 2007-03-06  7:47 ` Josef Sipek
  2007-03-06  7:53   ` Josef Sipek
  1 sibling, 1 reply; 5+ messages in thread
From: Josef Sipek @ 2007-03-06  7:47 UTC (permalink / raw)
  To: Nur Hussein; +Cc: git

On Tue, Mar 06, 2007 at 03:01:46PM +0800, Nur Hussein wrote:
> A bug occurred where the temporary mbox is deleted even when 'N' or 'n' was selected
> because of the incorrect use of the -a operator when testing user input. Fixed now to
> use -o instead.
> 
> Signed-off-by: Nur Hussein <hussein@cs.usm.my>
> ---
>  guilt-patchbomb |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/guilt-patchbomb b/guilt-patchbomb
> index 6f51b4b..ad80fb1 100755
> --- a/guilt-patchbomb
> +++ b/guilt-patchbomb
> @@ -88,5 +88,5 @@ fi
>  echo -n "Delete temporary directory? [Y/n] "
>  read n
>  
> -[ "$n" != "n" -a "$n" != "N" ] && exit 0
> +[ "$n" != "n" -o "$n" != "N" ] && exit 0
>  rm -rf $dir

Would this actually work?

input		$n != n		$n != N		action (-a)	action (-o)
---------------------------------------------------------------------------
<not N>		true		true		exit		exit
n		false		true		rm		exit
N		true		false		rm		exit


The new statement seems wrong. The fact that the original statement had the
logic inverted still remains. It should be exit if ($n==n || $n==N).

Josef "Jeff" Sipek.

-- 
Research, n.:
  Consider Columbus:
    He didn't know where he was going.
    When he got there he didn't know where he was.
    When he got back he didn't know where he had been.
    And he did it all on someone else's money.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug
  2007-03-06  7:47 ` Josef Sipek
@ 2007-03-06  7:53   ` Josef Sipek
  0 siblings, 0 replies; 5+ messages in thread
From: Josef Sipek @ 2007-03-06  7:53 UTC (permalink / raw)
  To: Nur Hussein; +Cc: git

On Tue, Mar 06, 2007 at 02:47:41AM -0500, Josef Sipek wrote:
> On Tue, Mar 06, 2007 at 03:01:46PM +0800, Nur Hussein wrote:
> > A bug occurred where the temporary mbox is deleted even when 'N' or 'n' was selected
> > because of the incorrect use of the -a operator when testing user input. Fixed now to
> > use -o instead.
> > 
> > Signed-off-by: Nur Hussein <hussein@cs.usm.my>
> > ---
> >  guilt-patchbomb |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/guilt-patchbomb b/guilt-patchbomb
> > index 6f51b4b..ad80fb1 100755
> > --- a/guilt-patchbomb
> > +++ b/guilt-patchbomb
> > @@ -88,5 +88,5 @@ fi
> >  echo -n "Delete temporary directory? [Y/n] "
> >  read n
> >  
> > -[ "$n" != "n" -a "$n" != "N" ] && exit 0
> > +[ "$n" != "n" -o "$n" != "N" ] && exit 0
> >  rm -rf $dir
> 
> Would this actually work?
> 
> input		$n != n		$n != N		action (-a)	action (-o)
> ---------------------------------------------------------------------------
> <not N>		true		true		exit		exit
> n		false		true		rm		exit
> N		true		false		rm		exit
> 
> 
> The new statement seems wrong. The fact that the original statement had the
> logic inverted still remains. It should be exit if ($n==n || $n==N).

I fixed it up and commited it.

Thanks,

Josef "Jeff" Sipek.

-- 
It used to be said [...] that AIX looks like one space alien discovered
Unix, and described it to another different space alien who then implemented
AIX. But their universal translators were broken and they'd had to gesture a
lot.
		- Paul Tomblin 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-06  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06  7:01 [PATCH 1/1] Guilt: Fixed guilt-patchbomb temporary mbox deletion bug Nur Hussein
2007-03-06  7:06 ` Junio C Hamano
2007-03-06  7:38   ` Josef Sipek
2007-03-06  7:47 ` Josef Sipek
2007-03-06  7:53   ` Josef Sipek

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).