• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • fix_path.c

    October 9th, 2008
    shell, fix_path, programming  [html]
    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 should we do about network-effect monopolies?

    Many large companies today are software monopolies that give their product away for free to get monopoly status, then do horrible things. Can we do anything about this?

    via benkuhn.net July 5, 2020

    More on the Deutschlandtakt

    The Deutschlandtakt plans are out now. They cover investment through 2040, but even beforehand, there’s a plan for something like a national integrated timetable by 2030, with trains connecting the major cities every 30 minutes rather than hourly. But the…

    via Pedestrian Observations July 1, 2020

    How do cars fare in crash tests they're not specifically optimized for?

    Any time you have a benchmark that gets taken seriously, some people will start gaming the benchmark. Some famous examples in computing are the CPU benchmark specfp and video game benchmarks. With specfp, Sun managed to increase its score on 179.art (a su…

    via Posts on Dan Luu June 30, 2020

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact