From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29602 invoked from network); 12 Aug 2020 18:18:49 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Aug 2020 18:18:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=BtF7AspJyo0fMseLzNG18JopOCCarIAgT0jOd0x9XyY=; b=tcUVXtvueMqOM35NT453SEx6+K 5CwnH+MgBx3SM1jQLKYNUTdYcDUH8ch1Nt2bkI4Ghvq/1Ocpxd+juSblaoR5ldZ++81s8ddNZjl6e dnnNuy3R9mquS6I6pi4yfuwo323Jq5sbl8cscG8Ro2wmi+07d39tfMED//nIo4PD8ow1tERDS2uze PdbaXqku/OLW+jY9tM3wKpLmAkpP7ZVQPxkXrDCPdrRFxyfrhYvEt7DyXATdbwia+w4RelDnvvqsm 6r7C1UpNtDo5gBlW8eRAg3+b+Dq5dUk46MQjzmRbtCfIoTD6Rq4GSgos7rtfhHKL1+E91vfC4Cnt9 nmM2Toew==; Received: from authenticated user by zero.zsh.org with local id 1k5vKn-000N3Q-IS; Wed, 12 Aug 2020 18:18:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qk1-f178.google.com) smtp.remote-ip=209.85.222.178; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256 Received: from mail-qk1-f178.google.com ([209.85.222.178]:34991) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1k5utL-000M1d-Kh; Wed, 12 Aug 2020 17:50:24 +0000 Received: by mail-qk1-f178.google.com with SMTP id p25so2855354qkp.2 for ; Wed, 12 Aug 2020 10:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BtF7AspJyo0fMseLzNG18JopOCCarIAgT0jOd0x9XyY=; b=uXvT2UL7ocXaZ3y04BFL9LyFnrRy6zTYZdOY5EIsPUz/StlC/vwAkIwjkdcPCfAywb wiYXpdpE7elwrlHAUEz/0n5MeVTpKVVcSokKmggx2PgJBrSmrDC/IQtE0rtTD2L2TixF rrg3RMH7h5cU28z8q+U6sZIVTjzwMh+8+mTTOMNgPIoUDk84nFoSlWwsIuDCdipGOA4t QNLvBVxDEossi/v7FgPU5DsDJilgOP4umEJ65vKw/h9NyAVohx/zkGcUwv50y98G/BWI QjA6FfZld1Nazz9d87OEDenUSBKGGPVie9Yl7RYVrRcMplT5age53mbqzHhEB83lyqnj 6tow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BtF7AspJyo0fMseLzNG18JopOCCarIAgT0jOd0x9XyY=; b=YGoUYcHZBJVuNfvdYmYakySXGEEL/Cq2Cw1p2OJ7bynlp4+9/NzfhIY8+l0cnDghBv Z0MvsB3FQuc4S91XxiJEq9lgZBnLYDsW8qMfX5c6SbaQALrqY5VKhODotOa9PMJ6UUkw bs+g8eizME1bcFvq/0b7Wa9Up9oFe9W2FyaBkuE50nyLvd62eKr6Wqex/Padr/WBpQ+y QKkNDZGCGNCFQWK/Oe5m7+cSzYcb0pbGU6HzszBY3IrsdrPaQRwaLGsEs7Bw3YSCwudl zaPWYky4qGHbk0uF7qWmRcev3ylDP0KhxPnxg9Iu07c5Sobv3qwL3gdrNULvq9f1V/CP ILMA== X-Gm-Message-State: AOAM530Jsdq22/nxvVS4vIsJR5oH3BLvdW2edgBLvfdb6V/XscsCVR2a NonhBvl9zvkHrGW2ZRYnTcp23GzF4jsiETCDweQkOHSI X-Google-Smtp-Source: ABdhPJz+F7tyZrQSjlty4F4BtxlI+jIlgWXr3DNGXphF03NfeO2Kgiz5aw3OKVLTPSBy7Op+1AFmvd97S9JCo6nIse0= X-Received: by 2002:a37:e04:: with SMTP id 4mr1020402qko.269.1597254622242; Wed, 12 Aug 2020 10:50:22 -0700 (PDT) MIME-Version: 1.0 References: <1779408280.1081846.1597227236848@mail2.virginmedia.com> <20200812155552.GA77916@fullerene.field.pennock-tech.net> In-Reply-To: <20200812155552.GA77916@fullerene.field.pennock-tech.net> From: Rui Dong Date: Wed, 12 Aug 2020 13:50:11 -0400 Message-ID: Subject: Re: Fwd: sshfs crash with zsh To: Phil Pennock Cc: zsh-user Content-Type: multipart/alternative; boundary="0000000000005fec1a05acb1d2e9" X-Zsh-Org-Should-ARC-Sign: true X-Validation-by: opk@zsh.org X-Seq: 26019 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: --0000000000005fec1a05acb1d2e9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Phil, Thanks for the info. Your response really helps. I am sorry for the limited information I provided. The zsh was started from bashrc file because I have no root permission in the server. With your help, I solved the problem by checking for 'i' in '$-'. Thank you so much. Best, Rui Phil Pennock =E4=BA=8E2020=E5=B9=B4= 8=E6=9C=8812=E6=97=A5=E5=91=A8=E4=B8=89 =E4=B8=8A=E5=8D=8811:55=E5=86=99=E9=81=93=EF=BC=9A > On 2020-08-12 at 01:25, Rui Dong wrote: > > I am a fan of zsh, and used it for many years. Recently I found when I > > configure the server with zsh, I could not mount the disk with sshfs. I= f > I > > comment the "exec /bin/zsh --login" out, sshfs works again. Could you > > please help with this? > > It sounds like you're trying to change your shell in user configuration > files without changing the login user's shell in the system records. > And then you're doing this in a configuration file used for all logins, > even non-interactive ones. > > So when some other command tries to log in, your shell switch is > happening and discarding the actual commands to be run. > > You probably want to use the `chsh` command to change the shell instead. > Or `vipw` or whatever else changes the shell in the `/etc/passwd` file: > the last field on the line for your user specifies the shell. > > If you _have_ to use configuration files, then make sure that you only > change shells, or run any command which produces output to stdout or > stderr, if the shell is interactive. > > How you do that depends upon the shell which is being used, and which > configuration file you edit. Check the manual-page for guidance on > which file to be edited. > > If one configuration file is used for both interactive and > non-interactive use, and there's no other file you can use, then you can > use conditional logic to wrap around the exec and only call that when > interactive. The syntax depends upon the shell (csh, bash, whatever). > There are two traditional approaches for "what to test": > > 1. You can look at $PS1, as long as nothing is polluting the environment > by exporting it: PS1 will only be set by shells when the shell is > interactive, because this is the main variable used to define what > your command prompt looks like. But sloppy practices (exporting PS1) > will ruin this. > 2. The shell might have a variable which lists which options are in > effect, and you can check for the interactive option in that. For > instance, with the bash shell, you might check for `i` in `$-`: > > if [[ $- =3D=3D *i* ]]; then > exec /bin/zsh --login > fi > > More than that, we can't help you with, as there are too few details in > your mail about your setup. > > Regards, > -Phil > --=20 Rui Dong Postdoctoral Fellow, Guo-Cheng Yuan's lab Department of Pediatric Oncology Dana-Farber Cancer Institute 360 Longwood Ave, Boston, MA, 02215 --0000000000005fec1a05acb1d2e9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Phil,

