bugGNU Screen - Bugs: bug #57628, Can't access $HOSTNAME in screenrc...

 
 

bug #57628: Can't access $HOSTNAME in screenrc file

Submitted by:  Carl Ponder <carlponder>
Submitted on:  Sat 18 Jan 2020 10:27:04 PM UTC  
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Status:  Ready For Test
Privacy:  Public Assigned to:  Amadeusz Sławiński <amade>
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  None
Work Required:  None

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Sun 19 Jan 2020 11:42:14 PM UTC, comment #5: 

comment #4:

> $HOSTNAME (as I see in bash) seem to be provided by
> shell expansion logic and are not true environment
> variables set in environment.
> [...]
> You can see this by running 'env' command and observing
> that both of them are missing there.


I'm pretty sure this isn't true and that "env" just doesn't have $HOSTNAME in its environment because $HOSTNAME is not (or rather is no longer) exported by default.

This is how I checked my assumption:
- "env | grep HOSTNAME" works after "export HOSTNAME" (so at least it behaves like a normal environment variable)
- the man page doesn't say anything special about $HOSTNAME
- I can't find any special handling in the bash sources.

The patch is very short, but I thought I should point this out because it was brought up as a rationale. I also wonder if the patch is the right thing to do. Wouldn't it be surprising for users to special-case a normal environment variable? An entry in the CHANGES file of bash shows that bash consciously decided not to export it.

Anonymous
Sun 19 Jan 2020 10:21:06 PM UTC, comment #4: 

Either $HOST (which I see in zsh) or $HOSTNAME (as I see in bash) seem to be provided by shell expansion logic and are not true environment variables set in environment. You can see this by running 'env' command and observing that both of them are missing there.

So if we want it to be handled it should be expanded by screen itself, I've attached patch, which should work against latest release.

(file #48253)

Amadeusz Sławiński <amade>
Project AdministratorIn charge of this item.
Sat 18 Jan 2020 11:27:37 PM UTC, comment #3: 

Also tried to fall-through to the user shell:

screen -t "Director Process" /bin/bash -c ./bin/director config-gpgpu.xml $HOSTNAME
screen -t "Director Process" /bin/bash -c ./bin/director config-gpgpu.xml \$HOSTNAME
screen -t "Director Process" /bin/bash -c ./bin/director config-gpgpu.xml '$'HOSTNAME

However, for my purposes 'localhost' seems to be working, so this is not a blocker to me. But if this is fixed (or will be) in a newer release, I'd like to know about it.

Carl Ponder <carlponder>
Sat 18 Jan 2020 11:02:09 PM UTC, comment #2: 

It looks like $HNAME doesn't work either.

Carl Ponder <carlponder>
Sat 18 Jan 2020 10:28:32 PM UTC, comment #1: 

If this is already fixed in a new version, I'll try installing it.
I'm using this version

        Screen version 4.06.02 (GNU) 23-Oct-17

which wasn't on the list of options.

Carl Ponder <carlponder>
Sat 18 Jan 2020 10:27:04 PM UTC, original submission:  

These lines don't work inside my "screenrc" file:

    exec !.. ./bin/director config-gpgpu.xml %H
    exec !.. ./bin/director config-gpgpu.xml $HOST
    exec !.. ./bin/director config-gpgpu.xml $HOSTNAME
    screen ./bin/director config-gpgpu.xml $HOST
    screen ./bin/director config-gpgpu.xml $HOSTNAME

It looks like some environmet-variable expansion is available

    setenv LD_LIBRARY_PATH $PWD/lib/NVIDIA_V100-x86_64-Ubuntu_18.04

If I use an explicit host name, it does work

    exec !.. ./bin/director config-gpgpu.xml prm-dgx-10

but that's useless since I don't know what node I will be running on.

Carl Ponder <carlponder>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48253:  0001-Provide-expansion-of-HOSTNAME-variable.patch added by amade (2KiB - text/x-patch - Patch adding $HOSTNAME expansion to screen)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amade (Updated the item)
  • -email is unavailable- added by carlponder (Submitted the item)
  • -email is unavailable- added by carlponder
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-19 amade StatusNone => Ready For Test
        Assigned toNone => amade
    2020-01-19 amade Attached File- => Added 0001-Provide-expansion-of-HOSTNAME-variable.patch, #48253
    2020-01-18 carlponder Carbon-Copy- => Added cponder@nvidia.com

    Back to the top


    Powered by Savane 3.6