majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

yaml-reader binary segfaults if not run from the directory it resides in #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build yaml-cpp
2. Run: ./yaml-reader/yaml-reader
3.

What is the expected output? What do you see instead?
I'd expect tests to pass :-). They do pass if I change cwd to wherever 
yaml-reader is built. If I don't I 
get a segfault

What version of the product are you using? On what operating system?
Current SVN trunk, x86_64 Linux using GCC

Please provide any additional information below.

ingmar@cannonball ~/development/git/yaml-cpp (git-svn)-[ingmar]- % 
./yaml-reader/yaml-reader
zsh: segmentation fault  ./yaml-reader/yaml-reader
ingmar@cannonball ~/development/git/yaml-cpp (git-svn)-[ingmar]- % gdb 
./yaml-reader/yaml-
reader
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"...
(gdb) run
Starting program: /home/ingmar/development/git/yaml-cpp/yaml-reader/yaml-reader

Program received signal SIGSEGV, Segmentation fault.
0x00000000004689b4 in YAML::Stream::peek ()
(gdb) bt
#0  0x00000000004689b4 in YAML::Stream::peek ()
#1  0x00000000004439ef in YAML::Scanner::ScanToNextToken ()
#2  0x00000000004435e9 in YAML::Scanner::ScanNextToken ()
#3  0x0000000000443593 in YAML::Scanner::EnsureTokensInQueue ()
#4  0x0000000000443448 in YAML::Scanner::empty ()
#5  0x0000000000432ed3 in YAML::Parser::operator bool ()
#6  0x0000000000429a74 in Test::Inout ()
#7  0x0000000000429905 in Test::RunAll ()
#8  0x00000000004283ba in main ()
(gdb)

Original issue reported on code.google.com by ing...@exherbo.org on 29 May 2009 at 10:20

GoogleCodeExporter commented 9 years ago
Thanks :)

Yeah, I know about this. It's... a problem? What would you suggest doing? 
Should yaml-
reader accept a command line argument with the directory of the tests?

Original comment by jbe...@gmail.com on 29 May 2009 at 10:34

GoogleCodeExporter commented 9 years ago
We could pass the absolute path to the toplevel source directory, via cmake, to 
main.cpp.
Not sure yet how to do that though, ...

Original comment by ing...@exherbo.org on 30 May 2009 at 12:01

GoogleCodeExporter commented 9 years ago
I removed the file loading from yaml-reader (and replaced it with some other 
types of 
tests), so it should work now. This is better anyways (although I didn't write 
enough 
tests, because it's boring), since there's nothing in the yaml-cpp library that 
actually does file IO anyways

Original comment by jbe...@gmail.com on 31 May 2009 at 6:40