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

Segmentation/Core-Dump on deleting working directory: SIGSEGV in _IO_vfwprintf() #3834

Closed
2 tasks done
bentolor opened this issue Feb 9, 2017 · 9 comments
Closed
2 tasks done
Assignees
Labels
bug Something that's not working as intended
Milestone

Comments

@bentolor
Copy link

bentolor commented Feb 9, 2017

  • Have you checked if problem occurs with fish 2.5.0?
  • Tried fish without third-party customizations (check sh -c 'env HOME=$(mktemp -d) fish')?

fish version installed (fish --version):
fish 2.5.0-1~xenial (ppa)

OS/terminal used:
Gnome Terminal 3.18.3 in Ubuntu 16.04

Reproduction steps

  1. open Terminal
  2. cd /tmp and mkdir p and cd p
  3. Open another terminal tab an execute rm -fr p
  4. Switch back to first tab. press Enter -> SIGSEV

This is stable reproducible for me.

Results

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fc2c589a739 in _IO_vfwprintf (s=s@entry=0x7ffc2d7fa1e0, format=format@entry=0x1449bd0 L"getcwd() schlug mit errno %s/%s fehl", 
    ap=ap@entry=0x7ffc2d7fa428) at vfprintf.c:1632
1632	vfprintf.c: Datei oder Verzeichnis nicht gefunden.
@faho
Copy link
Member

faho commented Feb 9, 2017

I can reproduce this not by pressing enter but by executing the builtin pwd.

Can you confirm that your prompt uses that instead of "$PWD"?

@faho faho added bug Something that's not working as intended needs more info labels Feb 9, 2017
@krader1961
Copy link
Contributor

Doesn't happen for me. I get the expected error written to stderr:

<E> fish: getcwd() failed with errno 2/No such file or directory

Perhaps it is a gettext() related failure. Can you get a stack backtrace? First, ulimit -c unlimited, then reproduce the failure. You should end up with a core file wherever they're written on your system. Once you have that path bt -c /path/to/core /path/to/fish and type bt -f all.

@bentolor
Copy link
Author

bentolor commented Feb 9, 2017

@faho my fish_prompt seems to boil down to this:

echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "

@krader1961 Trying to perform. First ubuntu redirected the core files. Fixed that. But still miss the bt command. The output of gdb is the cited above. There bt reports:

(gdb) bt
#0  0x00007f1dff874739 in _IO_vfwprintf (s=s@entry=0x7ffd8e35bf30, format=format@entry=0x1f8b300 L"getcwd() schlug mit errno %s/%s fehl", ap=ap@entry=0x7ffd8e35c178)
    at vfprintf.c:1632
#1  0x00007f1dff9321a1 in __GI___vswprintf_chk (s=0x7ffd8e35c190 L"getcwd() schlug mit errno \022", maxlen=256, flags=1, slen=<optimized out>, 
    format=0x1f8b300 L"getcwd() schlug mit errno %s/%s fehl", args=0x7ffd8e35c178) at vswprintf_chk.c:62
#2  0x0000000000450d90 in append_formatv(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, wchar_t const*, __va_list_tag*) ()
#3  0x0000000000451388 in debug(int, wchar_t const*, ...) ()
#4  0x00000000004cbc75 in wgetcwd[abi:cxx11]() ()
#5  0x000000000042f67d in ?? ()
#6  0x0000000000431bfc in builtin_run(parser_t&, wchar_t const* const*, io_streams_t&) ()
#7  0x000000000046ccc5 in exec_job(parser_t&, job_t*) ()
#8  0x000000000049f51c in parse_execution_context_t::run_1_job(parse_node_t const&, block_t const*) ()
#9  0x000000000049f676 in parse_execution_context_t::run_job_list(parse_node_t const&, block_t const*) ()
#10 0x00000000004a0991 in parse_execution_context_t::eval_node_at_offset(unsigned int, block_t const*, io_chain_t const&) ()
#11 0x00000000004ab72d in parser_t::eval_block_node(unsigned int, io_chain_t const&, block_type_t) ()
#12 0x00000000004ab891 in parser_t::eval_acquiring_tree(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, io_chain_t const&, block_type_t, moved_ref<parse_node_tree_t>) ()
#13 0x00000000004ac9f4 in parser_t::eval(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, io_chain_t const&, block_type_t) ()
#14 0x000000000046bdef in ?? ()
#15 0x000000000046d770 in exec_job(parser_t&, job_t*) ()
#16 0x000000000049f51c in parse_execution_context_t::run_1_job(parse_node_t const&, block_t const*) ()
#17 0x000000000049f676 in parse_execution_context_t::run_job_list(parse_node_t const&, block_t const*) ()
#18 0x00000000004a0991 in parse_execution_context_t::eval_node_at_offset(unsigned int, block_t const*, io_chain_t const&) ()
#19 0x00000000004ab72d in parser_t::eval_block_node(unsigned int, io_chain_t const&, block_type_t) ()
#20 0x00000000004ab891 in parser_t::eval_acquiring_tree(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, io_chain_t const&, block_type_t, moved_ref<parse_node_tree_t>) ()
#21 0x00000000004ac9f4 in parser_t::eval(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, io_chain_t const&, block_type_t) ()
#22 0x000000000046c07a in ?? ()
#23 0x00000000004b69a9 in ?? ()
#24 0x00000000004b71cd in reader_run_command(parser_t&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) ()
#25 0x00000000004be2a4 in reader_read(int, io_chain_t const&) ()
#26 0x000000000042c113 in main ()

