Ticket #2730 (closed defect: invalid)

Opened 13 years ago

Last modified 3 years ago

ms uses wrong location for ini files (data directories) in su environment

Reported by: jan.hradek Owned by:
Priority: major Milestone:
Component: mc-config-ini Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description (last modified by andrew_b) (diff)

Description:
MidnightCommander? uses the ini location of the logged-in user, instead of the user I "su"-ed into. "su -" (login shell) works as expected.
(happened on archlinux, bug report: https://bugs.archlinux.org/task/28322)

  • version(s): (i686) 4.8.1 - i've also tried current git with the same results
  • config and/or log files etc.: /etc/mc/ configuration files are untouched (from arch repositories, i will provide them if you ask for them)

Steps to reproduce:

  • login as a regular user (let's use "foo" as our regular user)
  • run mc and change configuration, I recommend to change something in the directory hotlist (Ctrl + \)
  • save your configuration
  • quit mc (F10)
  • su (to root), not the login shell "su -" which works ok.
  • now run mc in the su enviroment
  • (now mc reads the configuration of the regular user "foo")
  • NOTE: you can run 'mc -F' to actually see what data directories mc uses
  • go to the directory hotlist (Ctrl + \), you should see the hotlist of the logged-in user "foo", not the one you "su"d into
  • also if you try to save the configuration, mc clearly states where the config is written - to the user logged in "foo"
  • this is reproducible the other way too: login as root and su to some regular user

NOTES:

  • this bug has somewhat ugly side effect: if you save the configuration in the su environment then the ownership and the contents of "foo"'s ini files change (obviously)
  • mc's internal cd command (just type in "cd" and enter) changes correctly to the home of the su'd user.

Version, config and build information:

# LC_MESSAGES=C mc -V
GNU Midnight Commander 4.8.1
Built with GLib 2.30.2
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 and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, fish, smbfs
Data types: char: 8; int: 32; long: 32; void *: 32; size_t: 32; off_t: 64;
# LC_MESSAGES=C mc -F
[System data]
    Config directory: /etc/mc/
    Data directory:   /usr/share/mc/
    VFS plugins and scripts: /usr/lib/mc/
	extfs.d:        /usr/lib/mc/extfs.d/
	fish:           /usr/lib/mc/fish/

[User data]
    Config directory: /home/jh/.config/mc/
    Data directory:   /home/jh/.local/share/mc/
	skins:          /home/jh/.local/share/mc/skins/
	extfs.d:        /home/jh/.local/share/mc/extfs.d/
	fish:           /home/jh/.local/share/mc/fish/
    Cache directory:  /home/jh/.cache/mc/
# mc --configure-options
 '--prefix=/usr' '--sysconfdir=/etc' '--mandir=/usr/share/man' '--enable-background' '--enable-charset' '--enable-largefile' '--with-edit' '--with-gpm-mouse' '--with-mmap' '--enable-vfs-smb' '--with-screen=slang' '--with-subshell' '--with-vfs' '--with-x' '--without-debug' '--without-gnome' '--without-included-gettext' '--libexecdir=/usr/lib' 'CFLAGS=-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu'

Change History

comment:1 in reply to: ↑ description Changed 13 years ago by andrew_b

Replying to jan.hradek:

  • this bug has somewhat ugly side effect: if you save the configuration in the su environment then the ownership and the contents of "foo"'s ini files change (obviously)

Any other program works exactly the same. Just try.

So NOTABUG.

comment:2 Changed 13 years ago by jan.hradek

OK. But nice little warning would be appropriate, wouldn't it? I'm just asking, please close this bug.
Thank you for your support.

comment:3 Changed 13 years ago by slavazanko

But nice little warning would be appropriate, wouldn't it?

just add

Defaults always_set_home

to your /etc/sudoers file

comment:4 Changed 13 years ago by slavazanko

  • Status changed from new to closed
  • Resolution set to invalid

comment:5 Changed 13 years ago by andrew_b

  • Milestone Future Releases deleted

comment:6 Changed 3 years ago by andrew_b

  • Description modified (diff)
Note: See TracTickets for help on using tickets.