screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] GNU screen - Passing (eventually) LD_PRELOAD to shell at


From: Matthew Giassa
Subject: [screen-devel] GNU screen - Passing (eventually) LD_PRELOAD to shell at startup
Date: Sat, 22 Oct 2016 21:50:41 -0700
User-agent: Workspace Webmail 6.5.2

Good day,

I've recently finished a code colorizer/prettifier library that
highlights certain keywords on the console. The point of it is to make
certain words stick out to testers while going through log files.

I have the library working under most use cases, but some of the testers
insist on using GNU screen during the tests, and the library breaks
entirely.

From my initial analysis, it seems that:
* BASh forks, executes /usr/bin/screen
* screen forks, and creates a new process named "SCREEN" (not sure how
it does that in procfs)
* SCREEN forks, and launches the default shell configured for it or in
/etc/screenrc (ie: /bin/bash).

It seems (from analyzing procfs entries), that `screen` inherits the
environment variables I set for it (some custom variables, plus
LD_PRELOAD), but the shell that eventually spawns down the chain does
not have LD_PRELOAD set. My initial guess is that since (at least on my
system) setgid is set, the value is dropped, so the child process
(/bin/bash) never inherits the value. 

Is there some option within GNU screen, preferably a command-line option
as opposed to a global rc-file option, where I can have that value saved
and passed down to child processes? I don't want to enable this library
for all users, since it's only intended to be preloaded into shells, and
not any arbitrary process.

For now, I've instructed testers to simply execute the following within
screen:
 * LD_PRELOAD=/usr/lib/libprettycode.so.1 exec /bin/bash

However, we'd like to get some degree of automation going so that users
don't have to manually type this every session. Is there a workaround
which would allow us to accomplish this using GNU screen?

Thank you.

============================================================
Matthew Giassa





reply via email to

[Prev in Thread] Current Thread [Next in Thread]