Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blanks are printed instead of stack trace in simple example #62

Open
ian-kelling opened this issue Sep 9, 2018 · 8 comments
Open

blanks are printed instead of stack trace in simple example #62

ian-kelling opened this issue Sep 9, 2018 · 8 comments

Comments

@ian-kelling
Copy link

ian-kelling commented Sep 9, 2018

My first attempt to use this project failed.

#!/bin/bash

source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/lib/oo-bootstrap.sh"
import util/exception

ta() {
  touch /untouchable
}
ta

running it:

$ /t/bash-oo-framework/x.sh
touch: cannot touch '/untouchable': Permission denied                                                                                                                                         
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
                                                                                                                                                                                              
 ! Press [CTRL+C] to exit or [Return] to continue execution.                                                                                                                                  
        

I'm on bash 4.3.48(1)-release, and for this project, 903fd74

@nicutor
Copy link

nicutor commented Oct 2, 2018

Hi @ian-kelling ,

The same script works for me:

# cat 1.sh
#!/bin/bash

source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/lib/oo-bootstrap.sh"
import util/exception

ta() {
  touch /tmp/a/untouchable
}
ta

Output:

# ./1.sh
touch: cannot touch â/tmp/a/untouchableâ: No such file or directory

 â UNCAUGHT EXCEPTION: /tmp/a/untouchable (1)
   î  â¦ touch /tmp/a/untouchable [1.sh:7]
   î     ⦠ta [1.sh:9]

 â¡ Press [CTRL+C] to exit or [Return] to continue execution.
â  Continuing...

 â UNCAUGHT EXCEPTION: ta (1)
   î  â¦ [[ $index -lt $backtraceNo ]] [1.sh:170]
   î  â  [1.sh:170]

 â¡ Press [CTRL+C] to exit or [Return] to continue execution.
â  Continuing...

Run from root
bash 4.2.46(2)-release
bash-oo-framework from master branch: https://github.com/niieani/bash-oo-framework/tree/master

@niieani
Copy link
Owner

niieani commented Oct 5, 2018

@ian-kelling I guess something is wrong with the way your terminal prints -- either unicode characters or colors, and we don't manage to catch that it's a non-colored terminal.

You could try forcing the unicode off by setting this global variable: NO_UNICODE=1. Let me know if this helps.

@ian-kelling
Copy link
Author

What kind of terminal are you using?

I'm runing GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)

I ran this in konsole, mate-terminal, and xterm all with export NO_UNICODE=1. All had the same result. All terminals print color just fine.

@ian-kelling
Copy link
Author

And if I run ./x.sh |& out, i can inspect the file and see that those empty lines are just empty.

@ian-kelling
Copy link
Author

correction: ./x.sh |& tee out

@niieani
Copy link
Owner

niieani commented Oct 7, 2018

That's super odd @ian-kelling. I'm not able to reproduce it. I'd have to try it in a linux virtual machine, but you've been the only one so far to report this behavior.

@romanek-adam
Copy link

I can reproduce this too, my setup is:

  • bash-oo-framework: v2.1
  • Ubuntu 16.04, Linux kernel 4.4.0-142-generic
  • terminals: Terminator 0.98 and xfce4-terminal v0.6.3 (Xfce 4.12)
  • Bash version 4.3.48(1)-release

@romanek-adam
Copy link

romanek-adam commented Feb 18, 2019

It looks like the problem is only present in non-fancy (non-colorized) output mode.

I checked that tput colors returns 8 on my terminal, so UI.Color.IsAvailable is 0. I also checked that changing $TERM from xterm to xterm-256color (which seems valid for my terminal) restores the correct output - backtrace is now fully visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants