Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Philip Hands
Marek Habersack [EMAIL PROTECTED] writes:

 [1  text/plain; us-ascii (quoted-printable)]
 * Philip Hands said:
  Wait a second.
  
  So this mc script is an attempt to leave you in the directory you were
  in when you left mc ?
 [snip]
/etc
/tmp
  
  the ``cd /etc'' only applies in the shell executed in the brackets.
  The same goes for the mc script. Any effect of the cd in the script is
  lost when the script exits.
 Correct. My typo - it should be:
 
 cd $(cat thetmpfile)

Eh ?

It doesn't matter how you provide the directory name to the cd,
because wherever you cd to only persists to the end of the wrapper
script, so it's not going to do you any good anyway.

Please try to pay attention.

To demonstrate:

palm:~$ echo -e '#!/bin/bash\ncd /'  /tmp/cd_to_root
palm:~$ chmod +x /tmp/cd_to_root
palm:~$ pwd
/home/phil
palm:~$ /tmp/cd_to_root 
palm:~$ pwd
/home/phil

See?

Cheers, Phil.



Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Marek Habersack
* Piotr Roszatycki said:

  Well that won't work will it?
  
  Try running this:
  
cd /tmp; ( cd /etc; pwd );  pwd
 
 No no, it isn't mc script but only function in your ~/.bash_profile or
 global /etc/profile.
Exactly that was the point. The function executes in the context of the
current shell, not in the child shell which is created when a #!/bin/bash
script is invoked.
 
 I'm afraid many people have some kind of function or aliases related
 to _real_ mc binary and current mc wrapper can broke it.
Yes, I was one of them. 
 
 BTW, 
 /usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
I'd vote for removal of the wrapper script for three reasons: 1) it's a
bashism, 2) it's a waste of memory, 3) it can be done more elegantly.

marek


pgpELtGJGraS6.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Marek Habersack
* Eric Weigel said:

 I'm afraid many people have some kind of function or aliases related
 to _real_ mc binary and current mc wrapper can broke it.
 
 BTW, 
 /usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
 This is the reason that mcedit doesn't work already.
 
 Quite.
 
 And this has nothing to do with how much resources a bash takes up.
 When the bash exits, control is returned to the original directory; no
 matter what the bash script did.
Yes it does, but it's not the matter. Do you think that firing up an
unnecessary copy of bash just for the sake of the exit directory
preservation is a good thing? Especially when it can be completely avoided.
 
 And, the idea of editing /etc/profile or whatever is to my mind really
 bad.
 
 The upstream source for mc has sample scripts which users can call from
 their own .bash_profile, .profile, etc, both for Bourne and C shells. 
 They should be made available (they are also listed on the man page for
 mc)
Well then, they should be provided to the Debian user. They, AFAIR, install
a similar function to the one presented in the other mail. The standard
/etc/profile and similar scripts for other shells could be modified to
source all scripts in, eg, /etc/shell-ext (just an idea - don't take the name 
seriously :)) so that they can install appropriate functions, aliases etc.

 ps: the reason for not doing
 
  cd `mc -P $@`
 
 is given in the man page.  Something to do with control-Z to suspend
 doesn't work unless you use the temporary file method.
I proposed cd $(cat tempfile) which should work excellent.

marek


pgpLEDPi7Rkyi.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Philip Hands
Marek Habersack [EMAIL PROTECTED] writes:

 [1  text/plain; us-ascii (quoted-printable)]
 * Piotr Roszatycki said:
 
   Well that won't work will it?
   
   Try running this:
   
 cd /tmp; ( cd /etc; pwd );  pwd
  
  No no, it isn't mc script but only function in your ~/.bash_profile or
  global /etc/profile.
 Exactly that was the point. The function executes in the context of the
 current shell, not in the child shell which is created when a #!/bin/bash
 script is invoked.

Fair enough, then it's something to mention in the package's
documentation, since packages are forbidden from playing with users'
environments by policy (for very good reasons).

  I'm afraid many people have some kind of function or aliases related
  to _real_ mc binary and current mc wrapper can broke it.
 Yes, I was one of them. 
  
  BTW, 
  /usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
 I'd vote for removal of the wrapper script for three reasons: 1) it's a
 bashism, 2) it's a waste of memory, 3) it can be done more elegantly.

More important IMO is the fact that it cannot work as a script, so
there is little point including it as a script.

Cheers, Phil.



Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Philip Hands
Marek Habersack [EMAIL PROTECTED] writes:

 Well then, they should be provided to the Debian user. They, AFAIR,
 install a similar function to the one presented in the other
 mail. The standard /etc/profile and similar scripts for other shells
 could be modified to source all scripts in, eg, /etc/shell-ext (just
 an idea - don't take the name seriously :)) so that they can install
 appropriate functions, aliases etc.

This is against policy (3.8) for very good reasons.

The users' environment is not to be touched by packages.  If the
maintainer want to document the example so that sysadmins can easily
put it into their /etc/profiles themselves, fair enough.

Personally, I would be quite upset to find that someone had put this
into my environment, because I have a very strong expectation that
when I exit a program, I'll be in the directory I started from.

Cheers, Phil.



Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Michael Bramer
On Thu, Sep 16, 1999 at 07:54:11PM +0200, Piotr Roszatycki wrote:
 On 16 Sep 1999, Philip Hands wrote:
 
  Wait a second.
  
  So this mc script is an attempt to leave you in the directory you were
  in when you left mc ?
  
  Well that won't work will it?
  
  Try running this:
  
cd /tmp; ( cd /etc; pwd );  pwd
 
 No no, it isn't mc script but only function in your ~/.bash_profile or
 global /etc/profile.
 
 I'm afraid many people have some kind of function or aliases related
 to _real_ mc binary and current mc wrapper can broke it.
 
 BTW, 
 /usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
 This is the reason that mcedit doesn't work already.


All you are right. 

I make a new upload (or you make a NMU) and remove all the last changes.

Grisu
-- 
Michael Bramer -- a Debian Linux Developer  http://www.debian.org
PGP: finger [EMAIL PROTECTED]   --  Linux Sysadmin   -- Use Debian Linux
Linux - the choice of a GNU generation


pgpyAyLfzr6Kt.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Martin Bialasinski

* Philip == Philip Hands [EMAIL PROTECTED] wrote:

Philip Personally, I would be quite upset to find that someone had put this
Philip into my environment, because I have a very strong expectation that
Philip when I exit a program, I'll be in the directory I started from.

Personally, I found it very confusing and annoying not to stay in the
last directory I was in, when exiting mc (as opposed to nc in dos).

It really depends on the background you come from. Looks like Michael
had the later case in mind.

Anyway, this has no relevance as it can't work in this case anyway.

Ciao,
Martin



Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Marek Habersack
* Philip Hands said:

   No no, it isn't mc script but only function in your ~/.bash_profile or
   global /etc/profile.
  Exactly that was the point. The function executes in the context of the
  current shell, not in the child shell which is created when a #!/bin/bash
  script is invoked.
 
 Fair enough, then it's something to mention in the package's
 documentation, since packages are forbidden from playing with users'
 environments by policy (for very good reasons).
Well, after giving it a little thought it seems right - the only one
entitled to mess with the private startup scripts is the user himself.

   BTW, 
   /usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
  I'd vote for removal of the wrapper script for three reasons: 1) it's a
  bashism, 2) it's a waste of memory, 3) it can be done more elegantly.
 
 More important IMO is the fact that it cannot work as a script, so
 there is little point including it as a script.
That too. Besides if someone really wants to stay in the last selected
directory, he should read the manpage. But, to let the people know that
there exists such possibility, perhaps it would be good to announce it
during MC installation phase? It seems that people are used to this behavior
- from the good'n'old NC :))

marek


pgpeFUr7DGIVU.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-17 Thread Martin Bialasinski

* Michael == Michael Bramer [EMAIL PROTECTED] wrote:

Michael I make a new upload (or you make a NMU) and remove all the last 
changes.

I just got blessings from Michael to do the NMU. Just to inform you,
so there are no duplicate effords.  

Ciao,
Martin



Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Martin Bialasinski

* Marek == Marek Habersack [EMAIL PROTECTED] wrote:

Marek Also, wouln't it be cleaner if the postinst for this package
Marek added an appropriate alias to the /etc/profile and/or
Marek /etc/csh.cshrc (and possibly other global shell startup
Marek scripts) an alias definition, or a function to call mc in a way
Marek which would preserve the exit path of mc?

No, directly changing files part of other packages is not allowed by
policy.

Marek a command from within mc or just does Ctrl-O another subshell
Marek is invoked by MC - that's three copies of bash for one run of
Marek MC.

No, ^o doesn't open a new shell. If you just start mc, you get 

 6832 ttyp8S  0:00  |   \_ bash /usr/bin/mc 
 6833 ttyp8S  0:00  |   \_ /usr/bin/mc.real -P
 6835 ttyp5S  0:00  |   \_ bash -rcfile .bashrc

^o doesn't change a thing.

Starting a program (wether in the for- or background) just adds this
programm like in 

 6832 ttyp8S  0:00  |   \_ bash /usr/bin/mc
 6833 ttyp8S  0:00  |   \_ /usr/bin/mc.real -P
 6835 ttyp5S  0:00  |   \_ bash -rcfile .bashrc
 6844 ttyp5S  0:01  |   \_ wxftp

Ciao,
Martin



Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Marek Habersack
* Martin Bialasinski said:

 Marek /etc/csh.cshrc (and possibly other global shell startup
 Marek scripts) an alias definition, or a function to call mc in a way
 Marek which would preserve the exit path of mc?
 
 No, directly changing files part of other packages is not allowed by
 policy.
Hmm... couldn't it be done in a similar way like with inetd.conf? That a
program, in this case MC, would register an alias with the shell startup
scripts?
 
 Marek a command from within mc or just does Ctrl-O another subshell
 Marek is invoked by MC - that's three copies of bash for one run of
 Marek MC.
 
 No, ^o doesn't open a new shell. If you just start mc, you get 
 
  6832 ttyp8S  0:00  |   \_ bash /usr/bin/mc 
  6833 ttyp8S  0:00  |   \_ /usr/bin/mc.real -P
  6835 ttyp5S  0:00  |   \_ bash -rcfile 
 .bashrc
 
 ^o doesn't change a thing.
 
 Starting a program (wether in the for- or background) just adds this
 programm like in 
That's right, I was wrong. But still, using a shell script to invoke MC just
for the sake of the exit path preservation is a waste of memory. If the
alias/function cannot be added to the shell startup scripts for the policy 
reasons,
then maybe it could be included in the skeleton files? Something like this
(for POSIX-compliant shells):

mc() {
  if [ -x /usr/bin/mc ]; then
MC=$(/bin/mktemp /tmp/mc.XX)
/usr/bin/mc -P $@ $MC  $MC
cd $(cat $MC)
rm -f $MC
  fi
}

This function put in skeleton would be present for all new users, however a
better place would be in the global startup scripts.

marek


pgpEGs7pNlOuX.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Philip Hands
Wait a second.

So this mc script is an attempt to leave you in the directory you were
in when you left mc ?

Well that won't work will it?

Try running this:

  cd /tmp; ( cd /etc; pwd );  pwd

and you'll get

  /etc
  /tmp

the ``cd /etc'' only applies in the shell executed in the brackets.
The same goes for the mc script. Any effect of the cd in the script is
lost when the script exits.

Cheers, Phil.



Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Piotr Roszatycki
On Thu, 16 Sep 1999, Marek Habersack wrote:
 
 mc() {
   if [ -x /usr/bin/mc ]; then
   MC=$(/bin/mktemp /tmp/mc.XX)
   /usr/bin/mc -P $@ $MC  $MC
   cd $(cat $MC)
   rm -f $MC
   fi
 }

I think the more simple is:

mc=()
{
cd $(/usr/bin/mc -P $@)
}

... and doesn't use temporary files.

-- 

Piotr Dexter Roszatycki
mailto:[EMAIL PROTECTED]



Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Marek Habersack
* Philip Hands said:
 Wait a second.
 
 So this mc script is an attempt to leave you in the directory you were
 in when you left mc ?
[snip]
   /etc
   /tmp
 
 the ``cd /etc'' only applies in the shell executed in the brackets.
 The same goes for the mc script. Any effect of the cd in the script is
 lost when the script exits.
Correct. My typo - it should be:

cd $(cat thetmpfile)

marek


pgpJZEWHxM066.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Marek Habersack
* Piotr Roszatycki said:
 On Thu, 16 Sep 1999, Marek Habersack wrote:
  
  mc() {
if [ -x /usr/bin/mc ]; then
  MC=$(/bin/mktemp /tmp/mc.XX)
  /usr/bin/mc -P $@ $MC  $MC
  cd $(cat $MC)
  rm -f $MC
fi
  }
 
 I think the more simple is:
 
 mc=()
 {
 cd $(/usr/bin/mc -P $@)
 }
 
 ... and doesn't use temporary files.
But it's the same what using a script file - it uses a subshell, and the
point is to save on resources.

marek


pgpiUQR649oIF.pgp
Description: PGP signature


Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Piotr Roszatycki
On 16 Sep 1999, Philip Hands wrote:

 Wait a second.
 
 So this mc script is an attempt to leave you in the directory you were
 in when you left mc ?
 
 Well that won't work will it?
 
 Try running this:
 
   cd /tmp; ( cd /etc; pwd );  pwd

No no, it isn't mc script but only function in your ~/.bash_profile or
global /etc/profile.

I'm afraid many people have some kind of function or aliases related
to _real_ mc binary and current mc wrapper can broke it.

BTW, 
/usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
This is the reason that mcedit doesn't work already.

-- 

Piotr Dexter Roszatycki
mailto:[EMAIL PROTECTED]



Re: (g)mc-4.5.38-2 still broken

1999-09-16 Thread Eric Weigel

On Thu, 16 Sep 1999 19:54:11 +0200 (CEST), Piotr Roszatycki wrote:

No no, it isn't mc script but only function in your ~/.bash_profile or
global /etc/profile.

I'm afraid many people have some kind of function or aliases related
to _real_ mc binary and current mc wrapper can broke it.

BTW, 
/usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
This is the reason that mcedit doesn't work already.

Quite.

And this has nothing to do with how much resources a bash takes up.
When the bash exits, control is returned to the original directory; no
matter what the bash script did.

And, the idea of editing /etc/profile or whatever is to my mind really
bad.

The upstream source for mc has sample scripts which users can call from
their own .bash_profile, .profile, etc, both for Bourne and C shells. 
They should be made available (they are also listed on the man page for
mc)

ps: the reason for not doing

 cd `mc -P $@`

is given in the man page.  Something to do with control-Z to suspend
doesn't work unless you use the temporary file method.

On Thu, 16 Sep 1999 19:54:11 +0200 (CEST), Piotr Roszatycki wrote:

On 16 Sep 1999, Philip Hands wrote:

 Wait a second.
 
 So this mc script is an attempt to leave you in the directory you were
 in when you left mc ?
 
 Well that won't work will it?
 
 Try running this:
 
   cd /tmp; ( cd /etc; pwd );  pwd

No no, it isn't mc script but only function in your ~/.bash_profile or
global /etc/profile.

I'm afraid many people have some kind of function or aliases related
to _real_ mc binary and current mc wrapper can broke it.

BTW, 
/usr/bin/mcedit is a symlink to /etc/bin/mc which is an only wrapper.
This is the reason that mcedit doesn't work already.

-- 

Piotr Dexter Roszatycki
mailto:[EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]