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

Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups

On Apr 17,  5:35pm, Peter Stephenson wrote:
} It's the whole structure of the parsing rather than the resulting word
} code (though of course the effect is encoded there).  When "time" is
} parsed we're at the level of a command, but instead of treating the
} arguments as a command (which wouldn't work as we need to time am entire
} pipeline), the parser recursively parses a nested pipeline (essentially
} --- it's actually called "sublist2" in the parser because it can have
} "coproc" or "!" in front, which also apply to the whole pipeline).

And sublist2() still stops at the "&".  Understood so far, I think.

} The ampersand is therefore parsed rather late to be able to see you need
} this structure.  So it probably needs some other trick --- a different
} list marker that causes a special null command akin to time to do the
} fork, for example, as it's easy to update word code tokens when the
} structure doesn't change.

So what we'd need to do (?) is insert a no-op token in the wordcode at
the "front" of the parse, and update it to be an "in background" token
in the event the parse ends at "&" (or "&!" etc.) ...

} The logic would then be within the exec code

... which would ignore the no-op or invoke an additional execcmd_bg() to
exec the pipeline after the fork.

} > There's also workers/42233 and related thread
} I think we demonstrated fairly conclusively that no one has the faintest
} clue what's happening here.

Actually I'm fairly sure that what's happening is that the resulting
wordcode is so large that the tail of it has overflowed the integer
type used as an internal offset for byte positions / program counter.

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