Does this help?

@faho
Copy link
Member

faho commented Feb 9, 2017

I get

#0  0x00007fa512229446 strlen (libc.so.6)
#1  0x00007fa5121fd200 vfwprintf (libc.so.6)
#2  0x00007fa512214235 vswprintf (libc.so.6)
#3  0x0000000000451537 _Z14append_formatvRNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEEPKwP13__va_list_tag (fish)
#4  0x0000000000451b80 _Z5debugiPKwz (fish)
#5  0x00000000004dbc65 _Z7wgetcwdB5cxx11v (fish)
#6  0x000000000042e13d _ZL11builtin_pwdR8parser_tR12io_streams_tPPw (fish)
#7  0x000000000043070c _Z11builtin_runR8parser_tPKPKwR12io_streams_t (fish)
#8  0x000000000046f418 _Z8exec_jobR8parser_tP5job_t (fish)
#9  0x00000000004a9a46 _ZN25parse_execution_context_t9run_1_jobERK12parse_node_tPK7block_t (fish)
#10 0x00000000004aa026 _ZN25parse_execution_context_t12run_job_listERK12parse_node_tPK7block_t (fish)
#11 0x00000000004ab644 _ZN25parse_execution_context_t19eval_node_at_offsetEjPK7block_tRK10io_chain_t (fish)
#12 0x00000000004b6f1a _ZN8parser_t15eval_block_nodeEjRK10io_chain_t12block_type_t (fish)
#13 0x00000000004b715f _ZN8parser_t4evalERKNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEERK10io_chain_t12block_type_t17parse_node_tree_t (fish)
#14 0x00000000004b83ad _ZN8parser_t4evalERKNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEERK10io_chain_t12block_type_t (fish)
#15 0x00000000004c2e0e _Z18reader_run_commandR8parser_tRKNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEE (fish)
#16 0x00000000004cbbba _Z11reader_readiRK10io_chain_t (fish)
#17 0x000000000042a96a main (fish)
#18 0x00007fa5121c9291 __libc_start_main (libc.so.6)
#19 0x000000000042a9fa _start (fish)

which seems to boil down to the same thing.

@bentolor: What is prompt_pwd?

@krader1961
Copy link
Contributor

The problem is a localization translation error. The original format string is

L"getcwd() failed with errno %d/%s")

The gettext() language file you're using has

L"getcwd() schlug mit errno %s/%s fehl"

Notice the %s/%s which should be %d/%s.

@bentolor
Copy link
Author

bentolor commented Feb 9, 2017

@faho Boy you are asking me things. Maybe some function imported by a theme I originally applied?
Due to my lack of skill here a screenshot of the fish_config output:

2017-02-09_21_30_48-fish_shell_configuration

@bentolor
Copy link
Author

bentolor commented Feb 9, 2017

@krader1961 Thanks for identifying the issue. A very small error for the bang it produces ;-)

@krader1961
Copy link
Contributor

Note that our current source has the wrong string. Looks like a simple typo introduced when the German translations were updated in January with commit 1baaeee to address issue #3721.

@krader1961 krader1961 self-assigned this Feb 9, 2017
@krader1961 krader1961 added this to the 2.6.0 milestone Feb 9, 2017
@bentolor
Copy link
Author

bentolor commented Feb 9, 2017

Thank you @krader1961 for the prompt fix!

develop7 pushed a commit to develop7/fish-shell that referenced this issue Apr 17, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants