Re: hardcoded /tmp instead of TMPDIR
On Wed, 11 Sep 2002, Pavel Roskin wrote: I still hope to avoid the pipe completely, since it's not portable to Cygwin. Not so easy. It I run tcsh 3log, /proc shows that the open file descriptors are 15, 16, 17, 18 and 19. The same if I run tcsh. In other words, tcsh closes the files it inherits from the parent process. Which leaves us with pipes, UNIX sockets, SysV IPC, TCP/IP and other things, of which the pipes are still the simplest solution. TCP/IP may be more portable, but it would be a huge overkill. Hello, Pavel! Do you see any way to use AF_INET sockets at all ? I think it is not possible - where is the shell going to redirect the output of 'pwd' ? I.e. you need a shell capabale to write to localhost: let's say. I see the bash man page mentions something about /dev/tcp/hostname/port filename handling, but that is only bash, tchs doesn't seem to support it. Btw a very easy solution for tcsh is to redirect the output of 'pwd' to /proc/parent_pid/fd/write_end_of_pipe - that is create by a call to pipe (). It's a pity though that not all operationg systems support that :( Thanks! Pavel Tsekov ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
Hello! Do you see any way to use AF_INET sockets at all ? I think it is not possible - where is the shell going to redirect the output of 'pwd' ? We can always make a small helper application and put it to the same directory as cons.saver. By the way, I forgot using a regular file in the temporary directory - that would be really simple. We may have some sharing problems, so in the worst case that file will have to be opened and closed every time. Unfortunately, writing to a file means extra disk activity in many cases. Another solution - use some predefined token on stdout. In other words, replace pwd with something like: echo Attention mc pid 1923: ; pwd; echo mc pid 1923 done Scanning for tokens will take some time in mc, but that would be the most portable solution, and it will be useful for bash and zsh as well. -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
Hello! Again replying to myself :-) Another solution - use some predefined token on stdout. In other words, replace pwd with something like: echo Attention mc pid 1923: ; pwd; echo mc pid 1923 done Better yet - output the working directory after the kill, not before, and use stdout. The first line from the subshell stdout after SIGCONT will be the working directory. The rest will be the prompt. This would eliminate all pipes for all subshells. feed_subshell() would have to check for SIGCHLD in the loop, instead of relying on the pipe output as the sign that the subshell has completed the command. The prompt will be loaded when it's ready, not when load_prompt() requests it. That would fix some artifacts too. Unfortunately, the amount of the requires changes make it unrealistic to implement this proposal before 4.6.0. -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
On Wed, 11 Sep 2002, Pavel Roskin wrote: Hello! Again replying to myself :-) Another solution - use some predefined token on stdout. In other words, replace pwd with something like: echo Attention mc pid 1923: ; pwd; echo mc pid 1923 done Better yet - output the working directory after the kill, not before, and use stdout. The first line from the subshell stdout after SIGCONT will be the working directory. The rest will be the prompt. This would eliminate all pipes for all subshells. feed_subshell() would have to check for SIGCHLD in the loop, instead of relying on the pipe output as the sign that the subshell has completed the command. Cool! :) The prompt will be loaded when it's ready, not when load_prompt() requests it. That would fix some artifacts too. Cooler! :) Unfortunately, the amount of the requires changes make it unrealistic to implement this proposal before 4.6.0. If help is provided do you think it can be achieved ? ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
Unfortunately, the amount of the requires changes make it unrealistic to implement this proposal before 4.6.0. If help is provided do you think it can be achieved ? The coding is not a problem. Remove all pipes and all redirections from pwd, put pwd after kill, dissolve synchronize() in feed_subshell() and make sure to stop on the newline when reading the current directory. Making the subshell work after that surgery will be a problem. Making it work well will be a big problem. The code is very fragile. The subshell code has many little glitches that most users are accustomed to. For example, some users expect to press Ctrl-O and see the program output in the prompt. It's a bug, but some users may think that it's a feature. Right now, the prompt is read when the code outside subshell.c decides to read it. We may need to change it. The prompt should be read when it comes from the shell. Actually, I hope that the prompt loading won't have to be changed at this stage if we read the pwd output byte-by-byte. If somebody provides the code that works at least with some subshells, it will certainly help. -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
Hello! BTW, it would be nice if mc created temporary files in $TMPDIR/mc-username instead of $HOME/.mc/tmp (the ones with directory names inside as I understand). For example, I have in /tmp: ksocket-nerijus/ mcop-nerijus/ orbit-nerijus/ orbit-root/ Thanks for the suggestion! I have committed a patch that introduces a new function, mc_tmpdir(), that creates such directory. The actual transition to using it everywhere will require more patches. $HOME/.mc/tmp is only used in the shell script, as far as I can tell. The binary uses $TMPDIR. I'd like it because there are lots of mc-1685 type files in ~/.mc/tmp (when ssh connection with mc active terminates for example), and these files are not automatically cleaned. Clean up is still not implemented, and I'm not sure how to do it safely without risk of interfering with other processes, especially when networked filesystems are used. But it's just the files from ~/.mc/tmp that bother you, you probably could unset the mc function in the shell. -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
Hello, Oskar! MC does not use $TMP. (The reporter must have meant $TMPDIR.) I did a grep (with MC of course :) for files with /tmp and found one place in subshell.c. This patch ought to fix it. I tested it (with tcsh as shell of course) and it works fine. You forgot some debugging statements in the patch. Also, it seems that you are calculating tmpdir both in the child and in the parent processes. Why? Whould not it be better to calculate it once? I also think that the name of the pipe should be calculated once. I still hope to avoid the pipe completely, since it's not portable to Cygwin. -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: hardcoded /tmp instead of TMPDIR
On Thu, 5 Sep 2002 22:16:55 +0200 Oskar Liljeblad [EMAIL PROTECTED] wrote: MC does not use $TMP. (The reporter must have meant $TMPDIR.) BTW, it would be nice if mc created temporary files in $TMPDIR/mc-username instead of $HOME/.mc/tmp (the ones with directory names inside as I understand). For example, I have in /tmp: ksocket-nerijus/ mcop-nerijus/ orbit-nerijus/ orbit-root/ I'd like it because there are lots of mc-1685 type files in ~/.mc/tmp (when ssh connection with mc active terminates for example), and these files are not automatically cleaned. Regards, Nerijus ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel