Giter Site home page Giter Site logo

GBT__CONF undefined when using gbt_sudo about gbt HOT 7 CLOSED

jtyr avatar jtyr commented on August 15, 2024
GBT__CONF undefined when using gbt_sudo

from gbt.

Comments (7)

rgcv avatar rgcv commented on August 15, 2024 1

True, but I guess that isn't the case when using sudo. I'll get to submitting a PR ASAP!

from gbt.

jtyr avatar jtyr commented on August 15, 2024

Thanks for opening this issue. Please can you share what OS and shell you are using and show your configuration for setting up GBT in your shell config file?

from gbt.

rgcv avatar rgcv commented on August 15, 2024

Sure thing! Currently using bash, here's the relevant portion of my rc file:

case "$(tty)" in
  /dev/tty*) ;;
  *)
    if command -v gbt &>/dev/null; then
      PS1='$(gbt $?)'
      export GBT__HOME="/usr/share/gbt"
      source "$GBT__HOME/sources/gbts/cmd/local.sh"
      # skipping mysql, su, and sudo, look broken
      for c in docker screen ssh vagrant; do
        alias $c=gbt_$c
      done; unset c
    fi
    ;;
esac

EDIT: Happens with zsh as well, pretty sure it's shell independent?

I'm running Arch Linux x86 64-bit.

Linux ge62vr-6rf 5.0.10-arch1-1-ARCH #1 SMP PREEMPT Sat Apr 27 20:06:45 UTC 2019 x86_64 GNU/Linux

Also, I'm not aliasing mysql because, for some reason, the cursor ends up at the rightmost column, only wrapping after typing a few characters, but that's another issue.

EDIT 2: (unrelated) Found another issue in gbt_finish using zsh, outputs error: garbage option when called. I'll open proper issues soon after further testing a bit, possibly.

from gbt.

jtyr avatar jtyr commented on August 15, 2024

The GBT__CONF is defined during the transfer of the scripts to the remote machine. After you ssh to a remote machine, you should be able to find the value of that variable by running this command:

echo $GBT__CONF

That should print the location of the script (/tmp/.gbt.<NUM>).

Please can you test if the variable is defined right after you ssh somewhere? If it is, check that the variable is also exported on the top of the /tmp/.gbt.<NUM> file.

from gbt.

jtyr avatar jtyr commented on August 15, 2024

The MySQL issue is known. The MySQL client has some differences across versions and interprets unicode characters incorrectly if you connect to MySQL DB of version X with MySQL client of version Y.

from gbt.

rgcv avatar rgcv commented on August 15, 2024

Please can you test if the variable is defined right after you ssh somewhere? If it is, check that the variable is also exported on the top of the /tmp/.gbt.<NUM> file.

Loud and clear. It appears the variable is set remotely, and the first line of the file indeed includes the export line:

export GBT__CONF='/tmp/.gbt.<NUM>'

The MySQL issue is known. The MySQL client has some differences across versions and interprets unicode characters incorrectly if you connect to MySQL DB of version X with MySQL client of version Y.

I would expect that, yes, it makes sense. However, I just tested on my own box, where client and server obviously match, and I still observe the same exact behavior.. which beffudles me 😕

from gbt.

jtyr avatar jtyr commented on August 15, 2024

If the GBT__CONF is defined then using rm -f $GBT__CONF $GBT__CONF.bash should be just fine. But you are right, the removal of the files should be inside the else branch of the condition. Would you like to create PR for that?

from gbt.

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.