bugGNU Screen - Bugs: bug #42142, screen <command> with STY...


bug #42142: screen <command> with STY set to outside screen session does not behave as expected

Submitted by:  Luke Dashjr <lukedashjr>
Submitted on:  Fri 18 Apr 2014 01:50:00 PM UTC  
Category: Program LogicSeverity: 3 - Normal
Priority: 5 - NormalStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: ClosedRelease: None
Fixed Release: NonePlanned Release: None
Work Required: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sat 05 Sep 2015 08:57:21 PM UTC, comment #4:

Yes, that is what I am doing right now, but it is just a workround. It would be better to actually fix this in screen, especially since the behaviour is very non-obvious and people won't know what's going on without a lot of research. If there's no way to fix it, maybe screen should print something like "Opened a new window in session XYZ"?

Luke Dashjr <lukedashjr>
Sat 05 Sep 2015 08:30:51 PM UTC, comment #3:

You run your X session in screen, thus all program inside your X session are basically run inside this screen.

I can't change the way how applications inherit environment variables on unix systems.

However seeing that you start your X session inside screen you probably use startx so you can always run "unset STY" before startx or just add unset to your .xinitrc, both should work for your use case.

Amadeusz Sławiński <amade>
Project Administrator
Sat 05 Sep 2015 08:13:30 PM UTC, comment #2:

Except I'm not actually executing the command inside an active screen session. The xterm has merely inherited the STY environment variable from that screen session.

Regardless of what behaviour is expected of the current code, no human/user would ever expect that running `screen` in an xterm is going to silently open a new window in some external screen session.

Luke Dashjr <lukedashjr>
Sat 05 Sep 2015 03:11:04 PM UTC, comment #1:

It's expected behaviour, executing screen command inside active screen session opens new window

If you want to start new session inside use 'screen -m' it's in documentation.

Amadeusz Sławiński <amade>
Project Administrator
Fri 18 Apr 2014 01:50:00 PM UTC, original submission:

I run my X session in screen, so that I can later attach to it inside the X session itself. However, this sets the STY environment variable, so when I go to use screen inside a terminal, it just quietly exits (or opens a new window in my X screen?), with no indication in my terminal what actually happened.

Expected behaviour is that it realises it's not inside the X screen, and behaves the same way as if STY was not set: create a new screen session with the application.

Also, I observed that inside a screen session, if you change users (eg, with su or sudo) and STY remains set, screen fails with an error:
/root/.screen/3192.X: No such file or directory

Luke Dashjr <lukedashjr>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by amade (Posted a comment)
  • -unavailable- added by lukedashjr (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 05 Sep 2015 03:11:04 PM UTCamadeStatusNone=>Invalid

    Back to the top

    Powered by Savane 3.1-cleanup