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

Pipes instead of command line and random locks #152

Open
fabio-brugnara opened this issue Jun 1, 2023 · 5 comments
Open

Pipes instead of command line and random locks #152

fabio-brugnara opened this issue Jun 1, 2023 · 5 comments

Comments

@fabio-brugnara
Copy link

Hi all,
I suggest a solution (at least in my experience), for a couple of questions appearing among the Issues.

  1. Remove the limitations of command line length limits and exposability by using pipes instead of command line to pass the script to the interpreter. A -P option is added to enable this.
  2. Remove occasional locks introduced by a race condition in the untraceable() function: the possibility that the CONT signal arrives before the process has actually entered the stopped state, being therefore discarded.
  3. Add support for python script.

Sorry, I'm not familiar with the mechanism of pull request and so on, but all the stuff is simple enough to be manageable by a simple:

patch shc.c shc.patch

againt the current master branch, where shc.patch is extracted from:
shcpatch.zip

A drawback of the "pipe" feature, is the fact that the script may lose the possibility to retrieve the original name by accessing $0, $ARGV[0] or sys.argv[0] (depending on the language). Often this can be worked around referring to the $_ environment variable, but not always. In exchange for this annoyance, the limit on the script size and the possibility of seeing the source in clear with ps or /proc/*/cmdline both disappear.

The patch has been applied to the "original" v3, and has been working reliably for years under linux. Only recently I discovered this git repo with the updated version.

@neurobin
Copy link
Owner

neurobin commented Jun 1, 2023

The patch has been applied to the "original" v3,

could you please provide a link

@fabio-brugnara
Copy link
Author

Hi neurobin,
I mean the one found in Francisco Rosales' page.
I applied those modifications years ago to that source file, and used afterwards.
But the patch file I sent is to be applied to the current master version of this git.

@neurobin
Copy link
Owner

neurobin commented Jun 2, 2023

Sorry, I'm not familiar with the mechanism of pull request

you just need to fork this repository, then apply your patches, then push. After that you can go to https://github.com/neurobin/shc/pulls to create a PR.

@fabio-brugnara
Copy link
Author

fabio-brugnara commented Jun 2, 2023

Done. I hope it will be useful.

@liberize
Copy link

Just find out I implemented almost the same idea as this solution, except the anoymous pipe / fifo difference.
https://github.com/liberize/ssc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants