URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13832>
Summary: Cannot execute user menu command if temporary directory is in filesystem mounted with noexec option Project: GNU Midnight Commander Submitted by: None Submitted on: Mon 07/18/2005 at 11:41 Category: Menu and associations Severity: 3 - Normal Status: Fixed Privacy: Public Assigned to: None Open/Closed: Closed Release: current (CVS or snapshot) Platform Version: GNU/Linux _______________________________________________________ Details: If environment variables $TMP and $TMPDIR are set to /tmp/.private/$USER and /tmp is mounted with noexec options then user menu commands (scripts) cannot be executed. Patch is attached. _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Sun 07/31/2005 at 19:30 By: Roland Illig <rillig> Fixed in current CVS. ------------------------------------------------------- Date: Sun 07/31/2005 at 18:48 By: Leonard den Ottolander <leonardjo> I would like to have to test for the mount options of $MC_TMPDIR every time. What about d) Test for mount options of $MC_TMPDIR on init and set a parameter (need_shell) so we don't have to do this test on every invokation of shell_execute(). In case of failure test mount options again and reset the parameter need_shell to new value and retry (only when the mount option did change). ------------------------------------------------------- Date: Sun 07/31/2005 at 16:56 By: Pavel Tsekov <ptsekov> There is no reliable way to determine the type of error from the exit status returned by system(). b) and c) are not viable solutions IMHO. ------------------------------------------------------- Date: Sat 07/30/2005 at 10:30 By: Leonard den Ottolander <leonardjo> Before committing this patch I'd like to see it extended in either of the following ways first: a) Test for mount options of $MC_TMPDIR and concatenate "/bin/sh " only when necessary. b) Extend shell_execute(), do_execute() to pass the error generated by my_system on failure. Execute the command plainly and in case of an error caused by the mount options execute it once again with a concatenated shell. c) Extend to pass error as in b). Test on init and set a parameter (need_shell) so we don't have to do this test on every invokation of shell_execute(). In case of failure because the mount option changed during the session reset the parameter need_shell to new value and retry. I would prefer the last option. ------------------------------------------------------- Date: Tue 07/19/2005 at 07:54 By: Pavel Tsekov <ptsekov> Btw maybe you could use the global variable 'shell' here: + char *cmd = g_strconcat("/bin/sh ", file_name, (char ^^^^^^^^^^ Just a thought. ------------------------------------------------------- Date: Tue 07/19/2005 at 07:52 By: Pavel Tsekov <ptsekov> It works for me too. I looked closer at the code as soon as I had time and it looks ok. The only thing which bothers me is that an additional shell is executed each time a user menu command is invoked . Maybe the code should query the mount options of the temporary dir and set a flag then the code in user.c could use the flags. Of course all this might be unnecessary :) I think your patch can be applied as is an then further adjusted if necessary. ------------------------------------------------------- Date: Tue 07/19/2005 at 04:51 By: Anonymous Yes. The patch works for me. This method is used in file extension execution (ext.c, lines 223, 224). ------------------------------------------------------- Date: Mon 07/18/2005 at 13:32 By: Pavel Tsekov <ptsekov> Have you tested you patch without subshell support i.e. 'mc -u' ? _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Mon 07/18/2005 at 11:41 Name: mc-4.6.1-pre5-exec-usr-cmd.patch Size: 418B By: None <http://savannah.gnu.org/bugs/download.php?item_id=13832&item_file_id=2724> _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13832> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel