problems with mc / version from SuSE 9.3

Dear listmembers,
recently I had an overful root fs that had been caused by mc. The reason for 
(my?) mc did not clean the directories /tmp/mc-<USERNAME> from waste. If I was 
downloading significant amounts of data from a ftp-website or looking into 
rpm-archives huge amounts of data are created and are not deleted 
appropriately when mc is left.
I then found out that there are two wrapper scripts that are in charge to 
actually call mc - what I think is somewhat problematic. If somebody decides 
to create an icon for mc on the desktop he will in general use /usr/bin/mc 
directly and hardly look for /usr/share/mc/bin/mc-wrapper.
If people use different shells than csh or sh those wrappers do not help at 
all, too.
However, my main concern is to get rid of all the waste in the tmp-directory 
when quitting mc. So I wrote a wrapper that (for me ..) seems to take care of 
I send a patch for the wrapper (I replace /usr/bin/mc by the wrapper and move 
mc to /usr/bin/mc.bin) that does this job for me, maybe someone is willing to 
give me a commentary on this, maybe even better someone can tell me the 
benefit of the two wrappers currently in use - not cleaning up the leftovers 
in the temporary directory.

Many thanks for your inputs,
take care

Dieter Jurzitza


                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <°°__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
--- mc-convert.original	2005-05-22 17:41:48.000000000 +0200
+++ mc-convert	2005-05-22 17:41:53.000000000 +0200
@@ -0,0 +1,30 @@
+export MCTMPDIR=/tmp/mc-`id -un`
+# start mc, actually!
+/usr/bin/mc.bin $*
+# Now we have to clean up.
+# If other mc-instances are active, do nothing, otherwise clean the directory!
+# watch out, the instances could be dead!
+# get the list of proc-id's that belong to the corresponding entries in $MCTMPDIR
+MCPROCLIST=`cd ${MCTMPDIR}; ls -c --color=none mc.pipe* 2>/dev/null | sed 's/mc\.pipe\.//g'| tr '\n' ' '`
+# Test whether those processes are active ones. If yes, do nothing!
+# if only one mc-process is still running, we do nothing!
+for i in ${MCPROCLIST}; do
+	RESULT=`ps -p $i -o pid= -o comm=`
+	if [ "${RESULT}" != "" ]; then
+		break;
+	fi
+# Delete everything in /tmp/mc-<USERNAME>, but only if no instances of mc run any more!
+if [ "${RESULT}" = "" ]; then
+	/bin/rm -rf ${MCTMPDIR}
+	mkdir ${MCTMPDIR}
+# That should be it!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]