Coder Social home page Coder Social logo

Bash Tilde Expansion about fabtools HOT 1 OPEN

fabtools avatar fabtools commented on July 27, 2024
Bash Tilde Expansion

from fabtools.

Comments (1)

deanmalmgren avatar deanmalmgren commented on July 27, 2024

I looked into this a bit and started to realize this was a bit more complicated than just fixing fabtools.require.directory. The reason this is a little tricky is that paths are used in ~17 files within the fabtools project:

[unix]$ grep -R path fabtools/ | cut -d: -f1 | grep -v tests | uniq | wc -l
      17

In some modules (like fabtools.require.files), path variables are quoted directly in the run/sudo/local call which raises the issue you're mentioning. In other modules (e.g. fabtools.files), we use pipes.quote to facilitate quoting of filenames and would also have the same problem. In the fabtools.python module, we use fabtools.utils.abspath to normalize relative paths which is similar to Fabric's fabric.utils.apply_lcwd, neither of which address tilde expansion.

One quick solution would be to omit the quoting of filenames altogether and rely on users to escape spaces in filenames just like they'd have to on the command line. This has the benefit of making command-line user expansion much easier, with the downside of not being able to use spaces in filenames.

Another more involved solution might be to develop a ubiquitous and consistent way of handling path manipulation (in Fabric itself?). Perhaps we could switch to manipulating paths through fabtools.utils.abspath throughout and adding the ability to handle tilde expansion there?

My personal preference would be for the quick unquoting solution, but I'm hesitant to implement in case the quoting was deliberate for some other reason.

from fabtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.