public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Virus Found
@ 2001-09-10 15:27 Troy Noble
  2001-09-10 15:41 ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: Troy Noble @ 2001-09-10 15:27 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

Hah!  That's good.

And I also saw Chuck's note about scp working... so maybe it's a non-issue.

This was many years ago... these rcp/rsh clients were from circa
Sun 3.x days, Apollo Domain OS 10.x, and dare I say it... Xenix on 286's.

Thought I'd bring it up, since it's one of the few things I can
remember from that long ago.   I'm just happy when a long-term memory
cell kicks in occasionally ;->

Troy

-----Original Message-----
From: Christopher Faylor [ mailto:cgf@redhat.com ]
Sent: Monday, September 10, 2001 4:21 PM
To: cygwin@cygwin.com
Subject: Re: Virus Found


On Mon, Sep 10, 2001 at 04:16:05PM -0600, Troy Noble wrote:
>
>> How about a port of 'fortune' with a custom 'tips' database?  Put it in 
>> the default /etc/profile...
>
>> --Chuck
>
>I do like that idea, however...
>
>I know some versions of Unix rcp client used to get confused if
>the shell startup scripts (like ~/.profile or /etc/profile)
>on the target machine emit any output to stdout.
>
>Don't know if scp suffers from the same malady, but making the
>/etc/profile spit out information to stdout might obviate the
>need for users of scp, rcp, rsh to go remove the fortune invocation
>from /etc/profile.
>
>introducing yet another FAQ ;->
>
>Just my $0.02, a throwback from my former Unix admin days.

That's ok.  We'll just add that as a tip:

"rcp getting screwed up?  Check for fortune output!"

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Virus Found
  2001-09-10 15:27 Virus Found Troy Noble
@ 2001-09-10 15:41 ` Corinna Vinschen
  2001-09-10 16:39   ` Mark Gordon
  0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2001-09-10 15:41 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

On Mon, Sep 10, 2001 at 04:27:40PM -0600, Troy Noble wrote:
> Hah!  That's good.
> 
> And I also saw Chuck's note about scp working... so maybe it's a non-issue.

But that's not quite true.  This was a long discussed topic on
the openssh-usinx-dev mailing list about the unluck interference
of profile output and scp... Hrm, it's some months ago, I
wonder if it's solved somehow and I didn't pay attention...

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Virus Found
  2001-09-10 15:41 ` Corinna Vinschen
@ 2001-09-10 16:39   ` Mark Gordon
  2001-09-10 17:10     ` Michael Schaap
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Gordon @ 2001-09-10 16:39 UTC (permalink / raw)
  To: cygwin

On Tue, 11 Sep 2001 00:41:46 +0200, Corinna Vinschen
<cygwin@cygwin.com> wrote:

>On Mon, Sep 10, 2001 at 04:27:40PM -0600, Troy Noble wrote:
>> Hah!  That's good.
>> 
>> And I also saw Chuck's note about scp working... so maybe it's a non-issue.
>
>But that's not quite true.  This was a long discussed topic on
>the openssh-usinx-dev mailing list about the unluck interference
>of profile output and scp... Hrm, it's some months ago, I
>wonder if it's solved somehow and I didn't pay attention...

I was recently (within the past few weeks) having problems with scp
due to this, so it is still a potential problem with some systems.

If people are seriously interested I can investigate this further. It
may be that one of the systems involved has an old version of ssh
causing the problem.

IIRC I put in some traps to prevent the output when there was no
terminal. I'm sure the same could be done under CygWin.
-- 
Mark Gordon - To email me replace spamtrap with mark.gordon
	A clean desk is a sign of a cluttered desk drawer.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Virus Found
  2001-09-10 16:39   ` Mark Gordon
@ 2001-09-10 17:10     ` Michael Schaap
  2001-09-11  2:19       ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Schaap @ 2001-09-10 17:10 UTC (permalink / raw)
  To: cygwin

At 01:36 11-9-2001, Mark Gordon wrote:
> >On Mon, Sep 10, 2001 at 04:27:40PM -0600, Troy Noble wrote:
> >> Hah!  That's good.
> >>
> >> And I also saw Chuck's note about scp working... so maybe it's a 
> non-issue.
> >
> >But that's not quite true.  This was a long discussed topic on
> >the openssh-usinx-dev mailing list about the unluck interference
> >of profile output and scp... Hrm, it's some months ago, I
> >wonder if it's solved somehow and I didn't pay attention...
>
>I was recently (within the past few weeks) having problems with scp
>due to this, so it is still a potential problem with some systems.
>
>If people are seriously interested I can investigate this further. It
>may be that one of the systems involved has an old version of ssh
>causing the problem.

I don't think this should be a problem - /etc/profile is only called for 
login shells.

I just tested my RedHat box (running openssh 2.5.2p2), and this works as it 
should:
         $ ssh machine
runs /etc/profile, but
         $ ssh machine ls
and
         $ scp machine:file .
do not.

  - Michael

-- 
     I always wondered about the meaning of life.   So I looked it
     up in the dictionary under "L" and there it was - the meaning
     of life.  It was not what I expected.                  - Dogbert 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Virus Found
  2001-09-10 17:10     ` Michael Schaap
