*Synopsis*: pgrep can't find scriptname when script is run by ksh93

CR 6680532 changed on Nov 6 2010 by <User 1-5HNZ8F>

=== Field ============ === New Value ============= === Old Value =============

Fixed in Build         snv_153                                                
Status                 8-Fix Available             7-Fix in Progress          
====================== =========================== ===========================

     
*Change Request ID*: 6680532

*Synopsis*: pgrep can't find scriptname when script is run by ksh93

  Product: solaris
  Category: kernel
  Subcategory: syscall
  Type: Defect
  Subtype: Functionality
  Status: 8-Fix Available
  Substatus: 
  Priority: 2-High
  Introduced In Release: solaris_2.0
  Introduced In Build: solaris_2.0
  Responsible Engineer: <User 1-5Q-9201>
  Keywords: 

=== *Description* ============================================================
If I have a script called, say, "mmm", which is run by ksh93 (invoked either
as ksh or as ksh93), then "pgrep mmm" returns nothing.  If it's run by ksh88
then it returns the process id.

pgrepping for "ksh" returns the pid for the ksh93 case, but not for the ksh88
case.

*** (#1 of 2): 2008-03-26 20:14:43 GMT+00:00 <User 1-5Q-2233>

Not only is this a diffrence between ksh88 and ksh93 it is different to what 
happens with
zsh and bash (both of those have the same behaviour as ksh88):

For example:

portellen:pts/3$ ./foo &
[1] 22120
portellen:pts/3$ pargs 22120
22120:  /bin/ksh -p ./foo
argv[0]: /bin/ksh
argv[1]: /bin/ksh
argv[2]: ./foo
portellen:pts/3$ pgrep foo
portellen:pts/3$ pgrep -f foo
22120
portellen:pts/3$ ./bar &
[2] 24841
portellen:pts/3$ pargs 24841
24841:  /bin/zsh -p ./bar
argv[0]: /bin/zsh
argv[1]: 
argv[2]: ./bar
portellen:pts/3$ pgrep bar
24841
portellen:pts/3$ ./baz &
[3] 29439
portellen:pts/3$ pargs 29439
29439:  /bin/bash -p ./baz
argv[0]: /bin/bash
argv[1]: -p
argv[2]: ./baz
portellen:pts/3$ pgrep baz
29439
portellen:pts/3$ cat foo
#!/bin/ksh -p

sleep 300
portellen:pts/3$ cat bar
#!/bin/zsh -p

sleep 300
portellen:pts/3$ cat baz
#!/bin/bash -p

sleep 300

*** (#2 of 2): 2009-07-29 13:44:43 GMT+00:00 <User 1-5Q-14842>


=== *Public Comments* ========================================================
All other shell are not isaexeced. Did you try to use ksh93 binary directly?

Any reason why it should be ksh93 bug if pgrep is using /proc interface?

*** (#1 of 7): 2009-07-29 21:29:37 GMT+00:00 <User 1-1SURPB>

After more than month no updates. Closing as not a defect.

*** (#2 of 7): 2009-08-31 09:29:26 GMT+00:00 <User 1-1SURPB>

It appears that running with /usr/bin/i86/ksh93 makes it work fine.  The issue 
seems to be that the wrapper code that's installed as /usr/bin/ksh itself execs 
/usr/bin/ksh93 directly.  If it were to exec /usr/bin/i86/ksh93, I would expect 
the problem to also go away, but it doesn't.  It looks like it has something to 
do with the fact that there's an exec call.

I'm moving this to libproc, as it does seem pretty clear that it's not a ksh93 
problem.

*** (#3 of 7): 2009-08-31 17:08:57 GMT+00:00 <User 1-5Q-2233>

After discussing with ksh93 folks, it seems to be limitation with isaexec. So 
transfering it back to libproc.

*** (#4 of 7): 2009-09-02 12:11:21 GMT+00:00 <User 1-GN0KC>

Even if it is a limiation in isaexec it is because ksh93 is installed with 
isaexec unlike all the other shells that we have this problem.  I really still 
don't understand why the default for /usr/bin/ksh93 needs to be the 64 bit 
version.

*** (#5 of 7): 2009-09-02 12:25:30 GMT+00:00 <User 1-5Q-14842>

The result of PSARC/2006/550

I do not know what were the reasons for this, but I see benefits in speed and 
automatic transition of commands to 64-bit (bypassing limits of 32-bit world 
like timestamps).

Yes, other shells are not isaexed. Like many other tools are not isaexeced.

If somebody feels it was not correct decision, I would recommend to open 
discussion in ksh93 project integration mailing list (<email address omitted>).

*** (#6 of 7): 2009-09-02 12:46:40 GMT+00:00 <User 1-1SURPB>

Given that /usr/bin/ksh is also now a link to /usr/lib/isaexec this is even 
more important that it be fixed.

While ksh is the only shell suffering from this it is because it is using the 
isaexec feature that this issue occurs.

*** (#7 of 7): 2010-04-06 11:03:36 GMT+00:00 <User 1-5Q-14842>


=== *Workaround* =============================================================
Adding "-f" to the pgrep line finds the ksh93 versions.

*** (#1 of 4): 2009-07-29 13:44:43 GMT+00:00 <User 1-5Q-14842>

>From Roland Mainz:

for OS/Net >= B121 compile your scripts with

$ /usr/bin/shcomp <scriptname> <execname>

*** (#2 of 4): 2009-07-29 21:37:16 GMT+00:00 <User 1-1SURPB>
*** Last Edit: 2009-07-29 21:37:38 GMT+00:00 <User 1-1SURPB>

Remove the isaexec link for /usr/bin/ksh93 and make /usr/bin/ksh93 the 32 bit 
version.
This puts ksh93 in the same position as all the other shells.

*** (#3 of 4): 2009-09-02 12:26:18 GMT+00:00 <User 1-5Q-14842>

The shcomp workaround isn't practical when a) you aren't in control of the 
packaging of the scripts and/or b) it is interactive use not scripts that is 
causing the problem.

This needs to be fixed

*** (#4 of 4): 2010-04-06 11:03:36 GMT+00:00 <User 1-5Q-14842>


=== *Additional Details* =====================================================
        Targeted Release: solaris_nevada
        Commit To Fix In Build: snv_153
        Fixed In Build: snv_153
        Integrated In Build: 
        Verified In Build: 
  See Also: 6974936, 6987277
  Duplicate of: 
  Hooks:
        Hook1: 
        Hook2: 
        Hook3: 
        Hook4: 
        Hook5: 
        Hook6: 
  Program Management: 
  Root Cause: Another Bug Fix
  Fix Affects Documentation: No
  Fix Affects Localization: No

=== *History* ================================================================
        Date Submitted: 2008-03-26 20:14:43 GMT+00:00
        Submitted By: <User 1-5Q-2233>

        Status Changed    Date Updated                  Updated By
        3-Accepted        2008-08-21 00:33:23 GMT+00:00 <User 1-5Q-5151>
        2-Incomplete      2009-07-29 21:29:37 GMT+00:00 <User 1-1SURPB>
        11-Closed         2009-08-31 09:29:26 GMT+00:00 <User 1-1SURPB>
        1-Dispatched      2009-08-31 17:08:57 GMT+00:00 <User 1-5Q-2233>
        5-Cause Known     2009-09-02 09:42:46 GMT+00:00 <User 1-GN0KC>
        6-Fix Understood  2010-09-24 18:34:33 GMT+00:00 <User 1-5Q-9201>
        7-Fix in Progress 2010-09-24 22:10:53 GMT+00:00 <User 1-5Q-9201>
        8-Fix Available   2010-11-06 19:04:30 GMT+00:00 <User 1-5HNZ8F>


=== *Service Request* ========================================================
        Impact: Significant
        Functionality: Primary
        Severity: 2
        Product Name: solaris
        Product Release: solaris_nevada
        Product Build: 
        Operating System: solaris
        Hardware: generic
        Submitted Date: 2008-03-26 20:14:43 GMT+00:00


=== *Service Request* ========================================================
        Impact: Significant
        Functionality: Primary
        Severity: 2
        Product Name: solaris
        Product Release: solaris_nevada
        Product Build: snv_135
        Operating System: solaris_nevada
        Hardware: ultrasparc
        Submitted Date: 2010-03-18 09:55:09 GMT+00:00


=== *Multiple Release (MR) Cluster* - 0 ======================================

_______________________________________________
ksh93-integration-discuss mailing list
ksh93-integration-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss

Reply via email to