Don't Put Tilde In Your Path

(disconnect3d.pl)

45 points | by arusekk 1 hour ago

6 comments

  • amarshall 15 minutes ago
    Or you can just…not quote the tilde. Folks always seem to reflexively quote “strings” in Bash while not realizing that (almost) everything is a string and most strings are not quoted and it would be odd to do it (e.g. no one is doing `"ls" "-a" "foo"`).
  • FeepingCreature 27 minutes ago
    Kind of seems like you should have noticed this by your ~/.local/bin PATH not working?
  • gjvc 25 minutes ago
    bad example in the article:

      export PATH="$PATH:$HOME/.local/bin/"
    
    better:

      export PATH="$HOME/.local/bin/:$PATH"
    • Backslasher 4 minutes ago
      Afaik it's habit to give system paths precedence so a malicious script can't shadow e.g. sudo and steal your password, escalating a local file write into root
  • IshKebab 1 hour ago
    Bash footgun #238503.
    • _ZeD_ 38 minutes ago
      well.. it's in zsh (and probably any other *sh) too
      • vbernat 13 minutes ago
        In Zsh, you can set PATH with path=(~/.local/bin $path). There, it works as shell expansion works.
  • hnd9q09qk4 37 minutes ago
    [flagged]
  • mr_mitm 18 minutes ago
    So many headaches could be avoided if we only allowed `[A-Za-z0-9._-]` in paths. (Arguably, even `-` can be problematic.) Encoding issues, expansion, parameter separation, ... and I never saw a convincing case in favor of supporting anything else.
    • jetbalsa 15 minutes ago
      What about people who do not speak English? or even use Latin letters?
      • ThunderSizzle 12 minutes ago
        What Latin letter(s) are you referring to?

        The (classical) Latin alphabet can be fully described by the English alphabet.