FAI ainsl exit code, softupdate, scripts/FAIBASE/10-misc

Michael Tautschnig mt at debian.org
Sat May 29 18:31:31 CEST 2010


>  This is not a show-stopper, but I am curious to find the thoughts
> of users and developers about this behavior.  I've searched the
> website and archives and I generally DO follow the email list, but I
> haven't heard of this topic before.   First, a real problem is the
> ainsl manpage, which doesn't document the exit codes of the ainsl
> command.  Second, I differ philosophically with the idea of ainsl
> returning an error code to the caller if the line already exists in
> the file.
> 
> My actual questions are: What's the best way to have
> scripts/FAIBASE/10-misc return success on softupdate?   Should the
> module list be checked on every softupdate?  Whether or not, I think
> extra logic would be needed in 10-misc to avoid reporting errors
> when in fact no errors exist.  (To be idealistic, I would like to
> see ainsl return 0 if the line previously existed in the file.)
> 

I guess the (philosophic?) issue is that ainsl was written by Thomas, but Thomas
doesn't use softupdates himself... I completely concur that
append-if-no-such-line should mean that it is ok if such a line exists, it just
means ainsl will do nothing in this case.

[...]

> Upon softupdate, the modules should already be in the file, which
> causes the $error variable to be set, which is then returned as an
> exit code.   This is because ainsl returns an error (1) if the line
> is already in the file [code from ainsl]:
> 
>     exit 1 if $found; # nothing to append
> 
> which returns an error condition if the file is already in the
> desired state. (This doesn't seem intuitively correct to me.  My
> intent is to ensure the line is in the file, I don't care if the
> line existed before or not).  Because of this behavior of ainsl and
> the error trapping code in 10-misc, 10-misc always reports an error
> on softupdate.
> 

As a workaround, add || true to your lines calling ainsl. But that's just a
workaround, of course, as it will ignore all kinds of errors. I believe the only
true fix is to change to above line to "exit 0 if $found;" - but we'll have to
leave that to Thomas to decide.

> The return values of ainsl are not documented on the ainsl manpage.
> 

That's a true bug.

[...]

Best,
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
Url : http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20100529/cf1b686e/attachment.bin 


More information about the linux-fai mailing list