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.

Comment via: facebook

Recent posts on blogs I like:

What are the results of more parental supervision and less outdoor play?

Ups and downs for mental health and injury rates The post What are the results of more parental supervision and less outdoor play? appeared first on Otherwise.

via Otherwise November 24, 2023

My startup advice

I sat down for a conversation with Alex Long. He took notes and sent them to me, and it seemed worth lightly-editing the notes and posting. I’ve left it quite raw, more like a tweet thread than a proper blog post.

via Home October 23, 2023

A Big Problem With The Going To Bed Book

One day my dad was reading this book called the "Going to Bed Book" to my sister Nora. The book is basically about a bunch of animals who are getting ready for bed on a boat. They go down the stairs, take a bath, hang their towels on the wall, find…

via Lily Wise's Blog Posts September 18, 2023

more     (via openring)