zsh-workers
 help / color / mirror / code / Atom feed
* best way to disable PRIVILEGED?
@ 2020-06-28 12:10 Jens Staal
  2020-06-28 14:31 ` Daniel Shahaf
  2020-06-28 17:06 ` Peter Stephenson
  0 siblings, 2 replies; 5+ messages in thread
From: Jens Staal @ 2020-06-28 12:10 UTC (permalink / raw)
  To: zsh-workers

Dear all,

I just got zsh to compile under Plan9/APE using PDCurses [1], terminfo stubs
from old PDCurses [2], pcre [3] and some hacking [4] (at the time of this
writing the last modifications have not been pushed yet, currently only builds
with "make", mkfile not completely done yet).

the zsh executes but with the error: "zsh: error on TTY read: permission denied"

One of the hacks I did was to redefine seteuid to setuid. I am not sure if that
would be the reason for the error or if I will end up noticing that the issue
are my terminfo stubs...

Has anyone else tried to build zsh with pdcurses on systems without terminfo?

A logical first thing to try however is to follow the instructions in
zsh_system.h and remove the seteuid hack and disable PRIVILEGED.

What is the best way of doing this? Just deleting all parts referring to
PRIVILEGED or is there a more elegant solution?


Best regards,
Jens


[1] https://github.com/staalmannen/PDCurses
[2] https://github.com/staalmannen/pdterm
[3] https://github.com/staalmannen/pcre
[4] https://github.com/staalmannen/zsh



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best way to disable PRIVILEGED?
  2020-06-28 12:10 best way to disable PRIVILEGED? Jens Staal
@ 2020-06-28 14:31 ` Daniel Shahaf
  2020-06-28 16:26   ` Jens Staal
  2020-06-29  6:55   ` Jens Staal
  2020-06-28 17:06 ` Peter Stephenson
  1 sibling, 2 replies; 5+ messages in thread
From: Daniel Shahaf @ 2020-06-28 14:31 UTC (permalink / raw)
  To: Jens Staal; +Cc: zsh-workers

Jens Staal wrote on Sun, 28 Jun 2020 14:10 +0200:
> the zsh executes but with the error: "zsh: error on TTY read: permission denied"
> 
> One of the hacks I did was to redefine seteuid to setuid. I am not sure if that
> would be the reason for the error

Set a breakpoint on seteuid and check whether it gets hit.  If it does,
we can take it from there.

> A logical first thing to try however is to follow the instructions in
> zsh_system.h and remove the seteuid hack and disable PRIVILEGED.
> 

I don't see any scenario in which the PRIVILEGED option causes the
error, notwithstanding your hack.  (The only things special about
PRIVILEGED are that it's initialized to true in some cases and that
unsetting it changes the real, saved, and effective UIDs.  Your hack
won't break these.

In fact, I'm having trouble seeing what it _could_ break that zsh
does.  The best I've come up with is launching zsh with different real
and effective UIDs and then running «EUID=$EUID; UID=$UID».  Pretty
sure you aren't doing that.)

Cheers,

Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best way to disable PRIVILEGED?
  2020-06-28 14:31 ` Daniel Shahaf
@ 2020-06-28 16:26   ` Jens Staal
  2020-06-29  6:55   ` Jens Staal
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Staal @ 2020-06-28 16:26 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-workers

On Sun, Jun 28, 2020 at 02:31:27PM +0000, Daniel Shahaf wrote:
> Jens Staal wrote on Sun, 28 Jun 2020 14:10 +0200:
> > the zsh executes but with the error: "zsh: error on TTY read: permission denied"
> > 
> > One of the hacks I did was to redefine seteuid to setuid. I am not sure if that
> > would be the reason for the error
> 
> Set a breakpoint on seteuid and check whether it gets hit.  If it does,
> we can take it from there.
>

Thanks! If you believe that it is unlikely that this is the issue (as you
mention below) I should probably first consider the other hacks done.
Surprisingly few actually, but the major  one might be the terminfo stubs from
old pdcurses.

> > A logical first thing to try however is to follow the instructions in
> > zsh_system.h and remove the seteuid hack and disable PRIVILEGED.
> > 
> 
> I don't see any scenario in which the PRIVILEGED option causes the
> error, notwithstanding your hack.  (The only things special about
> PRIVILEGED are that it's initialized to true in some cases and that
> unsetting it changes the real, saved, and effective UIDs.  Your hack
> won't break these.
> 
> In fact, I'm having trouble seeing what it _could_ break that zsh
> does.  The best I've come up with is launching zsh with different real
> and effective UIDs and then running «EUID=$EUID; UID=$UID».  Pretty
> sure you aren't doing that.)
> 

I am at least not doing it on purpose :) There are many things about Plan9 that
I do not know...

I think I just went for the PRIVILEGED thing since "permission denied" sounded
like something that would have to do with that.

> Cheers,
> 
> Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best way to disable PRIVILEGED?
  2020-06-28 12:10 best way to disable PRIVILEGED? Jens Staal
  2020-06-28 14:31 ` Daniel Shahaf
@ 2020-06-28 17:06 ` Peter Stephenson
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2020-06-28 17:06 UTC (permalink / raw)
  To: zsh-workers

On Sun, 2020-06-28 at 14:10 +0200, Jens Staal wrote:
> the zsh executes but with the error: "zsh: error on TTY read:
> permission denied"

My guess here would be this is something to do with job control /
terminal sessions, which is quite hairy stuff and where different OSes
can definitely go their own way, so not related to UID settings.
However, this is just based on where I've seen problems in the
past, and I don't have any specific advice to offer.

To be clear, is this a newly assigned pseudoterminal, or are you
starting zsh within an existing terminal window?

pws


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best way to disable PRIVILEGED?
  2020-06-28 14:31 ` Daniel Shahaf
  2020-06-28 16:26   ` Jens Staal
@ 2020-06-29  6:55   ` Jens Staal
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Staal @ 2020-06-29  6:55 UTC (permalink / raw)
  To: zsh-workers

>From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
>>On Sun, 2020-06-28 at 14:10 +0200, Jens Staal wrote:
>> the zsh executes but with the error: "zsh: error on TTY read:
>> permission denied"

>My guess here would be this is something to do with job control /
>terminal sessions, which is quite hairy stuff and where different OSes
>can definitely go their own way, so not related to UID settings.
>However, this is just based on where I've seen problems in the
>past, and I don't have any specific advice to offer.

Indeed job control might definitely be something. I remember having to do
-DNOPROSPECTOFWORK on mksh under Plan9.

>To be clear, is this a newly assigned pseudoterminal, or are you
>starting zsh within an existing terminal window?

I start it within an existing terminal window. Something I am now considering is
to try to give some more "meat" to my terminfo (now just stubs from old
pdcurses) and I think I might get some inspiration from the vt emulation that
exists on Plan9:
http://man.cat-v.org/9front/1/vt

I might even be able to just import some code for /sys/src/cmd/vt for that
library. No idea if that will help me. 

I sprinkled my libterm.a stubs library with printf for every function but I
could not see that one of those functions were called before the crash. I got a
tip to try to debug with a tool called "acid" so I guess that is my next step...

Executing zsh after activating the vt emulator did also not change the error.

>pws





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-29  6:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 12:10 best way to disable PRIVILEGED? Jens Staal
2020-06-28 14:31 ` Daniel Shahaf
2020-06-28 16:26   ` Jens Staal
2020-06-29  6:55   ` Jens Staal
2020-06-28 17:06 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).