Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: move $ERRNO to the system module



Oliver Kiddle wrote on Wed, 11 Jan 2023 23:19 +00:00:
> This would not be a strictly backward-compatible change.
>

Does moving $ERRNO from the core to a module "reorder or add system
calls" to the codepath that expands/evaluates uses of ERRNO?  I.e.,
even assuming scripts already do load zsh/system, is it safe to
assume the value of errno by the time Src/Modules/system.c code runs
will be the same value errno had at the point execution with this patch
diverges from execution without it?

> My justification is that, given how close it is to the system, any
> reliance on it is already liable to break just because we might reorder
> or add system calls.

How does the conclusion "It's fine to move ERRNO to a module" follow
from the premise "Scripts that rely on ERRNO are liable to break if zsh.c
changes"?  It's not immediately clear that a script that guards
against some C code modifying errno [possibly as a side effect] will
also be safe against ERRNO having been moved to a module, cf.
Stephane's example.

>                      ERRNO is not especially portable, either.

Portability is neither here nor there.

> ERRNO predates the system module, and loadable modules in general. I had
> even forgotten it existed until it was mentioned recently. I doubt it's
> especially widely used. system.mdd does specify load=no so there would
> be no automatic loading. The trick with defining it as PM_UNSET doesn't
> appear to work from a module. But that's less necessary if the variable
> is in a module.
>
> I'll allow plenty of time for dissenting opinions on this but it'd also
> be good to hear if anyone agrees.

Well, it's backwards incompatible and I don't understand the
justification given, so I can't say I'm +1 on this.

Cheers,

Daniel




Messages sorted by: Reverse Date, Date, Thread, Author