@ 2001-09-11  2:19       ` Corinna Vinschen
  2001-09-11  2:44         ` output allowed in .bashrc and .tcshrc (Was: Virus Found) David Starks-Browning
  0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2001-09-11  2:19 UTC (permalink / raw)
  To: cygwin

On Tue, Sep 11, 2001 at 02:10:00AM +0200, Michael Schaap wrote:
> At 01:36 11-9-2001, Mark Gordon wrote:
> > >On Mon, Sep 10, 2001 at 04:27:40PM -0600, Troy Noble wrote:
> > >> Hah!  That's good.
> > >>
> > >> And I also saw Chuck's note about scp working... so maybe it's a 
> > non-issue.
> > >
> > >But that's not quite true.  This was a long discussed topic on
> > >the openssh-usinx-dev mailing list about the unluck interference
> > >of profile output and scp... Hrm, it's some months ago, I
> > >wonder if it's solved somehow and I didn't pay attention...
> >
> >I was recently (within the past few weeks) having problems with scp
> >due to this, so it is still a potential problem with some systems.
> >
> >If people are seriously interested I can investigate this further. It
> >may be that one of the systems involved has an old version of ssh
> >causing the problem.
> 
> I don't think this should be a problem - /etc/profile is only called for 
> login shells.

Eventually I figured that out.  The problem is ~/.bashrc.   If
your login shell is bash and bash has been started by rshd/sshd,
it executes ~/.bashrc.  So the rule is, no output in ~/.bashrc.

And, IIRC, the same rule applies for tcsh and ~/.cshrc.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* output allowed in .bashrc and .tcshrc (Was: Virus Found)
  2001-09-11  2:19       ` Corinna Vinschen
@ 2001-09-11  2:44         ` David Starks-Browning
  2001-09-11  2:53           ` Mark Gordon
  2001-09-11  3:10           ` Michael Schaap
  0 siblings, 2 replies; 9+ messages in thread
From: David Starks-Browning @ 2001-09-11  2:44 UTC (permalink / raw)
  To: Corinna Vinschen

On Tuesday 11 Sep 01, Corinna Vinschen writes:
> ... If your login shell is bash and bash has been started by
> rshd/sshd, it executes ~/.bashrc.  So the rule is, no output in
> ~/.bashrc.
> 
> And, IIRC, the same rule applies for tcsh and ~/.cshrc.

Just to be precise and complete...

That's almost correct.  Your *are* allowed to generate output in
.bashrc (and in .cshrc for tcsh) for *interactive* shells only.  The
usual way to test is to check for the existence of a prompt.  ($PS1 in
bash, $prompt in tcsh.)  If no prompt is defined, you must not
generate *any* output.

Hope this helps.

