fix_path.c

October 9th, 2008
fix_path, programming, shell, tech
I did end up writing a C program to do the path fixing; it makes a big difference when the system is under load.

fix path in c

Then I have to change my bashrc a little bit from before:

PS1="${PS1}$(fix_path)"
And now it's all spiffy fast.

UPDATE 2009-07-20: The line above actually has an untrusted code excecution vulnerability. If the user can be tricked into navigating to a directory with something like $(foo) or `foo` in the name, then the foo program will be excecuted. This is quite bad. The problem is that the shell evaluates the PS1 variable before display. So we need to change that line to:

PS1="${PS1}\$(fix_path)"
And we postpone evaluation to when the prompt is displayed, instead of evaluating it both when PS1 is set and then again when it is displayed.

Referenced in: Reverse resolution of environment variables II

Comment via: facebook

Recent posts on blogs I like:

Jealousy In Polyamory Isn't A Big Problem And I'm Tired Of Being Gaslit By Big Self-Help

The nuance is in the post, guys

via Thing of Things July 18, 2024

Trust as a bottleneck to growing teams quickly

non-trust is reasonable • trust lets collaboration scale • symptoms of trust deficit • how to proactively build trust

via benkuhn.net July 13, 2024

Coaching kids as they learn to climb

Helping kids learn to climb things that are at the edge of their ability The post Coaching kids as they learn to climb appeared first on Otherwise.

via Otherwise July 10, 2024

more     (via openring)