Thanks for the info. You= r response really helps. I am sorry for the limited information I provided.= The=C2=A0zsh was started from bashrc file because I have no root permissio= n in the server. With your help, I solved the problem by checking for '= i' in '$-'.
Thank you so much.

Best,
Rui

Phil Pennock <zsh-workers+phil.pennock@spodhuis.org> = =E4=BA=8E2020=E5=B9=B48=E6=9C=8812=E6=97=A5=E5=91=A8=E4=B8=89 =E4=B8=8A=E5= =8D=8811:55=E5=86=99=E9=81=93=EF=BC=9A
On 2020-08-12 at 01:25, Rui Dong wrote:
> I am a fan of zsh, and used it for many years. Recently I found when I=
> configure the server with zsh, I could not mount the disk with sshfs. = If I
> comment the "exec /bin/zsh --login" out, sshfs works again. = Could you
> please help with this?

It sounds like you're trying to change your shell in user configuration=
files without changing the login user's shell in the system records. And then you're doing this in a configuration file used for all logins,=
even non-interactive ones.

So when some other command tries to log in, your shell switch is
happening and discarding the actual commands to be run.

You probably want to use the `chsh` command to change the shell instead. Or `vipw` or whatever else changes the shell in the `/etc/passwd` file:
the last field on the line for your user specifies the shell.

If you _have_ to use configuration files, then make sure that you only
change shells, or run any command which produces output to stdout or
stderr, if the shell is interactive.

How you do that depends upon the shell which is being used, and which
configuration file you edit.=C2=A0 Check the manual-page for guidance on which file to be edited.

If one configuration file is used for both interactive and
non-interactive use, and there's no other file you can use, then you ca= n
use conditional logic to wrap around the exec and only call that when
interactive.=C2=A0 The syntax depends upon the shell (csh, bash, whatever).=
There are two traditional approaches for "what to test":

1. You can look at $PS1, as long as nothing is polluting the environment =C2=A0 =C2=A0by exporting it: PS1 will only be set by shells when the shell= is
=C2=A0 =C2=A0interactive, because this is the main variable used to define = what
=C2=A0 =C2=A0your command prompt looks like.=C2=A0 But sloppy practices (ex= porting PS1)
=C2=A0 =C2=A0will ruin this.
2. The shell might have a variable which lists which options are in
=C2=A0 =C2=A0effect, and you can check for the interactive option in that.= =C2=A0 For
=C2=A0 =C2=A0instance, with the bash shell, you might check for `i` in `$-`= :

=C2=A0 =C2=A0 if [[ $- =3D=3D *i* ]]; then
=C2=A0 =C2=A0 =C2=A0 exec /bin/zsh --login
=C2=A0 =C2=A0 fi

More than that, we can't help you with, as there are too few details in=
your mail about your setup.

Regards,
-Phil


--
Rui Dong
Postdoctoral Fellow, Guo-Cheng= Yuan's lab
Department of Pediatric O= ncology
Dana-Farber Cancer Institute
360 Longwood Ave, Boston, MA,=C2=A002215
--0000000000005fec1a05acb1d2e9--