Regards,
David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: output allowed in .bashrc and .tcshrc (Was: Virus Found)
  2001-09-11  2:44         ` output allowed in .bashrc and .tcshrc (Was: Virus Found) David Starks-Browning
@ 2001-09-11  2:53           ` Mark Gordon
  2001-09-11  3:10           ` Michael Schaap
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Gordon @ 2001-09-11  2:53 UTC (permalink / raw)
  To: cygwin

On Tue, 11 Sep 2001 10:44:32 +0100, David Starks-Browning
<starksb@ebi.ac.uk> wrote:

>On Tuesday 11 Sep 01, Corinna Vinschen writes:
>> ... If your login shell is bash and bash has been started by
>> rshd/sshd, it executes ~/.bashrc.  So the rule is, no output in
>> ~/.bashrc.
>> 
>> And, IIRC, the same rule applies for tcsh and ~/.cshrc.
>
>Just to be precise and complete...
>
>That's almost correct.  Your *are* allowed to generate output in
>.bashrc (and in .cshrc for tcsh) for *interactive* shells only.  The
>usual way to test is to check for the existence of a prompt.  ($PS1 in
>bash, $prompt in tcsh.)  If no prompt is defined, you must not
>generate *any* output.

On the SCO box I have here with tcsh the same applies to
/etc/csh.cshrc (I just tested this).

You can (on this system at least) get away with calling stty on
non-interactive shells, although it does generate an error so one
probably should not.

Unfortunately on this SCO box (which I did not set up) it was doing
ALL of the things it should not!
-- 
Mark Gordon - To email me replace spamtrap with mark.gordon
	A clean desk is a sign of a cluttered desk drawer.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: output allowed in .bashrc and .tcshrc (Was: Virus Found)
  2001-09-11  2:44         ` output allowed in .bashrc and .tcshrc (Was: Virus Found) David Starks-Browning
  2001-09-11  2:53           ` Mark Gordon
@ 2001-09-11  3:10           ` Michael Schaap
  2001-09-11  3:25             ` David Starks-Browning
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Schaap @ 2001-09-11  3:10 UTC (permalink / raw)
  To: cygwin

At 11:44 11-9-2001, David Starks-Browning wrote:
>On Tuesday 11 Sep 01, Corinna Vinschen writes:
> > ... If your login shell is bash and bash has been started by
> > rshd/sshd, it executes ~/.bashrc.  So the rule is, no output in
> > ~/.bashrc.

Even .bashrc is only supposed to be called on interactive shells.  (Unless 
BASH_ENV = "$HOME/.bashrc" which it really shouldn't, but seems to be 
commonly done.)
Unfortunately, both "ssh machine command" and "scp ..." _do_ run 
.bashrc.  I have no idea why, since
         ssh machine 'echo $-'
shows that it is really a non-interactive shell.

> >
> > And, IIRC, the same rule applies for tcsh and ~/.cshrc.

Can't comment there, not a csh user


>Just to be precise and complete...
>
>That's almost correct.  Your *are* allowed to generate output in
>.bashrc (and in .cshrc for tcsh) for *interactive* shells only.  The
>usual way to test is to check for the existence of a prompt.  ($PS1 in
>bash, $prompt in tcsh.)  If no prompt is defined, you must not
>generate *any* output.

The documented way for Bash to check if a shell is interactive is by 
checking if $- contains 'i'.  For example:
         if [[ $- = *i* ]] ; then
             echo Interactive
         fi

  - Michael

-- 
     I always wondered about the meaning of life.   So I looked it
     up in the dictionary under "L" and there it was - the meaning
     of life.  It was not what I expected.                  - Dogbert 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: output allowed in .bashrc and .tcshrc (Was: Virus Found)
  2001-09-11  3:10           ` Michael Schaap
@ 2001-09-11  3:25             ` David Starks-Browning
  0 siblings, 0 replies; 9+ messages in thread
From: David Starks-Browning @ 2001-09-11  3:25 UTC (permalink / raw)
  To: Michael Schaap; +Cc: cygwin

On Tuesday 11 Sep 01, Michael Schaap writes:
> Even .bashrc is only supposed to be called on interactive shells.  (Unless 
> BASH_ENV = "$HOME/.bashrc" which it really shouldn't, but seems to be 
> commonly done.)
> Unfortunately, both "ssh machine command" and "scp ..." _do_ run 
> .bashrc.  I have no idea why, since
>          ssh machine 'echo $-'
> shows that it is really a non-interactive shell.

It must be this, from the bash(1) man page:

       Bash  attempts  to  determine  when it is being run by the
       remote shell daemon, usually rshd.  If bash determines  it
       is  being run by rshd, it reads and executes commands from
       ~/.bashrc, if that file exists and is readable.   ...

So the observed behavior is documented, with sshd in place of rshd.

> The documented way for Bash to check if a shell is interactive is by 
> checking if $- contains 'i'.  For example:
>          if [[ $- = *i* ]] ; then
>              echo Interactive
>          fi

Thanks for the lesson!

Cheers,
David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2001-09-11  3:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-10 15:27 Virus Found Troy Noble
2001-09-10 15:41 ` Corinna Vinschen
2001-09-10 16:39   ` Mark Gordon
2001-09-10 17:10     ` Michael Schaap
2001-09-11  2:19       ` Corinna Vinschen
2001-09-11  2:44         ` output allowed in .bashrc and .tcshrc (Was: Virus Found) David Starks-Browning
2001-09-11  2:53           ` Mark Gordon
2001-09-11  3:10           ` Michael Schaap
2001-09-11  3:25             ` David Starks-Browning

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 read-only IMAP folder(s) and NNTP newsgroup(s).