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

sh.fxf: Command line arguments are passed to tasks as pointers to the input buffer directly #34

Open
ry755 opened this issue Nov 30, 2024 · 0 comments

Comments

@ry755
Copy link
Contributor

ry755 commented Nov 30, 2024

Running an application normally that takes command line arguments works fine, for example bg bg.bmp will start bg.fxf with a pointer to the string bg.bmp in sh.fxf's user input buffer. However, we run into trouble if an application is started in the background (making the shell return immediately) and then the user types into the input buffer again, causing the argument string to become overwritten. For example, *hjkl test.txt will launch hjkl.fxf and open the test.txt file and make sh.fxf immediately return to the prompt. Any typing into the shell prompt will now overwrite the memory that hjkl.fxf references for the passed file name. Even worse, if the user now exits the shell then hjkl will now reference freed memory.

sh.fxf should probably buffer the entire command line input for the lifetime of any applications that it launches. This means sh.fxf needs to keep an eye on the task IDs it creates and watch for them to exit. This is solely the fault of sh.fxf, other applications shouldn't have to care about the lifetime of the command line argument pointers that are passed to them.

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

1 participant