Brian,

did you have a chance to look at this yet?

- Johannes.

Johannes Fahrenkrug wrote:

Brian Harring wrote:

On Wed, Jan 11, 2006 at 10:15:00AM +0100, Johannes Fahrenkrug wrote:
if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then


Haven't looked at the patch yet, but a bit of bash fu for ya-

[[ -n $VAR ]] == ! [[ -z $VAR ]]

-z is zero length or unset, -n is length >= 1 (thus must be set).
Exactly!
This code ...

If  [[ -n $VAR ]] == ! [[ -z $VAR ]] (which it is) then
   export WE_ARE_NICED=1
   exec nice -n "$PORTAGE_NICENESS" "$0" "$@"
fi

...has the purpose to execute the current script again with
nice if PORTAGE_NICENESS is set and WE_ARE_NICED is not set (to avoid an infinite loop).
Right?

If...

if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then

...is the same as...

if [[ -n $PORTAGE_NICENESS ]] && [[ -n $WE_ARE_NICED ]]; then

...then that would mean that the condition is only met when both PORTAGE_NICENESS and WE_ARE_NICED are set. But WE_ARE_NICED is only set inside the if-body. So
I think the condition should read
if [[ -n $PORTAGE_NICENESS ]] &&  [[ -z $WE_ARE_NICED ]]; then
meaning the condition is only met when PORTAGE_NICENESS is set and WE_ARE_NICED is NOT set.

Maybe I'm completely wrong here, but I think that's the only way the condition makes sense.
Please enlighten me if I'm wrong :)

- Johannes.



--
gentoo-portage-dev@gentoo.org mailing list

Reply via email to