[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: broken sysvinit?



According to Josip Rodin:
> On Fri, Jun 23, 2000 at 03:26:42PM +0200, Ruud de Rooij wrote:
> > > > Now, I'll go read some docs to figure out exactly what those exec
> > > > lines do :-)
> > > 
> > > it probably runs the prog in a subshell?
> 
> In previous versions it used a subshell, '( ... ) < /etc/fstab' to do that
> stuff, but I don't know why did it need to be changed.

Because we need the info earlier in the script. That info must be placed
into environment variables. The environment in a subshell is different
from the main environment. So we couldn't use a subshell anymore.

> > No, the exec command can be used to open, close, or reassign file
> > descriptors.  In this case, it temporarily reassigns stdin to fd 10,
> > so that it can use stdin for parsing fstab.  Then later in the script
> > it reassigns fd 10 back to stdin.
> > 
> > Unfortunately ash only understands single-digit filedescriptors, it
> > appears:

Duh.

> > $ exec 2>&1
> > $ exec 9>&1
> > $ exec 10>&1    
> > exec: 10: not found
> 
> Quick fix would be to use 9, unless ash can be fixed in the same time.

Hmm. I have been using this trick with fd #10 for over 10 years on
mixes of BSD and SysV and it has always worked. The only shell in the
world on which it happens to break is Debian ash ? Argh!

I'll upload a fixed version in a few minutes. The _only_ change is
changing 10 -> 9, that's all. Do we need another test cycle for this?
The third one hasn't begon yet so it should be possible to put this
fix in, right ?

Mike.



Reply to: