Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped bash does not appear to receive the correct configuration #1502

Closed
seanvaleo opened this issue Jun 1, 2023 · 1 comment · Fixed by #1503
Closed

Scoped bash does not appear to receive the correct configuration #1502

seanvaleo opened this issue Jun 1, 2023 · 1 comment · Fixed by #1503
Assignees
Labels
bug Something isn't working
Milestone

Comments

@seanvaleo
Copy link
Collaborator

Steps To Reproduce

Reported by a user:

When I scope top, I get three interfaces (log, events, metrics) that are all connected
When I scope bash, I get two interfaces (log, cribl) and only log is connected
Why the difference?

We would expect that the same configuration would yield the same results.

Possible Cause:
The handling of SCOPE_CONF_PATH in the AppScope code differs slightly from other SCOPE_ environment variables.
getenv works well for handling SCOPE_CONF_PATH as an environment variable for the top command. Unfortunately, getenv does not behave the same way for bash

Repro Steps (thanks @michalbiesek):

LD_PRELOAD=./lib/linux/x86_64/libscope.so SCOPE_CONF_PATH=<path_to_scope.yml> top
LD_PRELOAD=./lib/linux/x86_64/libscope.so SCOPE_CONF_PATH=<path_to_scope.yml> bash

Environment

- AppScope: 1.3.3
- OS: ubuntu
- Architecture: x86
- Kernel: ?

Requested priority

None

Relevant log output

No response

@seanvaleo seanvaleo added the bug Something isn't working label Jun 1, 2023
michalbiesek added a commit that referenced this issue Jun 2, 2023
- as a wrapper to call `g_fn.getenv` and a manual parsing
  of environ
- when scoping bash calling `getenv("SCOPE_CONF_PATH")`
  will return NULL

Ref: #401
Fixes: #1502
michalbiesek added a commit that referenced this issue Jun 2, 2023
- as a wrapper to call `g_fn.getenv` and a manual parsing
  of environ
- when scoping bash calling `getenv("SCOPE_CONF_PATH")`
  will return NULL

Ref: #401

Fixes: #1502
@michalbiesek michalbiesek self-assigned this Jun 2, 2023
@michalbiesek michalbiesek linked a pull request Jun 2, 2023 that will close this issue
michalbiesek added a commit that referenced this issue Jun 2, 2023
- as a wrapper to call `g_fn.getenv` and a manual parsing
  of environ
- when scoping bash calling `getenv("SCOPE_CONF_PATH")`
  will return NULL

Ref: #401

Fixes: #1502
michalbiesek added a commit that referenced this issue Jun 2, 2023
- as a wrapper to call `g_fn.getenv` and a manual parsing
  of environ
- when scoping bash calling `getenv("SCOPE_CONF_PATH")`
  will return NULL

Ref: #401

Fixes: #1502
@michalbiesek
Copy link
Contributor

michalbiesek commented Jun 2, 2023

The potential fix is presented in #1503:
getenv function is not able to find the SCOPE_CONF_PATH if I use the following logic:

To test it manually You can do following:

First terminal:

scope run bash

Second terminal:

scope inspect <bash_pid> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants