-P fix

Oskar Liljeblad oskar at osk.mine.nu
Wed Oct 30 06:09:58 UTC 2002


On Wednesday, September 11, 2002 at 03:26, Pavel Roskin wrote:

Hi!

> > My solution is to add another option -p that will allow you to
> > specify a file that the last working directory is written to.
> 
> That's fine.

1. Remove old -P, rename -p to -P.

> > A new function print_last_working_directory was created since
> > this functionality is needed in two places in main.c.
> > 
> > I also attempted to update the manual page.
> 
> But you didn't update the ouptut of "mc --help".  I know, it's wrong that
> mc describes options in two different places.  It's a result of too many 
> quick hacks in the sources.  But it must stop.

2. Add help for -P everwhere.

> You see, you made an error because the existing code is duplicated.  We
> cannot just ignore this error and go ahead.  Otherwise somebody else will
> stumble on the same place.

Of course not. I agree.

> > Here's a new mc.sh:
> 
> Maybe an alias for bash and zsh, since we are breaking everything anyway.
> I don't like exposing this function in the environment, since it
> discourages developers from improving it (especially increasing it in
> size).

3. Make mc.sh a wrapper script instead?
   Then you could use  alias mc=/usr/lib/mc/bin/mc.sh or whatever.

> > mc ()
> > {
> > 	TMPFILE="`mktemp`"
> > 	/usr/bin/mc -p "$TMPFILE" "$@"
> 
> We have a save temporary directory now, so using mktemp is probably not 
> needed - mc itself can create files safely.

If you want MC to create the temporary file, won't you end up with
exactly the same issues as before? Or do you intend to make use of
a file whose name is known from the beginning? (E.g.
$HOME/.mc/mcpwd.$$ where $$ is the pid of the parent processes -
the shell.)

Regards,

Oskar Liljeblad (oskar at osk.mine.nu)



More information about the mc-devel mailing list