Comment # 80 on bug 1203617 from Dirk Weber
(In reply to Dr. Werner Fink from comment #79)
> (In reply to Dirk Weber from comment #78)
> > The issue in current Tunbleweed (e.g. 20241006) with mc-4.8.32 is completely
> > different from this bug.
> > 
> > The issue in Tumbleweed is related to upstream
> > https://midnight-commander.org/ticket/4575
> > 
> > The wrapper script calls mc with a nonexistent directory, therefore mc can
> > not write the information of the current directory to the file and the
> > function can not get that information to cd to this directory. As a
> > workaround the directory can be created in order to restore the
> > functionality.
> > 
> > $ pidof mc
> > 6253
> > 
> > $ ps -Fp 6253
> > UID          PID    PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
> > user      6253    6049  0  5135 13680   0 08:58 pts/2    00:00:00
> > /usr/bin/mc -P /tmp/mc-user/mc.pwd.6049
> > 
> > 
> > $ ll /tmp/mc-user
> > ls: cannot access '/tmp/mc-user': No such file or directory
> > 
> > 
> > Workaround:
> > $ mkdir "/tmp/mc-$(whoami)" && chmod 0700 "/tmp/mc-$(whoami)"
> 
> 
> I really wonder why a file is used at all ... this is a typical usecase for
> an environment variable as a process can not only set a variable (e.g. here
> at start) but also read this variable at any time (e.g. here at exit).

I am not the developer of mc, but the goal is:
mc is started from a shell and runs as a child process. 
It is desired that after quitting mc the cwd of this shell - parent process of
mc - should be the last directory of the active mc panel.

So the wrapper function generates a temporary file name and at exit mc writes
into this file the last directory. The wrapper function in the parent shell can
then cd to the directory it finds in the temporary file.

The mc binary in the child process can not modify the environment of its parent
process, therefore it can not transfer the last directory in an environment
variable.


BTW: I realized I missed your question in comment 71:

> Why are you patching /etc/bash.bashrc instead of /etc/bash.profile ... does
> /etc/profile.d/mc.sh and/or /usr/share/mc/mc.sh include shell functions
> or only environment variables?

I do not have a /etc/bash.profile (now on Leap 15.6, and don't remember it
existed in prior Leap versions; also not in Tumbleweed).


You are receiving this mail because: