#/usr/local/bin/perl
#From: [email protected] (Pradeep Chetal)
#Subject: Re: I get "Insecure PATH" when I run commands from emacs...
#Date: 17 Jun 91 00:00:12 GMT
#Distribution: comp.lang.perl
#Organization: Pyramid Technology Corp., Mtn View, Calif.
#In-reply-to: [email protected]'s message of 16 Jun 91 21:23:15 GMT
#
#In article <[email protected]> [email protected] (Tom Christiansen) writes:
#
#   From the keyboard of [email protected] (Pradeep Chetal):
#   :I have a perl script which runs fine if I run it at shell level.
#   :However when I pipe stuff to it as a "shell command" in emacs I get
#   :the
#   :message:
#   :
#   :Insecure PATH at ppr line 18.
#   :Insecure PATH at ppr line 81.
#   :
#   :These two correspond to
#   :   chop($hostname = `hostname`);
#   :           AND
#   :   system($comamnd);
#   :respectively. The perl I had built fine with slight modifications to
#   :Configure script to get the libraries, etc BUT there were no other
#   :changes. This is
#   :
#   :This is perl, version 4.0
#   :
#   :$Header: perl.c,v 4.0 91/03/20 01:37:44 lwall Locked $
#   :Patch level: 0
#
#   Sounds like an evil emacs running set[ug]id.  What does id say?
#   Here's the one from the camel book in case you don't have one.
#
      # Usage: id
      sub u { local($name) = getpwuid($_[0]); $name && "($name)";}
      sub g { local($name) = getgrgid($_[0]); $name && "($name)";}
      sub bynum { $a <=> $b; }

      print "uid=$<", &u($<);
      print " gid=", $(+0, &g($();
      print " euid=$>", &u($>) if $> != $<;
      print " egid=", $)+0, &g($)) if $) != $(;
      @groups=split(' ', $(); shift(@groups);
      @groups && print " groups=",
          join(',', sort bynum grep(($_ .= &g($_)) || 1, @groups));
      print "\n";

#
#It is a setgid emacs running on the system.
#It also shows the egid when I run the "id" script
#via "emacs" as a Shell command. Since I do NOT have
#any control over the emacs, can I change the programming style so that
#I do NOT get the "Insecure PATH" problem. OR I should avoid such
#programming practice.
#
#Thanks,
#
#/Pradeep
#--
#------------------------------------------------------------------------------
#Pradeep Chetal                 UUCP:   ...!{decwrl,sun,uunet}!pyramid!chetal
#M/S 24                         Internet:       [email protected]
#Pyramid Technology             Phone:          (415) 335-8227 (O)
#1295 Charleston Road                           (415) 961-9789 (H)
#Mountain View, CA 94043                                (415) 335-8845 (FAX)
#
#