Bug#289271: In addition, I believe that fai-setup:add_export_line() is broken

2005-01-12 Thread Shaul Karl
On Mon, Jan 10, 2005 at 12:32:16PM +0100, Thomas Lange wrote:
>
> I don't understand why this additional patch is needed. I never heard
> of any problems with these lines. 
> 


  You are right. For some reason I got the last 2 lines of
add_export_line() mixed together as if they are a single line. I guess
I hit something within the editor without putting attention. The 2nd 
patch is not needed. 
  I apologize it took you time.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#289271: In addition, I believe that fai-setup:add_export_line() is broken

2005-01-11 Thread Shaul Karl
On Mon, Jan 10, 2005 at 12:32:16PM +0100, Thomas Lange wrote:
>
> I don't understand why this additional patch is needed. I never heard
> of any problems with these lines. 
> 


  I'll try to explain. Perhaps I am wrong.


1) The return issue.

The code uses a construct of the form:

return echo 1

Yet this construct might be specific to your default shell. Here I get:

$ sh
sh-2.05b$ sh --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.
sh-2.05b$ test1() { echo 1; return; }
sh-2.05b$ test2() { return echo 1; }
sh-2.05b$ test1
1
sh-2.05b$ test2
sh: return: echo: numeric argument required
sh-2.05b$ exit
exit
$ help return
return: return [n]
Causes a function to exit with the return value specified by N.  If N
is omitted, the return status is that of the last command.
$

  Also note the help states that omitting the return value will make it
return the status of the last command.



2) The return value of grep.

  The way I see it, the grep statement is an attempt to verify that the
directories we are interested in are not mentioned in /etc/exports. In
which case the following echo statement will write them there. 
Therefore, the following code is a test case:

$ cat example
dir1
dir2
$ grep "^dir1[[:space:]]" example
dir1
$ grep -q '^dir1[[:space:]]' example && echo not found
not found
$
$ # This is obviously wrong. dir1 is mentioned in the file. Now let us
$ # negate the return value of grep:
$
$ ! grep -q '^dir1[[:space:]]' example && echo not found
$
$ # Which is what we want, or so I believe.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#289271: In addition, I believe that fai-setup:add_export_line() is broken

2005-01-10 Thread Thomas Lange
> On Sat, 08 Jan 2005 14:48:45 +0200, Shaul Karl <[EMAIL PROTECTED]> said:

>   The following patch should fix what looks to me broken:
Does it only look broken, or do you have any p[roblems?

> -[ -f /etc/exports ] && grep -q "^$pattern[[:space:]]" /etc/exports 
&& return
> -echo "$pattern $options" >> /etc/exports
> +[ -f /etc/exports ] && ! grep -q "^$pattern[[:space:]]" /etc/exports 
&& echo "$pattern $options" >> /etc/exports
> +return
>  }

> This patch:
> 1. puts the return in a separate line.
> 2. Negates grep's return value before using it in the list.
I don't understand why this additional patch is needed. I never heard
of any problems with these lines. 

-- 
regards Thomas


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]