Ticket #3021 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

mc/mcedit segfault when mc's tempdir doesn't belong to the correct user

Reported by: Polynomial-C Owned by: andrew_b
Priority: minor Milestone: 4.8.9
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

This was originally reported here: https://bugs.gentoo.org/473244

This is not really a critical bug but would be nice to have fixed anyway (segfaults never are nice to have).

lars@gentoo:~> whoami
lars
lars@gentoo:~> ls -ld /tmp/mc-lars
drwx------ 2 root root 4096 Jun 14 10:21 /tmp/mc-lars/
lars@gentoo:~> mc
Directory /tmp/mc-lars is not owned by you
zsh: segmentation fault  mc
lars@gentoo:~(139)> ulimit -c unlimited
lars@gentoo:~> mcedit .zshrc
Directory /tmp/mc-lars is not owned by you
zsh: segmentation fault (core dumped)  mcedit .zshrc
lars@gentoo:~(139)> gdb mcedit core
GNU gdb (Gentoo 7.6 p1) 7.6
Copyright (C) 2013 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".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/mc...Reading symbols from /usr/lib64/debug/usr/bin/mc.debug...done.
done.

warning: core file may not match specified executable file.
[New LWP 31474]

warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `mcedit .zshrc'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000446411 in vfs_path_from_str_flags ()
(gdb) bt
#0  0x0000000000446411 in vfs_path_from_str_flags ()
#1  0x00000000004464a1 in vfs_path_from_str ()
#2  0x0000000000435f30 in mc_mkstemps ()
#3  0x0000000000435c8e in mc_tmpdir ()
#4  0x000000000040ea10 in main ()
(gdb)
lars@gentoo:~> mc -V
GNU Midnight Commander 4.8.8
Built with GLib 2.34.3
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
lars@gentoo:~> mc -F
Root directory: /home/lars

[System data]
    Config directory: /etc/mc/
    Data directory:   /usr/share/mc/
    File extension handlers: /usr/libexec/mc/ext.d/
    VFS plugins and scripts: /usr/libexec/mc/
        extfs.d:        /usr/libexec/mc/extfs.d/
        fish:           /usr/libexec/mc/fish/

[User data]
    Config directory: /home/lars/.mc/
    Data directory:   /home/lars/.mc/
        skins:          /home/lars/.mc/skins/
        extfs.d:        /home/lars/.mc/extfs.d/
        fish:           /home/lars/.mc/fish/
        mcedit macros:  /home/lars/.mc/mc.macros
        mcedit external macros: /home/lars/.mc/mcedit/macros.d/macro.*
    Cache directory:  /home/lars/.mc/
lars@gentoo:~> mc --configure-options
 '--prefix=/usr' '--build=x86_64-pc-linux-gnu' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--libdir=/usr/lib64' '--disable-silent-rules' '--disable-dependency-tracking' '--enable-nls' '--enable-vfs' '--enable-vfs-undelfs' '--enable-charset' '--without-x' '--disable-vfs-smb' '--disable-vfs-sftp' '--enable-aspell' '--without-gpm-mouse' '--with-screen=slang' '--with-edit' '--disable-mclib' '--disable-tests' '--with-homedir=.mc' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu' 'CFLAGS=-march=barcelona -O1 -ggdb1 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--as-needed' 'PKG_CONFIG_PATH=/usr/lib64/pkgconfig'
lars@gentoo:~>

Change History

comment:1 Changed 6 years ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.9

Branch: 3021_segfault_unowned_temp_dir
changeset:97b9d18f68f8d3420ce6f3c7c4401d3b959653bb

comment:2 Changed 6 years ago by Polynomial-C

Patch works. Thank you :)

comment:3 Changed 6 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:4 Changed 6 years ago by angel_il

  • Votes for changeset changed from slavazanko to slavazanko angel_il
  • Branch state changed from on review to approved

comment:5 Changed 6 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko angel_il to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:6 Changed 6 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.