[Swan-dev] redirection in swan-install

Antony Antony antony at phenome.org
Sun Mar 9 00:30:22 EET 2014


On Sat, Mar 08, 2014 at 02:21:06PM -0500, D. Hugh Redelmeier wrote:
> The script testing/guestbin/swan-install contains the following line:
> 
> 	make module_install 2>&1 >> compile-log.txt
> 
> That is a bit odd.  The first redirection probably does nothing in normal 
> cases.  It redirects stderr to what stdout was before stdout is
> redirected.
> 
> A clearer way to get this effect in most cases would be:
> 
> 	make module_install >>compile-log.txt
> 
> The result is that compile-log.txt is a confusing and fairly useless
> document because it excludes error messages.
> 
> Perhaps what was meant was:
> 
> 	make module_install  >>compile-log.txt 2>&1

a good idea.

> This redirects both stdout and stderr to compile-log.txt.
> 
> I'd say that this is an obvious fix EXCEPT that after this change,
> error messages no longer go to the console.  So the person running the
> command has no indication whether the make succeeded.

the initial idea for that little script is to run it from pexpect and not for a person. Hence it should log stdout and stderr to a file.  

However, it is ok to extended it with more options as you like.
Watch out there is another one called swan-build too with same redirection.

The build and install are separate because if you are using OBJDIR on a p9 fs "make programs module" once and install install_module multiple times. You can evoke it inside the guest using 'testing/utils/runkvm.py --compile --hostname <hostname> ' . However, the pexpect does not work deterministically:) Some times it exit before th compile finishes.

An advantage of using OBJDIR on p9 fs is you could ssh into the guest vm and run gdb. OBJDIR will be there even after a reboot.

-antony


More information about the Swan-dev mailing list