Code Monkey home page Code Monkey logo

Comments (12)

aryarm avatar aryarm commented on September 26, 2024

I'm not sure how to solve this problem in an appropriate way.
My temporary solution was to replace realpath with a bash script that just calls the real realpath command on my phone:
#!/bin/sh realpath "$@"

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Can you run make on your phone? Can you compile the realpath script using make? Or some compiler that comes standard... I don't know if we can assume gcc is on all systems. Because if so I can just throw an extra line in my script.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

After some research, clang, gcc, and ch are acceptable C compilers that should be on most computers. I don't know if make works on everything. Try to run the raw command first before trying make.
Source: https://en.m.wikipedia.org/wiki/List_of_compilers

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

If setup is going to attempt to compile realpath, it could first check whether realpath already exists in the environment. We could do that using this.
If realpath does already exist, we could replace the realpath file with a bash executable that would call realpath. Maybe the code for that would look something like this?

if [ ! -f $ABSPATH/realpath ]; then
    touch realpath
fi
echo '#!/bin/sh' > realpath
echo 'realpath "$@"' >> realpath
chmod +x realpath

If we end up going this route, we could even do the same check to see if readlink exists.
But I think this would make things pretty complicated. Not sure if this is what we actually want to do.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

I guess we could do that. One good question this brings up is should we remake the c executable on every system anyway? Because currently it's compiled for my system and I don't know how much of a difference that makes.

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

I honestly don't know how much of a difference it makes either. I wish we had access to other computers like a mac.
But remaking the c executable may not work if the user doesn't have one of those compilers. I guess we could attempt to compile and then try creating a bash executable if none of the commands (clang, gcc, ch, etc) work? Maybe this could be done using &&, since it will run the command that comes after it only if the first command works.
This just seems like a lot of work though. We could also just use readlink -f and neglect users that don't have readlink.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Except macs are pretty standard and also I'm not sure how many computers don't have a compiler...I would check if osx, knuth have the ones we mention and then go with that.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Also, I think we should guarantee compatibility on some specific systems across the repo and then just aim for compatibility elsewhere.

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

Oh ok. So my phone is probably just a weird edge case We don't have to support it.
Yeah, I agree. We should just pick specific things to garuantee compatibility for.
I think some Macs have readlink though, right? I was reading that the problem was that readlink performs differently for different types of Macs. But it may not be a major problem for us??
Also, I found this beautiful article about portable shell scripting. It probably details everything anyone ever needs to know lol

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

Honestly, I'm actually super confused about readlink and realpath compatibility. I thought I knew, but every time I read about it, I become more confused.

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

Some proposed solutions
These might be better than creating our own script that needs to be compiled. Some of these solutions are much, much simpler (ex the Perl one) and might simplify the whole ordeal of compilation?

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Leaving the compiled binary in the repository seems like a bad solution--I keep forgetting to run make, and incompatible binaries are not good. (If I can't use this, who can?) I've just deleted the binary for now. Maybe we can come up with a better solution, but vcing a binary from a different architecture is just kind of bad upon further consideration.

from myaliases.

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.